ioctl.c 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. va_start(list, request);
  21. arg = va_arg(list, void *);
  22. va_end(list);
  23. if (SINGLE_THREAD_P)
  24. return __syscall_ioctl(fd, request, arg);
  25. #ifdef __NEW_THREADS
  26. int oldtype = LIBC_CANCEL_ASYNC ();
  27. int result = __syscall_ioctl(fd, request, arg);
  28. LIBC_CANCEL_RESET (oldtype);
  29. return result;
  30. #endif
  31. }
  32. lt_strong_alias(ioctl)
  33. lt_libc_hidden(ioctl)