diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/Android.mk | 1 | ||||
-rw-r--r-- | libc/SYSCALLS.TXT | 9 | ||||
-rw-r--r-- | libc/arch-arm/syscalls.mk | 4 | ||||
-rw-r--r-- | libc/arch-arm/syscalls/__rt_sigpending.S (renamed from libc/arch-arm/syscalls/sigpending.S) | 6 | ||||
-rw-r--r-- | libc/arch-mips/syscalls.mk | 6 | ||||
-rw-r--r-- | libc/arch-mips/syscalls/__rt_sigpending.S (renamed from libc/arch-mips/syscalls/sigpending.S) | 10 | ||||
-rw-r--r-- | libc/arch-x86/syscalls.mk | 6 | ||||
-rw-r--r-- | libc/arch-x86/syscalls/__rt_sigpending.S (renamed from libc/arch-x86/syscalls/sigpending.S) | 11 | ||||
-rw-r--r-- | libc/arch-x86_64/syscalls.mk | 3 | ||||
-rw-r--r-- | libc/arch-x86_64/syscalls/__rt_sigpending.S | 17 | ||||
-rw-r--r-- | libc/bionic/sigpending.cpp | 42 | ||||
-rw-r--r-- | libc/include/signal.h | 24 |
12 files changed, 99 insertions, 40 deletions
diff --git a/libc/Android.mk b/libc/Android.mk index 88be78d..417d0ab 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -246,6 +246,7 @@ libc_bionic_src_files := \ bionic/seteuid.cpp \ bionic/setlocale.cpp \ bionic/signalfd.cpp \ + bionic/sigpending.cpp \ bionic/sigprocmask.cpp \ bionic/sigsuspend.cpp \ bionic/sigwait.cpp \ diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index 1d6c75f..f5712e1 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -28,13 +28,12 @@ void _exit:exit_group(int) all void _exit_thread:exit(int) all pid_t __fork:fork(void) all -pid_t _waitpid:waitpid(pid_t, int*, int, struct rusage*) mips,x86 -int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all pid_t wait4(pid_t pid, int* status, int options, struct rusage* rusage) all -# NOTE: this system call is never called directly, but we list it there -# to have __NR_clone properly defined. +# NOTE: these stubs are unused. pid_t __sys_clone:clone(int, void*, int*, void*, int*) all +pid_t _waitpid:waitpid(pid_t, int*, int, struct rusage*) mips,x86 +int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all int execve(const char*, char* const*, char* const*) all @@ -226,8 +225,8 @@ int timerfd_gettime(int, struct itimerspec*) all # signals int sigaction(int, const struct sigaction*, struct sigaction*) arm,x86,mips -int sigpending(sigset_t*) arm,x86,mips int __rt_sigaction:rt_sigaction(int, const struct sigaction*, struct sigaction*, size_t) all +int __rt_sigpending:rt_sigpending(sigset_t*, size_t) all int __rt_sigprocmask:rt_sigprocmask(int, const sigset_t*, sigset_t*, size_t) all int __rt_sigsuspend:rt_sigsuspend(const sigset_t*, size_t) all int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t*, struct siginfo_t*, struct timespec_t*, size_t) all diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index dc7e3df..5e5e56b 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -3,9 +3,9 @@ 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/wait4.S syscall_src += arch-arm/syscalls/__sys_clone.S +syscall_src += arch-arm/syscalls/__waitid.S syscall_src += arch-arm/syscalls/execve.S syscall_src += arch-arm/syscalls/getuid.S syscall_src += arch-arm/syscalls/getgid.S @@ -152,8 +152,8 @@ syscall_src += arch-arm/syscalls/timerfd_create.S syscall_src += arch-arm/syscalls/timerfd_settime.S syscall_src += arch-arm/syscalls/timerfd_gettime.S syscall_src += arch-arm/syscalls/sigaction.S -syscall_src += arch-arm/syscalls/sigpending.S syscall_src += arch-arm/syscalls/__rt_sigaction.S +syscall_src += arch-arm/syscalls/__rt_sigpending.S syscall_src += arch-arm/syscalls/__rt_sigprocmask.S syscall_src += arch-arm/syscalls/__rt_sigsuspend.S syscall_src += arch-arm/syscalls/__rt_sigtimedwait.S diff --git a/libc/arch-arm/syscalls/sigpending.S b/libc/arch-arm/syscalls/__rt_sigpending.S index ba667a0..0e0be3a 100644 --- a/libc/arch-arm/syscalls/sigpending.S +++ b/libc/arch-arm/syscalls/__rt_sigpending.S @@ -3,13 +3,13 @@ #include <linux/err.h> #include <machine/asm.h> -ENTRY(sigpending) +ENTRY(__rt_sigpending) mov ip, r7 - ldr r7, =__NR_sigpending + ldr r7, =__NR_rt_sigpending swi #0 mov r7, ip cmn r0, #(MAX_ERRNO + 1) bxls lr neg r0, r0 b __set_errno -END(sigpending) +END(__rt_sigpending) diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk index 2704200..7d99dad 100644 --- a/libc/arch-mips/syscalls.mk +++ b/libc/arch-mips/syscalls.mk @@ -3,10 +3,10 @@ syscall_src := syscall_src += arch-mips/syscalls/_exit.S 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/_waitpid.S +syscall_src += arch-mips/syscalls/__waitid.S syscall_src += arch-mips/syscalls/execve.S syscall_src += arch-mips/syscalls/getuid.S syscall_src += arch-mips/syscalls/getgid.S @@ -155,8 +155,8 @@ syscall_src += arch-mips/syscalls/timerfd_create.S syscall_src += arch-mips/syscalls/timerfd_settime.S syscall_src += arch-mips/syscalls/timerfd_gettime.S syscall_src += arch-mips/syscalls/sigaction.S -syscall_src += arch-mips/syscalls/sigpending.S syscall_src += arch-mips/syscalls/__rt_sigaction.S +syscall_src += arch-mips/syscalls/__rt_sigpending.S syscall_src += arch-mips/syscalls/__rt_sigprocmask.S syscall_src += arch-mips/syscalls/__rt_sigsuspend.S syscall_src += arch-mips/syscalls/__rt_sigtimedwait.S diff --git a/libc/arch-mips/syscalls/sigpending.S b/libc/arch-mips/syscalls/__rt_sigpending.S index 45baa4f..bd4a96e 100644 --- a/libc/arch-mips/syscalls/sigpending.S +++ b/libc/arch-mips/syscalls/__rt_sigpending.S @@ -1,14 +1,14 @@ /* autogenerated by gensyscalls.py */ #include <asm/unistd.h> .text - .globl sigpending + .globl __rt_sigpending .align 4 - .ent sigpending + .ent __rt_sigpending -sigpending: +__rt_sigpending: .set noreorder .cpload $t9 - li $v0, __NR_sigpending + li $v0, __NR_rt_sigpending syscall bnez $a3, 1f move $a0, $v0 @@ -19,4 +19,4 @@ sigpending: j $t9 nop .set reorder - .end sigpending + .end __rt_sigpending diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk index 10970a6..698f6f5 100644 --- a/libc/arch-x86/syscalls.mk +++ b/libc/arch-x86/syscalls.mk @@ -3,10 +3,10 @@ syscall_src := 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/wait4.S syscall_src += arch-x86/syscalls/__sys_clone.S +syscall_src += arch-x86/syscalls/_waitpid.S +syscall_src += arch-x86/syscalls/__waitid.S syscall_src += arch-x86/syscalls/execve.S syscall_src += arch-x86/syscalls/getuid.S syscall_src += arch-x86/syscalls/getgid.S @@ -156,8 +156,8 @@ syscall_src += arch-x86/syscalls/timerfd_create.S syscall_src += arch-x86/syscalls/timerfd_settime.S syscall_src += arch-x86/syscalls/timerfd_gettime.S syscall_src += arch-x86/syscalls/sigaction.S -syscall_src += arch-x86/syscalls/sigpending.S syscall_src += arch-x86/syscalls/__rt_sigaction.S +syscall_src += arch-x86/syscalls/__rt_sigpending.S syscall_src += arch-x86/syscalls/__rt_sigprocmask.S syscall_src += arch-x86/syscalls/__rt_sigsuspend.S syscall_src += arch-x86/syscalls/__rt_sigtimedwait.S diff --git a/libc/arch-x86/syscalls/sigpending.S b/libc/arch-x86/syscalls/__rt_sigpending.S index 70c3ec4..84634b4 100644 --- a/libc/arch-x86/syscalls/sigpending.S +++ b/libc/arch-x86/syscalls/__rt_sigpending.S @@ -3,10 +3,12 @@ #include <linux/err.h> #include <machine/asm.h> -ENTRY(sigpending) +ENTRY(__rt_sigpending) pushl %ebx - mov 8(%esp), %ebx - movl $__NR_sigpending, %eax + pushl %ecx + mov 12(%esp), %ebx + mov 16(%esp), %ecx + movl $__NR_rt_sigpending, %eax int $0x80 cmpl $-MAX_ERRNO, %eax jb 1f @@ -16,6 +18,7 @@ ENTRY(sigpending) addl $4, %esp orl $-1, %eax 1: + popl %ecx popl %ebx ret -END(sigpending) +END(__rt_sigpending) diff --git a/libc/arch-x86_64/syscalls.mk b/libc/arch-x86_64/syscalls.mk index 6b72ca0..611bb35 100644 --- a/libc/arch-x86_64/syscalls.mk +++ b/libc/arch-x86_64/syscalls.mk @@ -3,9 +3,9 @@ syscall_src := syscall_src += arch-x86_64/syscalls/_exit.S syscall_src += arch-x86_64/syscalls/_exit_thread.S syscall_src += arch-x86_64/syscalls/__fork.S -syscall_src += arch-x86_64/syscalls/__waitid.S syscall_src += arch-x86_64/syscalls/wait4.S syscall_src += arch-x86_64/syscalls/__sys_clone.S +syscall_src += arch-x86_64/syscalls/__waitid.S syscall_src += arch-x86_64/syscalls/execve.S syscall_src += arch-x86_64/syscalls/getuid.S syscall_src += arch-x86_64/syscalls/getgid.S @@ -150,6 +150,7 @@ syscall_src += arch-x86_64/syscalls/timerfd_create.S syscall_src += arch-x86_64/syscalls/timerfd_settime.S syscall_src += arch-x86_64/syscalls/timerfd_gettime.S syscall_src += arch-x86_64/syscalls/__rt_sigaction.S +syscall_src += arch-x86_64/syscalls/__rt_sigpending.S syscall_src += arch-x86_64/syscalls/__rt_sigprocmask.S syscall_src += arch-x86_64/syscalls/__rt_sigsuspend.S syscall_src += arch-x86_64/syscalls/__rt_sigtimedwait.S diff --git a/libc/arch-x86_64/syscalls/__rt_sigpending.S b/libc/arch-x86_64/syscalls/__rt_sigpending.S new file mode 100644 index 0000000..ecf1971 --- /dev/null +++ b/libc/arch-x86_64/syscalls/__rt_sigpending.S @@ -0,0 +1,17 @@ +/* autogenerated by gensyscalls.py */ +#include <asm/unistd.h> +#include <linux/err.h> +#include <machine/asm.h> + +ENTRY(__rt_sigpending) + movl $__NR_rt_sigpending, %eax + syscall + cmpq $-MAX_ERRNO, %rax + jb 1f + negl %eax + movl %eax, %edi + call __set_errno + orq $-1, %rax +1: + ret +END(__rt_sigpending) diff --git a/libc/bionic/sigpending.cpp b/libc/bionic/sigpending.cpp new file mode 100644 index 0000000..b6e503c --- /dev/null +++ b/libc/bionic/sigpending.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <signal.h> + +#include "private/kernel_sigset_t.h" + +extern "C" int __rt_sigpending(const kernel_sigset_t*, size_t); + +int sigpending(sigset_t* bionic_set) { + kernel_sigset_t set; + int result = __rt_sigpending(&set, sizeof(set)); + if (result != -1) { + *bionic_set = set.bionic; + } + return result; +} diff --git a/libc/include/signal.h b/libc/include/signal.h index 15d2d3a..e211ef7 100644 --- a/libc/include/signal.h +++ b/libc/include/signal.h @@ -122,24 +122,20 @@ static __inline__ __sighandler_t signal(int s, __sighandler_t f) return bsd_signal(s,f); } -/* the syscall itself */ -extern __sighandler_t __signal(int, __sighandler_t, int); - -extern int sigprocmask(int, const sigset_t *, sigset_t *); -extern int sigaction(int, const struct sigaction *, struct sigaction *); - -extern int sigpending(sigset_t *); -extern int sigsuspend(const sigset_t *); -extern int sigwait(const sigset_t *set, int *sig); -extern int siginterrupt(int sig, int flag); +extern int sigaction(int, const struct sigaction*, struct sigaction*); +extern int siginterrupt(int, int); +extern int sigpending(sigset_t*) __nonnull((1)); +extern int sigprocmask(int, const sigset_t*, sigset_t*); +extern int sigsuspend(const sigset_t*) __nonnull((1)); +extern int sigwait(const sigset_t*, int*) __nonnull((1, 2)); 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); +extern int killpg(int, int); +extern int sigaltstack(const stack_t*, stack_t*); -extern void psiginfo(const siginfo_t* si, const char* message); -extern void psignal(int signal_number, const char* message); +extern void psiginfo(const siginfo_t*, const char*); +extern void psignal(int, const char*); __END_DECLS |