__syscall_fcntl.c 946 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * __syscall_fcntl() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <stdarg.h>
  11. #include <fcntl.h>
  12. #include <bits/wordsize.h>
  13. #define __NR___syscall_fcntl __NR_fcntl
  14. static __always_inline
  15. _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg)
  16. int fcntl(int fd, int cmd, ...)
  17. {
  18. long arg;
  19. va_list list;
  20. va_start(list, cmd);
  21. arg = va_arg(list, long);
  22. va_end(list);
  23. #if __WORDSIZE == 32
  24. if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
  25. #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
  26. return fcntl64(fd, cmd, arg);
  27. #else
  28. __set_errno(ENOSYS);
  29. return -1;
  30. #endif
  31. }
  32. #endif
  33. return (__syscall_fcntl(fd, cmd, arg));
  34. }
  35. libc_hidden_def(fcntl)
  36. #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
  37. strong_alias(fcntl,fcntl64)
  38. #endif