__syscall_fcntl64.c 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * __syscall_fcntl64() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <_lfs_64.h>
  9. #include <sys/syscall.h>
  10. #include <bits/wordsize.h>
  11. #if defined __NR_fcntl64 && __WORDSIZE == 32
  12. # include <stdarg.h>
  13. # include <cancel.h>
  14. # include <fcntl.h>
  15. # define __NR___fcntl64_nocancel __NR_fcntl64
  16. _syscall3(int, __NC(fcntl64), int, fd, int, cmd, long, arg)
  17. int fcntl64(int fd, int cmd, ...)
  18. {
  19. long arg;
  20. va_list list;
  21. # ifdef __NEW_THREADS
  22. int oldtype, result;
  23. # endif
  24. va_start(list, cmd);
  25. arg = va_arg(list, long);
  26. va_end(list);
  27. if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
  28. return __NC(fcntl64)(fd, cmd, arg);
  29. # ifdef __NEW_THREADS
  30. oldtype = LIBC_CANCEL_ASYNC();
  31. result = __NC(fcntl64)(fd, cmd, arg);
  32. LIBC_CANCEL_RESET(oldtype);
  33. return result;
  34. # endif
  35. }
  36. lt_strong_alias(fcntl64)
  37. lt_libc_hidden(fcntl64)
  38. #endif