missing_syscalls.c 861 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. int tcdrain(int fd)
  36. {
  37. return ioctl(fd, TCSBRK, 1);
  38. }
  39. #endif