From 0ff12d7acf48307e68df2bcfb496e96871bbef08 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sat, 19 Mar 2022 13:22:32 -0700 Subject: [PATCH 1/2] syscall: darwin: more complete list of signals Grepped straight out of the appropriate signal.h, with order and comments preserved verbatim. Makes 1.18 tests happier. --- src/syscall/syscall_libc_darwin.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/syscall/syscall_libc_darwin.go b/src/syscall/syscall_libc_darwin.go index d3ec637638..770e71b58e 100644 --- a/src/syscall/syscall_libc_darwin.go +++ b/src/syscall/syscall_libc_darwin.go @@ -74,13 +74,20 @@ const ( type Signal int +// Source: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/signal.h const ( - SIGCHLD Signal = 0x14 - SIGINT Signal = 0x2 - SIGKILL Signal = 0x9 - SIGTRAP Signal = 0x5 - SIGQUIT Signal = 0x3 - SIGTERM Signal = 0xf + SIGINT Signal = 2 /* interrupt */ + SIGQUIT Signal = 3 /* quit */ + SIGILL Signal = 4 /* illegal instruction (not reset when caught) */ + SIGTRAP Signal = 5 /* trace trap (not reset when caught) */ + SIGABRT Signal = 6 /* abort() */ + SIGFPE Signal = 8 /* floating point exception */ + SIGKILL Signal = 9 /* kill (cannot be caught or ignored) */ + SIGBUS Signal = 10 /* bus error */ + SIGSEGV Signal = 11 /* segmentation violation */ + SIGPIPE Signal = 13 /* write on a pipe with no one to read it */ + SIGTERM Signal = 15 /* software termination signal from kill */ + SIGCHLD Signal = 20 /* to parent on child stop or exit */ ) func (s Signal) Signal() {} From ab8581df54dc31c1951c72b62c4578520f4224aa Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sat, 19 Mar 2022 13:25:30 -0700 Subject: [PATCH 2/2] syscall: wasi: more complete list of signals Grepped straight out of the appropriate signal.h, with order preserved. Makes 1.18 tests happier. See comment on discrepancy for SIGCHLD. Since wasi doesn't really support signals, this may not matter. --- src/syscall/syscall_libc_wasi.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/syscall/syscall_libc_wasi.go b/src/syscall/syscall_libc_wasi.go index 3d4e8111de..6bfab090f3 100644 --- a/src/syscall/syscall_libc_wasi.go +++ b/src/syscall/syscall_libc_wasi.go @@ -9,16 +9,24 @@ import ( ) // https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt +// disagrees with ../../lib/wasi-libc/libc-top-half/musl/arch/wasm32/bits/signal.h for SIGCHLD? +// https://github.com/WebAssembly/wasi-libc/issues/271 type Signal int const ( - SIGCHLD Signal = 16 SIGINT Signal = 2 - SIGKILL Signal = 9 - SIGTRAP Signal = 5 SIGQUIT Signal = 3 + SIGILL Signal = 4 + SIGTRAP Signal = 5 + SIGABRT Signal = 6 + SIGBUS Signal = 7 + SIGFPE Signal = 8 + SIGKILL Signal = 9 + SIGSEGV Signal = 11 + SIGPIPE Signal = 13 SIGTERM Signal = 15 + SIGCHLD Signal = 17 ) func (s Signal) Signal() {}