__syscall_fcntl.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
  13. extern int __libc_fcntl64(int fd, int cmd, ...) attribute_hidden;
  14. #endif
  15. #define __NR___syscall_fcntl __NR_fcntl
  16. static inline
  17. _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
  18. int attribute_hidden __libc_fcntl(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 (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
  26. #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
  27. return __libc_fcntl64(fd, cmd, arg);
  28. #else
  29. __set_errno(ENOSYS);
  30. return -1;
  31. #endif
  32. }
  33. return (__syscall_fcntl(fd, cmd, arg));
  34. }
  35. strong_alias(__libc_fcntl, fcntl)
  36. #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
  37. strong_alias(__libc_fcntl, fcntl64)
  38. #endif