__syscall_fcntl.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef __LINUXTHREADS_OLD__
  36. libc_hidden_def(fcntl)
  37. #else
  38. libc_hidden_weak(fcntl)
  39. strong_alias(fcntl,__libc_fcntl)
  40. #endif
  41. #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
  42. strong_alias(fcntl,fcntl64)
  43. #endif