From 17a8b0db63d54e9d79bf11112ace0c4fe9606289 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 21 Mar 2013 15:43:53 -0700 Subject: [PATCH] Expose wait4 as wait4 rather than __wait4. This helps strace(1) compile with one fewer hack. Change-Id: I5296d0cfec5546709cda990abd705ad33d7c4626 --- libc/Android.mk | 2 +- libc/SYSCALLS.TXT | 2 +- libc/arch-arm/syscalls.mk | 2 +- libc/arch-arm/syscalls/{__wait4.S => wait4.S} | 4 +-- libc/arch-mips/syscalls.mk | 2 +- .../arch-mips/syscalls/{__wait4.S => wait4.S} | 8 ++--- libc/arch-x86/syscalls.mk | 2 +- libc/arch-x86/syscalls/{__wait4.S => wait4.S} | 4 +-- libc/bionic/{wait.c => wait.cpp} | 31 ++++++++++--------- 9 files changed, 29 insertions(+), 28 deletions(-) rename libc/arch-arm/syscalls/{__wait4.S => wait4.S} (91%) rename libc/arch-mips/syscalls/{__wait4.S => wait4.S} (81%) rename libc/arch-x86/syscalls/{__wait4.S => wait4.S} (95%) rename libc/bionic/{wait.c => wait.cpp} (65%) diff --git a/libc/Android.mk b/libc/Android.mk index b4613bae3..9064907cc 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -203,7 +203,6 @@ libc_common_src_files := \ bionic/unlockpt.c \ bionic/usleep.c \ bionic/utmp.c \ - bionic/wait.c \ bionic/wcscoll.c \ netbsd/gethnamaddr.c \ netbsd/inet/nsap_addr.c \ @@ -285,6 +284,7 @@ libc_bionic_src_files := \ bionic/__umask_chk.cpp \ bionic/__vsnprintf_chk.cpp \ bionic/__vsprintf_chk.cpp \ + bionic/wait.cpp \ bionic/wchar.cpp \ libc_upstream_freebsd_src_files := \ diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index 2a2561864..ff4874e25 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -37,6 +37,7 @@ void _exit_thread:exit (int) 1 pid_t __fork:fork (void) 2 pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7,7 int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284,278 +pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) 114 # NOTE: this system call is never called directly, but we list it there # to have __NR_clone properly defined. @@ -283,7 +284,6 @@ int ioprio_get(int which, int who) 315,290,315 # other int uname(struct utsname *) 122 -pid_t __wait4:wait4(pid_t pid, int *status, int options, struct rusage *rusage) 114 mode_t umask(mode_t) 60 int __reboot:reboot(int, int, int, void *) 88 int __syslog:syslog(int, char *, int) 103 diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index 5cb46b5e7..9eb51369e 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -4,6 +4,7 @@ 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/wait4.S syscall_src += arch-arm/syscalls/__sys_clone.S syscall_src += arch-arm/syscalls/execve.S syscall_src += arch-arm/syscalls/__setuid.S @@ -180,7 +181,6 @@ syscall_src += arch-arm/syscalls/__getcpu.S syscall_src += arch-arm/syscalls/ioprio_set.S syscall_src += arch-arm/syscalls/ioprio_get.S syscall_src += arch-arm/syscalls/uname.S -syscall_src += arch-arm/syscalls/__wait4.S syscall_src += arch-arm/syscalls/umask.S syscall_src += arch-arm/syscalls/__reboot.S syscall_src += arch-arm/syscalls/__syslog.S diff --git a/libc/arch-arm/syscalls/__wait4.S b/libc/arch-arm/syscalls/wait4.S similarity index 91% rename from libc/arch-arm/syscalls/__wait4.S rename to libc/arch-arm/syscalls/wait4.S index ac5904535..7011099d9 100644 --- a/libc/arch-arm/syscalls/__wait4.S +++ b/libc/arch-arm/syscalls/wait4.S @@ -3,7 +3,7 @@ #include #include -ENTRY(__wait4) +ENTRY(wait4) mov ip, r7 ldr r7, =__NR_wait4 swi #0 @@ -12,4 +12,4 @@ ENTRY(__wait4) bxls lr neg r0, r0 b __set_errno -END(__wait4) +END(wait4) diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk index 7e40c2eea..0b8eccd28 100644 --- a/libc/arch-mips/syscalls.mk +++ b/libc/arch-mips/syscalls.mk @@ -5,6 +5,7 @@ syscall_src += arch-mips/syscalls/_exit_thread.S syscall_src += arch-mips/syscalls/__fork.S syscall_src += arch-mips/syscalls/_waitpid.S syscall_src += arch-mips/syscalls/__waitid.S +syscall_src += arch-mips/syscalls/wait4.S syscall_src += arch-mips/syscalls/__sys_clone.S syscall_src += arch-mips/syscalls/execve.S syscall_src += arch-mips/syscalls/__setuid.S @@ -183,7 +184,6 @@ syscall_src += arch-mips/syscalls/__getcpu.S syscall_src += arch-mips/syscalls/ioprio_set.S syscall_src += arch-mips/syscalls/ioprio_get.S syscall_src += arch-mips/syscalls/uname.S -syscall_src += arch-mips/syscalls/__wait4.S syscall_src += arch-mips/syscalls/umask.S syscall_src += arch-mips/syscalls/__reboot.S syscall_src += arch-mips/syscalls/__syslog.S diff --git a/libc/arch-mips/syscalls/__wait4.S b/libc/arch-mips/syscalls/wait4.S similarity index 81% rename from libc/arch-mips/syscalls/__wait4.S rename to libc/arch-mips/syscalls/wait4.S index 713b7cb49..8e3d2dc55 100644 --- a/libc/arch-mips/syscalls/__wait4.S +++ b/libc/arch-mips/syscalls/wait4.S @@ -1,11 +1,11 @@ /* autogenerated by gensyscalls.py */ #include .text - .globl __wait4 + .globl wait4 .align 4 - .ent __wait4 + .ent wait4 -__wait4: +wait4: .set noreorder .cpload $t9 li $v0, __NR_wait4 @@ -19,4 +19,4 @@ __wait4: j $t9 nop .set reorder - .end __wait4 + .end wait4 diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk index e196c022b..b4ad564ed 100644 --- a/libc/arch-x86/syscalls.mk +++ b/libc/arch-x86/syscalls.mk @@ -5,6 +5,7 @@ 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/wait4.S syscall_src += arch-x86/syscalls/__sys_clone.S syscall_src += arch-x86/syscalls/execve.S syscall_src += arch-x86/syscalls/__setuid.S @@ -184,7 +185,6 @@ syscall_src += arch-x86/syscalls/__getcpu.S syscall_src += arch-x86/syscalls/ioprio_set.S syscall_src += arch-x86/syscalls/ioprio_get.S syscall_src += arch-x86/syscalls/uname.S -syscall_src += arch-x86/syscalls/__wait4.S syscall_src += arch-x86/syscalls/umask.S syscall_src += arch-x86/syscalls/__reboot.S syscall_src += arch-x86/syscalls/__syslog.S diff --git a/libc/arch-x86/syscalls/__wait4.S b/libc/arch-x86/syscalls/wait4.S similarity index 95% rename from libc/arch-x86/syscalls/__wait4.S rename to libc/arch-x86/syscalls/wait4.S index 57de4d9f7..e3bad3ee6 100644 --- a/libc/arch-x86/syscalls/__wait4.S +++ b/libc/arch-x86/syscalls/wait4.S @@ -3,7 +3,7 @@ #include #include -ENTRY(__wait4) +ENTRY(wait4) pushl %ebx pushl %ecx pushl %edx @@ -27,4 +27,4 @@ ENTRY(__wait4) popl %ecx popl %ebx ret -END(__wait4) +END(wait4) diff --git a/libc/bionic/wait.c b/libc/bionic/wait.cpp similarity index 65% rename from libc/bionic/wait.c rename to libc/bionic/wait.cpp index f1db086db..7dbcec29a 100644 --- a/libc/bionic/wait.c +++ b/libc/bionic/wait.cpp @@ -25,29 +25,30 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + #include #include -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); +extern "C" int __waitid(idtype_t which, id_t id, siginfo_t* info, int options, struct rusage* ru); -pid_t wait( int* status ) -{ - return __wait4( (pid_t)-1, status, 0, NULL ); +pid_t wait(int* status) { + return wait4(-1, status, 0, NULL); } -pid_t wait3(int* status, int options, struct rusage* rusage) -{ - return __wait4( (pid_t)-1, status, options, rusage ); +pid_t wait3(int* status, int options, struct rusage* rusage) { + return wait4(-1, status, options, rusage); } -pid_t waitpid(pid_t pid, int* status, int options) -{ - return __wait4( pid, status, options, NULL ); +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); +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); +} + +// TODO: remove this backward compatibility hack (for jb-mr1 strace binaries). +extern "C" pid_t __wait4(pid_t pid, int* status, int options, struct rusage* rusage) { + return wait4(pid, status, options, rusage); }