From bb5581ad6eec40041dab4e961149f7a8a3a83497 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Sat, 9 Oct 2010 17:56:55 +0200 Subject: [PATCH] libc: tag missing functions in system headers. This matches recent changes in the NDK header. We enclose missing functions in #if 0 .. #endif blocks with a clear "MISSING" in comments in order to locate them later. Change-Id: I87b3a62e777897e75c9243360fb0a82bcc53d9fb --- libc/include/getopt.h | 7 ++++++- libc/include/sched.h | 2 +- libc/include/signal.h | 1 + libc/include/stdio.h | 2 ++ libc/include/stdlib.h | 8 +++++++- libc/include/sys/fsuid.h | 2 ++ libc/include/sys/mount.h | 3 +++ libc/include/unistd.h | 21 ++++++++++++--------- 8 files changed, 34 insertions(+), 12 deletions(-) diff --git a/libc/include/getopt.h b/libc/include/getopt.h index 6b4954b50..56f198382 100644 --- a/libc/include/getopt.h +++ b/libc/include/getopt.h @@ -71,14 +71,19 @@ int getopt_long_only(int, char * const *, const char *, #ifndef _GETOPT_DEFINED_ #define _GETOPT_DEFINED_ int getopt(int, char * const *, const char *); -int getsubopt(char **, char * const *, char **); + extern char *optarg; /* getopt(3) external variables */ extern int opterr; extern int optind; extern int optopt; extern int optreset; + +#if 0 /* MISSING FROM BIONIC */ +int getsubopt(char **, char * const *, char **); extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* MISSING */ + #endif __END_DECLS diff --git a/libc/include/sched.h b/libc/include/sched.h index 33b9ad684..e70247005 100644 --- a/libc/include/sched.h +++ b/libc/include/sched.h @@ -69,7 +69,7 @@ extern int sched_rr_get_interval(pid_t pid, struct timespec *tp); #define CLONE_CHILD_SETTID 0x01000000 #define CLONE_STOPPED 0x02000000 -#ifdef __GNU_SOURCE +#ifdef _GNU_SOURCE extern int clone(int (*fn)(void *), void *child_stack, int flags, void* arg, ...); #endif diff --git a/libc/include/signal.h b/libc/include/signal.h index 7bc3145b7..440116443 100644 --- a/libc/include/signal.h +++ b/libc/include/signal.h @@ -120,6 +120,7 @@ extern int siginterrupt(int sig, int flag); extern int raise(int); extern int kill(pid_t, int); extern int killpg(int pgrp, int sig); +extern int sigaltstack(const stack_t *ss, stack_t *oss); __END_DECLS diff --git a/libc/include/stdio.h b/libc/include/stdio.h index d164e959b..c38ed5a51 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -300,8 +300,10 @@ __END_DECLS #define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ __BEGIN_DECLS +#if 0 /* MISSING FROM BIONIC */ char *ctermid(char *); char *cuserid(char *); +#endif /* MISSING */ FILE *fdopen(int, const char *); int fileno(FILE *); diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index f88915928..97d8e4650 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -50,7 +50,6 @@ __BEGIN_DECLS extern __noreturn void exit(int); extern __noreturn void abort(void); extern int atexit(void (*)(void)); -extern int on_exit(void (*)(int, void *), void *); extern char *getenv(const char *); extern int putenv(const char *); @@ -164,6 +163,7 @@ typedef struct { extern lldiv_t lldiv(long long, long long); +#if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */ /* make STLPort happy */ extern int mblen(const char *, size_t); extern size_t mbstowcs(wchar_t *, const char *, size_t); @@ -172,8 +172,14 @@ extern int mbtowc(wchar_t *, const char *, size_t); /* Likewise, make libstdc++-v3 happy. */ extern int wctomb(char *, wchar_t); extern size_t wcstombs(char *, const wchar_t *, size_t); +#endif /* MISSING */ + #define MB_CUR_MAX 1 +#if 0 /* MISSING FROM BIONIC */ +extern int on_exit(void (*)(int, void *), void *); +#endif /* MISSING */ + __END_DECLS #endif /* _STDLIB_H_ */ diff --git a/libc/include/sys/fsuid.h b/libc/include/sys/fsuid.h index 3257bc0be..bc47e3d95 100644 --- a/libc/include/sys/fsuid.h +++ b/libc/include/sys/fsuid.h @@ -33,8 +33,10 @@ __BEGIN_DECLS +#if 0 /* MISSING FROM BIONIC */ extern int setfsuid(uid_t); extern int setfsgid(gid_t); +#endif /* MISSING */ __END_DECLS diff --git a/libc/include/sys/mount.h b/libc/include/sys/mount.h index 62c4ee284..ba8844752 100644 --- a/libc/include/sys/mount.h +++ b/libc/include/sys/mount.h @@ -92,7 +92,10 @@ extern int mount(const char *, const char *, const void *); extern int umount(const char *); extern int umount2(const char *, int); + +#if 0 /* MISSING FROM BIONIC */ extern int pivot_root(const char *, const char *); +#endif /* MISSING */ __END_DECLS diff --git a/libc/include/unistd.h b/libc/include/unistd.h index cd09e3d24..29154a213 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -61,16 +61,13 @@ extern pid_t getppid(void); extern pid_t getpgrp(void); extern int setpgrp(void); extern pid_t setsid(void); -extern pid_t getsid(pid_t); extern int execv(const char *, char * const *); extern int execvp(const char *, char * const *); extern int execve(const char *, char * const *, char * const *); -extern int execvpe(const char *, char * const *, char * const *); extern int execl(const char *, const char *, ...); extern int execlp(const char *, const char *, ...); extern int execle(const char *, const char *, ...); -extern int execlpe(const char *, const char *, ...); extern int capget(cap_user_header_t hdrp, cap_user_data_t datap); extern int capset(cap_user_header_t hdrp, const cap_user_data_t datap); extern int prctl(int option, unsigned long arg2, unsigned long arg3, @@ -94,11 +91,8 @@ extern int setresuid(uid_t, uid_t, uid_t); extern int setresgid(gid_t, gid_t, gid_t); extern int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); extern int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); -extern int getfsuid(uid_t); -extern int setfsuid(uid_t); extern int issetugid(void); extern char* getlogin(void); -extern int getlogin_r(char* name, size_t namesize); extern char* getusershell(void); extern void setusershell(void); extern void endusershell(void); @@ -156,9 +150,6 @@ extern unsigned int sleep(unsigned int); extern int usleep(unsigned long); extern int gethostname(char *, size_t); -extern int sethostname(const char *, size_t); -extern int getdomainname(char *, size_t); -extern int setdomainname(const char *, size_t); extern int getdtablesize(void); @@ -195,6 +186,18 @@ extern int cacheflush(long start, long end, long flags); extern pid_t tcgetpgrp(int fd); extern int tcsetpgrp(int fd, pid_t _pid); +#if 0 /* MISSING FROM BIONIC */ +extern pid_t getsid(pid_t); +extern int execvpe(const char *, char * const *, char * const *); +extern int execlpe(const char *, const char *, ...); +extern int getfsuid(uid_t); +extern int setfsuid(uid_t); +extern int getlogin_r(char* name, size_t namesize); +extern int sethostname(const char *, size_t); +extern int getdomainname(char *, size_t); +extern int setdomainname(const char *, size_t); +#endif /* MISSING */ + /* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({ \ typeof (exp) _rc; \