mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Make signal handling work well across platforms
- Fix sigsuspend() on XNU - Fix strsignal() on non-Linux - Add unit tests for strsignal() - Add unit tests for setitimer() - Add unit tests for sigsuspend() - Rewrite setitimer() for New Technology - Rewrite nanosleep() for New Technology - Polyfill SIGALRM on the New Technology - select(0,0,0,0) on NT now calls pause() - Remove some NTDLL calls that aren't needed - Polyfill SA_NOCLDWAIT on the New Technology - Polyfill SA_RESETHAND on the New Technology - Polyfill sigprocmask() on the New Technology - Polyfill SIGCHLD+SIG_IGN on the New Technology - Polyfill SA_RESTART masking on the New Technology - Deliver console signals from main thread on New Technology - Document SA_RESTART behavior w/ @sarestartable / @norestart - System call trace in MODE=dbg now prints inherited FDs and signal mask
This commit is contained in:
parent
3b9e66ecba
commit
072e1d2910
82 changed files with 1388 additions and 450 deletions
|
@ -1,2 +1,2 @@
|
|||
.include "o/libc/sysv/macros.internal.inc"
|
||||
.scall sys_sigprocmask,0x125030154203000e,globl,hidden
|
||||
.scall sys_sigprocmask,0x125030154214900e,globl,hidden
|
||||
|
|
|
@ -2015,7 +2015,7 @@ syscon nr __NR_msync 0x001a 0x2000041 0x0041 0x0100 0x115 0xfff
|
|||
syscon nr __NR_mprotect 0x000a 0x200004a 0x004a 0x004a 0x04a 0xfff
|
||||
syscon nr __NR_munmap 0x000b 0x2000049 0x0049 0x0049 0x049 0xfff
|
||||
syscon nr __NR_sigaction 0x000d 0x200002e 0x01a0 0x002e 0x154 0xfff
|
||||
syscon nr __NR_sigprocmask 0x000e 0x2000030 0x0154 0x0030 0x125 0xfff
|
||||
syscon nr __NR_sigprocmask 0x000e 0x2000149 0x0154 0x0030 0x125 0xfff
|
||||
syscon nr __NR_ioctl 0x0010 0x2000036 0x0036 0x0036 0x036 0xfff
|
||||
syscon nr __NR_pread 0x0011 0x2000099 0x01db 0x00ad 0x0ad 0xfff
|
||||
syscon nr __NR_pwrite 0x0012 0x200009a 0x01dc 0x00ae 0x0ae 0xfff
|
||||
|
|
|
@ -53,43 +53,44 @@ COSMOPOLITAN_C_END_
|
|||
|
||||
#define SIGABRT LITERALLY(6)
|
||||
#define SIGALRM LITERALLY(14)
|
||||
#define SIGBUS SYMBOLIC(SIGBUS)
|
||||
#define SIGCHLD SYMBOLIC(SIGCHLD)
|
||||
#define SIGCONT SYMBOLIC(SIGCONT)
|
||||
#define SIGEMT SYMBOLIC(SIGEMT)
|
||||
#define SIGFPE LITERALLY(8)
|
||||
#define SIGHUP LITERALLY(1)
|
||||
#define SIGILL LITERALLY(4)
|
||||
#define SIGINFO SYMBOLIC(SIGINFO)
|
||||
#define SIGINT LITERALLY(2)
|
||||
#define SIGIO SYMBOLIC(SIGIO)
|
||||
#define SIGIOT LITERALLY(6)
|
||||
#define SIGKILL LITERALLY(9)
|
||||
#define SIGPIPE LITERALLY(13)
|
||||
#define SIGPOLL SYMBOLIC(SIGPOLL)
|
||||
#define SIGPROF LITERALLY(27)
|
||||
#define SIGPWR SYMBOLIC(SIGPWR)
|
||||
#define SIGQUIT LITERALLY(3)
|
||||
#define SIGRTMAX SYMBOLIC(SIGRTMAX)
|
||||
#define SIGRTMIN SYMBOLIC(SIGRTMIN)
|
||||
#define SIGSEGV LITERALLY(11)
|
||||
#define SIGSTKFLT SYMBOLIC(SIGSTKFLT)
|
||||
#define SIGSTOP SYMBOLIC(SIGSTOP)
|
||||
#define SIGSYS SYMBOLIC(SIGSYS)
|
||||
#define SIGTERM LITERALLY(15)
|
||||
#define SIGTRAP LITERALLY(5)
|
||||
#define SIGTSTP SYMBOLIC(SIGTSTP)
|
||||
#define SIGTTIN LITERALLY(21)
|
||||
#define SIGTTOU LITERALLY(22)
|
||||
#define SIGUNUSED SYMBOLIC(SIGUNUSED)
|
||||
#define SIGURG SYMBOLIC(SIGURG)
|
||||
#define SIGUSR1 SYMBOLIC(SIGUSR1)
|
||||
#define SIGUSR2 SYMBOLIC(SIGUSR2)
|
||||
#define SIGVTALRM LITERALLY(26)
|
||||
#define SIGWINCH LITERALLY(28)
|
||||
#define SIGXCPU LITERALLY(24)
|
||||
#define SIGXFSZ LITERALLY(25)
|
||||
|
||||
#define SIGBUS SYMBOLIC(SIGBUS)
|
||||
#define SIGCHLD SYMBOLIC(SIGCHLD)
|
||||
#define SIGCONT SYMBOLIC(SIGCONT)
|
||||
#define SIGEMT SYMBOLIC(SIGEMT)
|
||||
#define SIGINFO SYMBOLIC(SIGINFO)
|
||||
#define SIGIO SYMBOLIC(SIGIO)
|
||||
#define SIGPOLL SYMBOLIC(SIGPOLL)
|
||||
#define SIGPWR SYMBOLIC(SIGPWR)
|
||||
#define SIGRTMAX SYMBOLIC(SIGRTMAX)
|
||||
#define SIGRTMIN SYMBOLIC(SIGRTMIN)
|
||||
#define SIGSTKFLT SYMBOLIC(SIGSTKFLT)
|
||||
#define SIGSTOP SYMBOLIC(SIGSTOP)
|
||||
#define SIGSYS SYMBOLIC(SIGSYS)
|
||||
#define SIGTSTP SYMBOLIC(SIGTSTP)
|
||||
#define SIGUNUSED SYMBOLIC(SIGUNUSED)
|
||||
#define SIGURG SYMBOLIC(SIGURG)
|
||||
#define SIGUSR1 SYMBOLIC(SIGUSR1)
|
||||
#define SIGUSR2 SYMBOLIC(SIGUSR2)
|
||||
|
||||
#define SIG_ATOMIC_MIN SYMBOLIC(SIG_ATOMIC_MIN)
|
||||
#define SIG_BLOCK SYMBOLIC(SIG_BLOCK)
|
||||
#define SIG_SETMASK SYMBOLIC(SIG_SETMASK)
|
||||
|
|
|
@ -49,7 +49,7 @@ scall sys_msync 0x115100041204101a globl hidden
|
|||
scall sys_mprotect 0x04a04a04a204a00a globl hidden
|
||||
scall __sys_munmap 0x049049049204900b globl hidden
|
||||
scall sys_sigaction 0x15402e1a0202e00d globl hidden # rt_sigaction on Lunix; it's complicated on NetBSD
|
||||
scall sys_sigprocmask 0x125030154203000e globl hidden # a.k.a. rt_sigprocmask, openbsd:byvalue
|
||||
scall sys_sigprocmask 0x125030154214900e globl hidden # a.k.a. rt_sigprocmask, openbsd:byvalue, a.k.a. pthread_sigmask
|
||||
scall sys_ioctl 0x0360360362036010 globl hidden
|
||||
scall sys_pread 0x0ad0ad1db2099011 globl hidden # a.k.a. pread64; netbsd+openbsd:pad
|
||||
scall sys_pwrite 0x0ae0ae1dc209a012 globl hidden # a.k.a. pwrite64; netbsd+openbsd:pad
|
||||
|
@ -162,8 +162,8 @@ scall sys_setresuid 0xfff11a137ffff075 globl hidden # polyfilled for xnu
|
|||
scall sys_setresgid 0xfff11c138ffff077 globl hidden # polyfilled for xnu
|
||||
scall getresuid 0xfff119168ffff076 globl # semantics aren't well-defined
|
||||
scall getresgid 0xfff11b169ffff078 globl # semantics aren't well-defined
|
||||
scall sigpending 0x124034034203407f globl # rt_sigpending on linux
|
||||
scall sys_sigsuspend 0x12606f155206f082 globl hidden # openbsd:byvalue
|
||||
scall sigpending 0x124034034203407f globl # a.k.a. rt_sigpending on linux
|
||||
scall sys_sigsuspend 0x12606f155206f082 globl hidden # a.k.a. rt_sigsuspend on Linux; openbsd:byvalue, sigsuspend_nocancel on XNU
|
||||
scall sys_sigaltstack 0x1191200352035083 globl hidden
|
||||
scall sys_mknod 0x1c200e00e200e085 globl hidden
|
||||
scall mknodat 0x1cc14022fffff103 globl # FreeBSD 12+
|
||||
|
@ -193,7 +193,7 @@ scall capget 0xfffffffffffff07d globl
|
|||
scall capset 0xfffffffffffff07e globl
|
||||
scall sigtimedwait 0xffffff159ffff080 globl
|
||||
scall sys_sigqueue 0xffffff1c8fffffff globl
|
||||
scall sys_sigqueueinfo 0x0f5ffffffffff081 globl # rt_sigqueueinfo on linux
|
||||
scall sys_sigqueueinfo 0x0f5ffffffffff081 globl # a.k.a. rt_sigqueueinfo on linux
|
||||
scall personality 0xfffffffffffff087 globl
|
||||
scall ustat 0xfffffffffffff088 globl
|
||||
scall sysfs 0xfffffffffffff08b globl
|
||||
|
@ -246,7 +246,7 @@ scall lookup_dcookie 0xfffffffffffff0d4 globl
|
|||
scall sys_epoll_create 0xfffffffffffff0d5 globl
|
||||
scall sys_epoll_wait 0xfffffffffffff0e8 globl
|
||||
scall sys_epoll_ctl 0xfffffffffffff0e9 globl
|
||||
scall getdents 0x18606311020c40d9 globl hidden # four args b/c xnu, getdirentries on xnu, 32-bit on xnu/freebsd, getdents64 on linux, 64-bit on openbsd
|
||||
scall getdents 0x18606311020c40d9 globl hidden # four args b/c xnu, getdirentries on xnu, 32-bit on xnu/freebsd, a.k.a. getdents64 on linux, 64-bit on openbsd
|
||||
scall set_tid_address 0xfffffffffffff0da globl
|
||||
scall restart_syscall 0xfffffffffffff0db globl
|
||||
scall semtimedop 0xfffffffffffff0dc globl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue