__syscall_fcntl64.c 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * __syscall_fcntl64() 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 <_lfs_64.h>
  10. #include <sys/syscall.h>
  11. #include <bits/wordsize.h>
  12. #if defined __NR_fcntl64 && __WORDSIZE == 32
  13. # include <stdarg.h>
  14. # include <cancel.h>
  15. # include <fcntl.h>
  16. # define __NR___fcntl64_nocancel __NR_fcntl64
  17. _syscall3(int, __NC(fcntl64), int, fd, int, cmd, long, arg)
  18. int fcntl64(int fd, int cmd, ...)
  19. {
  20. long arg;
  21. va_list list;
  22. # ifdef __NEW_THREADS
  23. int oldtype, result;
  24. # endif
  25. va_start(list, cmd);
  26. arg = va_arg(list, long);
  27. va_end(list);
  28. if (SINGLE_THREAD_P || (cmd != F_SETLKW64))
  29. return __NC(fcntl64)(fd, cmd, arg);
  30. # ifdef __NEW_THREADS
  31. oldtype = LIBC_CANCEL_ASYNC();
  32. result = __NC(fcntl64)(fd, cmd, arg);
  33. LIBC_CANCEL_RESET(oldtype);
  34. return result;
  35. # endif
  36. }
  37. lt_strong_alias(fcntl64)
  38. lt_libc_hidden(fcntl64)
  39. #endif