ioctl.c 900 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * ioctl() 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 <sys/ioctl.h>
  12. #include <cancel.h>
  13. #define __NR___syscall_ioctl __NR_ioctl
  14. static __always_inline
  15. _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg)
  16. int ioctl(int fd, unsigned long int request, ...)
  17. {
  18. void *arg;
  19. va_list list;
  20. #ifdef __NEW_THREADS
  21. int oldtype, result;
  22. #endif
  23. va_start(list, request);
  24. arg = va_arg(list, void *);
  25. va_end(list);
  26. if (SINGLE_THREAD_P)
  27. return __syscall_ioctl(fd, request, arg);
  28. #ifdef __NEW_THREADS
  29. oldtype = LIBC_CANCEL_ASYNC ();
  30. result = __syscall_ioctl(fd, request, arg);
  31. LIBC_CANCEL_RESET (oldtype);
  32. return result;
  33. #endif
  34. }
  35. lt_strong_alias(ioctl)
  36. lt_libc_hidden(ioctl)