From aebfd63cd93a5bef4e7eefb4c0199fbc4c43e2f2 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 13 Jul 2011 15:34:36 -0700 Subject: [PATCH] syscall: add Flock on Linux Fixes #2069. R=golang-dev, r CC=golang-dev https://golang.org/cl/4703048 --- src/pkg/syscall/syscall_linux.go | 2 +- src/pkg/syscall/zsyscall_linux_386.go | 8 ++++++++ src/pkg/syscall/zsyscall_linux_amd64.go | 8 ++++++++ src/pkg/syscall/zsyscall_linux_arm.go | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index 1d6fc76c79..9fc2605c4b 100644 --- a/src/pkg/syscall/syscall_linux.go +++ b/src/pkg/syscall/syscall_linux.go @@ -774,6 +774,7 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (errno int) //sys fcntl(fd int, cmd int, arg int) (val int, errno int) //sys Fdatasync(fd int) (errno int) +//sys Flock(fd int, how int) (errno int) //sys Fsync(fd int) (errno int) //sys Getdents(fd int, buf []byte) (n int, errno int) = SYS_GETDENTS64 //sysnb Getpgid(pid int) (pgid int, errno int) @@ -878,7 +879,6 @@ func Munmap(b []byte) (errno int) { // Fadvise64 // Fgetxattr // Flistxattr -// Flock // Fork // Fremovexattr // Fsetxattr diff --git a/src/pkg/syscall/zsyscall_linux_386.go b/src/pkg/syscall/zsyscall_linux_386.go index 8df29f1367..4eb522ad92 100644 --- a/src/pkg/syscall/zsyscall_linux_386.go +++ b/src/pkg/syscall/zsyscall_linux_386.go @@ -277,6 +277,14 @@ func Fdatasync(fd int) (errno int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Flock(fd int, how int) (errno int) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fsync(fd int) (errno int) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) errno = int(e1) diff --git a/src/pkg/syscall/zsyscall_linux_amd64.go b/src/pkg/syscall/zsyscall_linux_amd64.go index fa20ff57ab..999ed64a18 100644 --- a/src/pkg/syscall/zsyscall_linux_amd64.go +++ b/src/pkg/syscall/zsyscall_linux_amd64.go @@ -277,6 +277,14 @@ func Fdatasync(fd int) (errno int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Flock(fd int, how int) (errno int) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fsync(fd int) (errno int) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) errno = int(e1) diff --git a/src/pkg/syscall/zsyscall_linux_arm.go b/src/pkg/syscall/zsyscall_linux_arm.go index 560a65b12c..cd49dabed6 100644 --- a/src/pkg/syscall/zsyscall_linux_arm.go +++ b/src/pkg/syscall/zsyscall_linux_arm.go @@ -277,6 +277,14 @@ func Fdatasync(fd int) (errno int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Flock(fd int, how int) (errno int) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fsync(fd int) (errno int) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) errno = int(e1) -- 2.50.0