fcntl_darwin.go 806 B

123456789101112131415161718192021222324
  1. // Copyright 2019 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. package unix
  5. import "unsafe"
  6. // FcntlInt performs a fcntl syscall on fd with the provided command and argument.
  7. func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
  8. return fcntl(int(fd), cmd, arg)
  9. }
  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. _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
  13. return err
  14. }
  15. // FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command.
  16. func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error {
  17. _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore))))
  18. return err
  19. }