blob: 651f7df5f0ae193267539d9d5d933f8b1d8ae157
1 | /* vi: set sw=4 ts=4: */ |
2 | /* |
3 | Copyright 2010, Dylan Simon |
4 | |
5 | Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
6 | */ |
7 | |
8 | #ifndef BB_ANDROID_H |
9 | #define BB_ANDROID_H 1 |
10 | |
11 | /* for dirname, basename */ |
12 | #include <libgen.h> |
13 | |
14 | #if ENABLE_FEATURE_DC_LIBM |
15 | # include <math.h> |
16 | #endif |
17 | |
18 | /* lutimes doesnt exists in libc */ |
19 | #if ENABLE_FEATURE_TOUCH_NODEREF |
20 | # define lutimes utimes |
21 | #endif |
22 | |
23 | #define killpg_busybox(P, S) kill(-(P), S) |
24 | |
25 | #define setmntent fopen |
26 | #define endmntent fclose |
27 | |
28 | /* defined in bionic/utmp.c */ |
29 | void endutent(void); |
30 | |
31 | /* defined in bionic/mktemp.c */ |
32 | char *mkdtemp(char *); |
33 | char *bb_mktemp(char *); |
34 | |
35 | /* SYSCALLS */ |
36 | int stime(const time_t *); |
37 | int swapon(const char *, int); |
38 | int swapoff(const char *); |
39 | int getsid(pid_t); |
40 | |
41 | #ifndef SYS_ioprio_set |
42 | #define SYS_ioprio_set __NR_ioprio_set |
43 | #define SYS_ioprio_get __NR_ioprio_get |
44 | #endif |
45 | |
46 | /* XXX These need to be obtained from kernel headers. See b/9336527 */ |
47 | #define SWAP_FLAG_PREFER 0x8000 |
48 | #define SWAP_FLAG_PRIO_MASK 0x7fff |
49 | #define SWAP_FLAG_PRIO_SHIFT 0 |
50 | #define SWAP_FLAG_DISCARD 0x10000 |
51 | |
52 | /* local definition in libbb/xfuncs_printf.c */ |
53 | int fdprintf(int fd, const char *format, ...); |
54 | |
55 | /* local definitions in android/libc/pty.c */ |
56 | #include <fcntl.h> |
57 | #ifndef SPLICE_F_GIFT |
58 | /* if this constant is not defined, |
59 | ttyname is not in bionic */ |
60 | char* bb_ttyname(int); |
61 | int bb_ttyname_r(int, char *, size_t); |
62 | #define ttyname(n) bb_ttyname(n) |
63 | #define ttyname_r(n,s,z) bb_ttyname_r(n,s,z) |
64 | #else |
65 | /* should be available in android M ? */ |
66 | extern char* ttyname(int); |
67 | extern int ttyname_r(int, char *, size_t); |
68 | #endif |
69 | |
70 | /* local definitions in android/android.c */ |
71 | char *getusershell(void); |
72 | void setusershell(void); |
73 | void endusershell(void); |
74 | |
75 | struct mntent; |
76 | struct __sFILE; |
77 | int addmntent(struct __sFILE *, const struct mntent *); |
78 | struct mntent *getmntent_r(struct __sFILE *fp, struct mntent *mnt, char *buf, int buflen); |
79 | char *hasmntopt(const struct mntent *, const char *); |
80 | |
81 | #define MNTOPT_NOAUTO "noauto" |
82 | |
83 | /* bionic's vfork is rather broken; for now a terrible bandaid: */ |
84 | #define vfork fork |
85 | |
86 | #if !defined(BIONIC_L) && !defined(BLOATCHECK) |
87 | #define _SOCKLEN_T_DECLARED |
88 | typedef int socklen_t; |
89 | #endif |
90 | |
91 | /* wait3 was removed in android L */ |
92 | #ifdef BIONIC_L |
93 | #define wait3(status, options, rusage) wait4(-1, status, options, rusage) |
94 | #endif |
95 | |
96 | #endif |
97 |