3
0

missing_syscalls.c 777 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2012, Denys Vlasenko
  3. *
  4. * Licensed under GPLv2, see file LICENSE in this source tree.
  5. */
  6. //kbuild:lib-y += missing_syscalls.o
  7. #include "libbb.h"
  8. #if defined(ANDROID) || defined(__ANDROID__)
  9. /*# include <linux/timex.h> - for struct timex, but may collide with <time.h> */
  10. # include <sys/syscall.h>
  11. pid_t getsid(pid_t pid)
  12. {
  13. return syscall(__NR_getsid, pid);
  14. }
  15. int sethostname(const char *name, size_t len)
  16. {
  17. return syscall(__NR_sethostname, name, len);
  18. }
  19. struct timex;
  20. int adjtimex(struct timex *buf)
  21. {
  22. return syscall(__NR_adjtimex, buf);
  23. }
  24. int pivot_root(const char *new_root, const char *put_old)
  25. {
  26. return syscall(__NR_pivot_root, new_root, put_old);
  27. }
  28. # if __ANDROID_API__ < 21
  29. int tcdrain(int fd)
  30. {
  31. return ioctl(fd, TCSBRK, 1);
  32. }
  33. # endif
  34. #endif