__syscall_fcntl.c 830 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * __syscall_fcntl() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <stdarg.h>
  11. #include <fcntl.h>
  12. #define __NR___syscall_fcntl __NR_fcntl
  13. #ifdef __UCLIBC_HAS_LFS__
  14. static inline
  15. #endif
  16. _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
  17. int __libc_fcntl(int fd, int cmd, ...)
  18. {
  19. long arg;
  20. va_list list;
  21. if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {
  22. __set_errno(ENOSYS);
  23. return -1;
  24. }
  25. va_start(list, cmd);
  26. arg = va_arg(list, long);
  27. va_end(list);
  28. return (__syscall_fcntl(fd, cmd, arg));
  29. }
  30. weak_alias(__libc_fcntl, fcntl);
  31. #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
  32. weak_alias(__libc_fcntl, fcntl64);
  33. #endif