Tias Guns | c9677ed | 2012-06-10 14:40:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012, Denys Vlasenko |
| 3 | * |
| 4 | * Licensed under GPLv2, see file LICENSE in this source tree. |
| 5 | */ |
Tias Guns | c9677ed | 2012-06-10 14:40:30 +0200 | [diff] [blame] | 6 | //kbuild:lib-y += missing_syscalls.o |
| 7 | |
Tias Guns | c9677ed | 2012-06-10 14:40:30 +0200 | [diff] [blame] | 8 | #include "libbb.h" |
| 9 | |
| 10 | #if defined(ANDROID) || defined(__ANDROID__) |
Sean MacLennan | d9aabfe | 2018-03-04 23:15:59 +0100 | [diff] [blame] | 11 | /*# include <linux/timex.h> - for struct timex, but may collide with <time.h> */ |
| 12 | # include <sys/syscall.h> |
Tias Guns | c9677ed | 2012-06-10 14:40:30 +0200 | [diff] [blame] | 13 | pid_t getsid(pid_t pid) |
| 14 | { |
| 15 | return syscall(__NR_getsid, pid); |
| 16 | } |
| 17 | |
| 18 | int stime(const time_t *t) |
| 19 | { |
| 20 | struct timeval tv; |
| 21 | tv.tv_sec = *t; |
| 22 | tv.tv_usec = 0; |
| 23 | return settimeofday(&tv, NULL); |
| 24 | } |
| 25 | |
| 26 | int sethostname(const char *name, size_t len) |
| 27 | { |
| 28 | return syscall(__NR_sethostname, name, len); |
| 29 | } |
| 30 | |
| 31 | struct timex; |
| 32 | int adjtimex(struct timex *buf) |
| 33 | { |
| 34 | return syscall(__NR_adjtimex, buf); |
| 35 | } |
| 36 | |
| 37 | int pivot_root(const char *new_root, const char *put_old) |
| 38 | { |
| 39 | return syscall(__NR_pivot_root, new_root, put_old); |
| 40 | } |
Matt Whitlock | 93b98ff | 2015-04-26 13:14:50 +0200 | [diff] [blame] | 41 | |
Chris Renshaw | 6df9612 | 2015-12-17 16:42:01 +0100 | [diff] [blame] | 42 | # if __ANDROID_API__ < 21 |
Matt Whitlock | 93b98ff | 2015-04-26 13:14:50 +0200 | [diff] [blame] | 43 | int tcdrain(int fd) |
| 44 | { |
| 45 | return ioctl(fd, TCSBRK, 1); |
| 46 | } |
Chris Renshaw | 6df9612 | 2015-12-17 16:42:01 +0100 | [diff] [blame] | 47 | # endif |
Tias Guns | c9677ed | 2012-06-10 14:40:30 +0200 | [diff] [blame] | 48 | #endif |