public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo: remove AIX flock emulation
@ 2018-12-05  1:11 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2018-12-05  1:11 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

This patch by Tobias Klauser removes the somewhat incorrect AIX flock
emulation from the syscall package.  This is based on the discussion
at https://golang.org/issue/29084.  Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1473 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 266781)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-7259d9a403db2784c7d03239c6a50e730062fc61
+d3a98b7a9ea8032be22ebb3ea2f389ce22669d53
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/syscall/libcall_aix.go
===================================================================
--- libgo/go/syscall/libcall_aix.go	(revision 266510)
+++ libgo/go/syscall/libcall_aix.go	(working copy)
@@ -111,28 +111,6 @@ func Reboot(how int) (err error) {
 //sys	Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
 //fchownat(dirfd _C_int, path *byte, owner Uid_t, group Gid_t, flags _C_int) _C_int
 
-// On AIX, there is no flock() system call, we emulate it.
-func Flock(fd int, op int) (err error) {
-	lk := &Flock_t{}
-	if (op & LOCK_UN) != 0 {
-		lk.Type = F_UNLCK
-	} else if (op & LOCK_EX) != 0 {
-		lk.Type = F_WRLCK
-	} else if (op & LOCK_SH) != 0 {
-		lk.Type = F_RDLCK
-	} else {
-		return nil
-	}
-	if (op & LOCK_NB) != 0 {
-		err = FcntlFlock(uintptr(fd), F_SETLK, lk)
-		if err != nil && (err == EAGAIN || err == EACCES) {
-			return EWOULDBLOCK
-		}
-		return err
-	}
-	return FcntlFlock(uintptr(fd), F_SETLKW, lk)
-}
-
 //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
 //fstatfs64(fd _C_int, buf *Statfs_t) _C_int
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-05  1:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05  1:11 libgo: remove AIX flock emulation Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).