]> Cypherpunks.ru repositories - gostls13.git/blob - src/syscall/flock_linux.go
syscall: provide and use fcntlPtr for all BSD platforms
[gostls13.git] / src / syscall / flock_linux.go
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package syscall
6
7 import "unsafe"
8
9 // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
10 // systems by flock_linux_32bit.go to be SYS_FCNTL64.
11 var fcntl64Syscall uintptr = SYS_FCNTL
12
13 // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
14 func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
15         _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
16         if errno == 0 {
17                 return nil
18         }
19         return errno
20 }