From 4d1cda033e0619309c606fc686de3adcf599539e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 13 Dec 2018 08:38:38 +0100 Subject: [PATCH] unix: remove Flock syscall for aix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AIX doesn't provide a flock() syscall, it was previously emulated in package syscall by using fcntl. This emulation was removed in CL 152397. Since unix.Flock wraps syscall.Flock, the build currently fails on aix without this change. Change-Id: Ie887619cd64ae009ea43f00c74e450a5b8f998ac Reviewed-on: https://go-review.googlesource.com/c/153938 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Clément Chigot Reviewed-by: Ian Lance Taylor --- unix/example_exec_test.go | 19 +++++++++++++++++++ ...{example_test.go => example_flock_test.go} | 7 +------ unix/syscall_aix.go | 9 +-------- 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 unix/example_exec_test.go rename unix/{example_test.go => example_flock_test.go} (75%) diff --git a/unix/example_exec_test.go b/unix/example_exec_test.go new file mode 100644 index 00000000..bb4d3bf5 --- /dev/null +++ b/unix/example_exec_test.go @@ -0,0 +1,19 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris + +package unix_test + +import ( + "log" + "os" + + "golang.org/x/sys/unix" +) + +func ExampleExec() { + err := unix.Exec("/bin/ls", []string{"ls", "-al"}, os.Environ()) + log.Fatal(err) +} diff --git a/unix/example_test.go b/unix/example_flock_test.go similarity index 75% rename from unix/example_test.go rename to unix/example_flock_test.go index ae008f5b..6c917485 100644 --- a/unix/example_test.go +++ b/unix/example_flock_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris package unix_test @@ -13,11 +13,6 @@ import ( "golang.org/x/sys/unix" ) -func ExampleExec() { - err := unix.Exec("/bin/ls", []string{"ls", "-al"}, os.Environ()) - log.Fatal(err) -} - func ExampleFlock() { f, _ := os.Create("example.lock") if err := unix.Flock(int(f.Fd()), unix.LOCK_EX); err != nil { diff --git a/unix/syscall_aix.go b/unix/syscall_aix.go index f8eac174..992a8ea0 100644 --- a/unix/syscall_aix.go +++ b/unix/syscall_aix.go @@ -13,10 +13,7 @@ package unix -import ( - "syscall" - "unsafe" -) +import "unsafe" /* * Wrapped @@ -385,10 +382,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys fcntl(fd int, cmd int, arg int) (val int, err error) -func Flock(fd int, how int) (err error) { - return syscall.Flock(fd, how) -} - /* * Direct access */