3
0

missing_syscalls.c 895 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 <linux/timex.h> - for struct timex, but may collide with <time.h> */
  8. #include <sys/syscall.h>
  9. #include "libbb.h"
  10. #if defined(ANDROID) || defined(__ANDROID__)
  11. pid_t getsid(pid_t pid)
  12. {
  13. return syscall(__NR_getsid, pid);
  14. }
  15. int stime(const time_t *t)
  16. {
  17. struct timeval tv;
  18. tv.tv_sec = *t;
  19. tv.tv_usec = 0;
  20. return settimeofday(&tv, NULL);
  21. }
  22. int sethostname(const char *name, size_t len)
  23. {
  24. return syscall(__NR_sethostname, name, len);
  25. }
  26. struct timex;
  27. int adjtimex(struct timex *buf)
  28. {
  29. return syscall(__NR_adjtimex, buf);
  30. }
  31. int pivot_root(const char *new_root, const char *put_old)
  32. {
  33. return syscall(__NR_pivot_root, new_root, put_old);
  34. }
  35. # if __ANDROID_API__ < 21
  36. int tcdrain(int fd)
  37. {
  38. return ioctl(fd, TCSBRK, 1);
  39. }
  40. # endif
  41. #endif