Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 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 | |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 18 | /* lutimes doesnt exists in libc */ |
| 19 | #if ENABLE_FEATURE_TOUCH_NODEREF |
| 20 | # define lutimes utimes |
| 21 | #endif |
| 22 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 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 *); |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 33 | char *bb_mktemp(char *); |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 34 | |
Tanguy Pruvot | 301d311 | 2012-07-14 01:49:18 +0200 | [diff] [blame] | 35 | /* SYSCALLS */ |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 36 | int stime(const time_t *); |
Tanguy Pruvot | 6fef6a3 | 2012-05-05 15:26:43 +0200 | [diff] [blame] | 37 | int swapon(const char *, int); |
| 38 | int swapoff(const char *); |
| 39 | int getsid(pid_t); |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 40 | |
Tanguy Pruvot | 301d311 | 2012-07-14 01:49:18 +0200 | [diff] [blame] | 41 | #ifndef SYS_ioprio_set |
| 42 | #define SYS_ioprio_set __NR_ioprio_set |
| 43 | #define SYS_ioprio_get __NR_ioprio_get |
| 44 | #endif |
| 45 | |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 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 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 52 | /* local definition in libbb/xfuncs_printf.c */ |
| 53 | int fdprintf(int fd, const char *format, ...); |
| 54 | |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 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 |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 69 | |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 70 | /* local definitions in android/android.c */ |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 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); |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 79 | char *hasmntopt(const struct mntent *, const char *); |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 80 | |
| 81 | #define MNTOPT_NOAUTO "noauto" |
| 82 | |
| 83 | /* bionic's vfork is rather broken; for now a terrible bandaid: */ |
| 84 | #define vfork fork |
| 85 | |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 86 | #if !defined(BIONIC_L) && !defined(BLOATCHECK) |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 87 | #define _SOCKLEN_T_DECLARED |
| 88 | typedef int socklen_t; |
maxwen | 27116ba | 2015-08-14 21:41:28 +0200 | [diff] [blame] | 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 |
Tanguy Pruvot | 8a6c2c2 | 2012-04-28 00:24:09 +0200 | [diff] [blame] | 95 | |
Tanguy Pruvot | 8aeb371 | 2011-06-30 08:59:26 +0200 | [diff] [blame] | 96 | #endif |