You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
695 B

  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. // +build darwin dragonfly freebsd linux netbsd openbsd
  5. package unix
  6. import "unsafe"
  7. // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
  8. // systems by flock_linux_32bit.go to be SYS_FCNTL64.
  9. var fcntl64Syscall uintptr = SYS_FCNTL
  10. // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
  11. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
  12. _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
  13. if errno == 0 {
  14. return nil
  15. }
  16. return errno
  17. }