__syscall_fcntl.c 1.3 KB

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