__syscall_fcntl64.c 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. va_start(list, cmd);
  23. arg = va_arg(list, long);
  24. va_end(list);
  25. if (SINGLE_THREAD_P || (cmd != F_SETLKW64))
  26. return __NC(fcntl64)(fd, cmd, arg);
  27. # ifdef __NEW_THREADS
  28. int oldtype = LIBC_CANCEL_ASYNC();
  29. int result = __NC(fcntl64)(fd, cmd, arg);
  30. LIBC_CANCEL_RESET(oldtype);
  31. return result;
  32. # endif
  33. }
  34. lt_strong_alias(fcntl64)
  35. lt_libc_hidden(fcntl64)
  36. #endif