diff options
author | David 'Digit' Turner <digit@google.com> | 2010-09-27 17:30:33 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2010-09-28 09:18:26 +0200 |
commit | 9973a564222b842eb7497fd6e659fe8c8c49e2b3 (patch) | |
tree | e1a716e1850f15d9245b82affa0b0e7688b0c782 | |
parent | a3ae60d343661784e3f6f4566b276d8e6b8a06a7 (diff) | |
download | bionic-9973a564222b842eb7497fd6e659fe8c8c49e2b3.zip bionic-9973a564222b842eb7497fd6e659fe8c8c49e2b3.tar.gz bionic-9973a564222b842eb7497fd6e659fe8c8c49e2b3.tar.bz2 |
libc: Add missing waitid() implementation.
Change-Id: I312ee608dbf9249e4886a10d45d13e3cda8a9042
-rw-r--r-- | libc/SYSCALLS.TXT | 2 | ||||
-rw-r--r-- | libc/arch-arm/syscalls.mk | 2 | ||||
-rw-r--r-- | libc/arch-arm/syscalls/__waitid.S (renamed from libc/arch-arm/syscalls/waitid.S) | 6 | ||||
-rw-r--r-- | libc/arch-sh/syscalls.mk | 2 | ||||
-rw-r--r-- | libc/arch-sh/syscalls/__waitid.S (renamed from libc/arch-sh/syscalls/waitid.S) | 6 | ||||
-rw-r--r-- | libc/arch-x86/syscalls.mk | 2 | ||||
-rw-r--r-- | libc/arch-x86/syscalls/__waitid.S (renamed from libc/arch-x86/syscalls/waitid.S) | 6 | ||||
-rw-r--r-- | libc/include/sys/linux-unistd.h | 2 | ||||
-rw-r--r-- | libc/include/sys/wait.h | 9 | ||||
-rw-r--r-- | libc/unistd/wait.c | 7 |
10 files changed, 30 insertions, 14 deletions
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index baac5d0..935639e 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -33,7 +33,7 @@ void _exit:exit_group (int) 248,252 void _exit_thread:exit (int) 1 pid_t __fork:fork (void) 2 pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7 -int waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284 +int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284 # NOTE: this system call is never called directly, but we list it there # to have __NR_clone properly defined. diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index f1d8fb1..c364d1c 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -3,7 +3,7 @@ syscall_src := syscall_src += arch-arm/syscalls/_exit.S syscall_src += arch-arm/syscalls/_exit_thread.S syscall_src += arch-arm/syscalls/__fork.S -syscall_src += arch-arm/syscalls/waitid.S +syscall_src += arch-arm/syscalls/__waitid.S syscall_src += arch-arm/syscalls/__sys_clone.S syscall_src += arch-arm/syscalls/execve.S syscall_src += arch-arm/syscalls/__setuid.S diff --git a/libc/arch-arm/syscalls/waitid.S b/libc/arch-arm/syscalls/__waitid.S index 4134e53..fdd0da3 100644 --- a/libc/arch-arm/syscalls/waitid.S +++ b/libc/arch-arm/syscalls/__waitid.S @@ -2,12 +2,12 @@ #include <sys/linux-syscalls.h> .text - .type waitid, #function - .globl waitid + .type __waitid, #function + .globl __waitid .align 4 .fnstart -waitid: +__waitid: mov ip, sp .save {r4, r5, r6, r7} stmfd sp!, {r4, r5, r6, r7} diff --git a/libc/arch-sh/syscalls.mk b/libc/arch-sh/syscalls.mk index 3e2274f..47b5a1e 100644 --- a/libc/arch-sh/syscalls.mk +++ b/libc/arch-sh/syscalls.mk @@ -4,7 +4,7 @@ syscall_src += arch-sh/syscalls/_exit.S syscall_src += arch-sh/syscalls/_exit_thread.S syscall_src += arch-sh/syscalls/__fork.S syscall_src += arch-sh/syscalls/_waitpid.S -syscall_src += arch-sh/syscalls/waitid.S +syscall_src += arch-sh/syscalls/__waitid.S syscall_src += arch-sh/syscalls/__sys_clone.S syscall_src += arch-sh/syscalls/execve.S syscall_src += arch-sh/syscalls/__setuid.S diff --git a/libc/arch-sh/syscalls/waitid.S b/libc/arch-sh/syscalls/__waitid.S index 1f0432d..1f58de0 100644 --- a/libc/arch-sh/syscalls/waitid.S +++ b/libc/arch-sh/syscalls/__waitid.S @@ -2,11 +2,11 @@ #include <sys/linux-syscalls.h> .text - .type waitid, @function - .globl waitid + .type __waitid, @function + .globl __waitid .align 4 -waitid: +__waitid: /* get ready for additonal arg */ mov.l @r15, r0 diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk index f0d7a31..133f286 100644 --- a/libc/arch-x86/syscalls.mk +++ b/libc/arch-x86/syscalls.mk @@ -4,7 +4,7 @@ syscall_src += arch-x86/syscalls/_exit.S syscall_src += arch-x86/syscalls/_exit_thread.S syscall_src += arch-x86/syscalls/__fork.S syscall_src += arch-x86/syscalls/_waitpid.S -syscall_src += arch-x86/syscalls/waitid.S +syscall_src += arch-x86/syscalls/__waitid.S syscall_src += arch-x86/syscalls/__sys_clone.S syscall_src += arch-x86/syscalls/execve.S syscall_src += arch-x86/syscalls/__setuid.S diff --git a/libc/arch-x86/syscalls/waitid.S b/libc/arch-x86/syscalls/__waitid.S index 9a5328b..4dd8c11 100644 --- a/libc/arch-x86/syscalls/waitid.S +++ b/libc/arch-x86/syscalls/__waitid.S @@ -2,11 +2,11 @@ #include <sys/linux-syscalls.h> .text - .type waitid, @function - .globl waitid + .type __waitid, @function + .globl __waitid .align 4 -waitid: +__waitid: pushl %ebx pushl %ecx pushl %edx diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h index 5e9c2f0..a1905b3 100644 --- a/libc/include/sys/linux-unistd.h +++ b/libc/include/sys/linux-unistd.h @@ -9,7 +9,7 @@ void _exit (int); void _exit_thread (int); pid_t __fork (void); pid_t _waitpid (pid_t, int*, int, struct rusage*); -int waitid (int, pid_t, struct siginfo_t*, int,void*); +int __waitid (int, pid_t, struct siginfo_t*, int,void*); pid_t __sys_clone (int, void*, int*, void*, int*); int execve (const char*, char* const*, char* const*); int __setuid (uid_t); diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h index 8ba1837..573e220 100644 --- a/libc/include/sys/wait.h +++ b/libc/include/sys/wait.h @@ -32,6 +32,7 @@ #include <sys/types.h> #include <sys/resource.h> #include <linux/wait.h> +#include <signal.h> __BEGIN_DECLS @@ -49,6 +50,14 @@ extern pid_t waitpid(pid_t, int *, int); extern pid_t wait3(int *, int, struct rusage *); extern pid_t wait4(pid_t, int *, int, struct rusage *); +/* Posix states that idtype_t should be an enumeration type, but + * the kernel headers define P_ALL, P_PID and P_PGID as constant macros + * instead. + */ +typedef int idtype_t; + +extern int waidit(idtype_t which, id_t id, siginfo_t *info, int options); + __END_DECLS #endif /* _SYS_WAIT_H_ */ diff --git a/libc/unistd/wait.c b/libc/unistd/wait.c index d172419..f1db086 100644 --- a/libc/unistd/wait.c +++ b/libc/unistd/wait.c @@ -29,6 +29,7 @@ #include <stddef.h> extern pid_t __wait4 (pid_t pid, int *status, int options, struct rusage *rusage); +extern int __waitid(idtype_t which, id_t id, siginfo_t *info, int options, struct rusage *ru); pid_t wait( int* status ) { @@ -44,3 +45,9 @@ pid_t waitpid(pid_t pid, int* status, int options) { return __wait4( pid, status, options, NULL ); } + +int waitid(idtype_t which, id_t id, siginfo_t *info, int options) +{ + /* the system call takes an option struct rusage that we don't need */ + return __waitid(which, id, info, options, NULL); +} |