ioctl.c 875 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * ioctl() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <stdarg.h>
  10. #include <sys/ioctl.h>
  11. #include <cancel.h>
  12. #define __NR___syscall_ioctl __NR_ioctl
  13. static __always_inline
  14. _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg)
  15. int ioctl(int fd, unsigned long int request, ...)
  16. {
  17. void *arg;
  18. va_list list;
  19. #ifdef __NEW_THREADS
  20. int oldtype, result;
  21. #endif
  22. va_start(list, request);
  23. arg = va_arg(list, void *);
  24. va_end(list);
  25. if (SINGLE_THREAD_P)
  26. return __syscall_ioctl(fd, request, arg);
  27. #ifdef __NEW_THREADS
  28. oldtype = LIBC_CANCEL_ASYNC ();
  29. result = __syscall_ioctl(fd, request, arg);
  30. LIBC_CANCEL_RESET (oldtype);
  31. return result;
  32. #endif
  33. }
  34. lt_strong_alias(ioctl)
  35. lt_libc_hidden(ioctl)