__syscall_fcntl.c 1.1 KB

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