From 36561c95260abeeca461ecab69aa3a330cb2a632 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 13 Aug 2022 08:24:45 +0100 Subject: [PATCH 1/2] uucore fix NetBSD build. --- src/uucore/src/lib/features/signals.rs | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index e7b20e7d8..395002496 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -78,6 +78,51 @@ pub static ALL_SIGNALS: [&str; 32] = [ "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", ]; +/* + + The following signals are defined in NetBSD: + + SIGHUP 1 Hangup + SIGINT 2 Interrupt + SIGQUIT 3 Quit + SIGILL 4 Illegal instruction + SIGTRAP 5 Trace/BPT trap + SIGABRT 6 Abort trap + SIGEMT 7 EMT trap + SIGFPE 8 Floating point exception + SIGKILL 9 Killed + SIGBUS 10 Bus error + SIGSEGV 11 Segmentation fault + SIGSYS 12 Bad system call + SIGPIPE 13 Broken pipe + SIGALRM 14 Alarm clock + SIGTERM 15 Terminated + SIGURG 16 Urgent I/O condition + SIGSTOP 17 Suspended (signal) + SIGTSTP 18 Suspended + SIGCONT 19 Continued + SIGCHLD 20 Child exited, stopped or continued + SIGTTIN 21 Stopped (tty input) + SIGTTOU 22 Stopped (tty output) + SIGIO 23 I/O possible + SIGXCPU 24 CPU time limit exceeded + SIGXFSZ 25 File size limit exceeded + SIGVTALRM 26 Virtual timer expired + SIGPROF 27 Profiling timer expired + SIGWINCH 28 Window size changed + SIGINFO 29 Information request + SIGUSR1 30 User defined signal 1 + SIGUSR2 31 User defined signal 2 + SIGPWR 32 Power fail/restart +*/ + +#[cfg(target_os = "netbsd")] +pub static ALL_SIGNALS: [&str; 33] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", + "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", + "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "PWR" +]; + pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { if let Ok(value) = signal_name_or_value.parse() { if is_signal(value) { From b5bb07077767c26e236e4f773d59cec3f9f4eef2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 13 Aug 2022 09:40:50 +0100 Subject: [PATCH 2/2] while at it, let's do OpenBSD. --- src/uucore/src/lib/features/signals.rs | 58 ++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 395002496..55f9b4b79 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -6,7 +6,7 @@ // that was distributed with this source code. // spell-checker:ignore (vars/api) fcntl setrlimit setitimer -// spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT TSTP TTIN TTOU VTALRM XCPU XFSZ +// spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGPWR SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTHR SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT PWR THR TSTP TTIN TTOU VTALRM XCPU XFSZ pub static DEFAULT_SIGNAL: usize = 15; @@ -79,7 +79,7 @@ pub static ALL_SIGNALS: [&str; 32] = [ ]; /* - + The following signals are defined in NetBSD: SIGHUP 1 Hangup @@ -120,7 +120,59 @@ pub static ALL_SIGNALS: [&str; 32] = [ pub static ALL_SIGNALS: [&str; 33] = [ "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", - "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "PWR" + "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "PWR", +]; + +/* + + The following signals are defined in OpenBSD: + + SIGHUP terminate process terminal line hangup + SIGINT terminate process interrupt program + SIGQUIT create core image quit program + SIGILL create core image illegal instruction + SIGTRAP create core image trace trap + SIGABRT create core image abort(3) call (formerly SIGIOT) + SIGEMT create core image emulate instruction executed + SIGFPE create core image floating-point exception + SIGKILL terminate process kill program (cannot be caught or + ignored) + SIGBUS create core image bus error + SIGSEGV create core image segmentation violation + SIGSYS create core image system call given invalid argument + SIGPIPE terminate process write on a pipe with no reader + SIGALRM terminate process real-time timer expired + SIGTERM terminate process software termination signal + SIGURG discard signal urgent condition present on socket + SIGSTOP stop process stop (cannot be caught or ignored) + SIGTSTP stop process stop signal generated from keyboard + SIGCONT discard signal continue after stop + SIGCHLD discard signal child status has changed + SIGTTIN stop process background read attempted from control + terminal + SIGTTOU stop process background write attempted to control + terminal + SIGIO discard signal I/O is possible on a descriptor (see + fcntl(2)) + SIGXCPU terminate process CPU time limit exceeded (see + setrlimit(2)) + SIGXFSZ terminate process file size limit exceeded (see + setrlimit(2)) + SIGVTALRM terminate process virtual time alarm (see setitimer(2)) + SIGPROF terminate process profiling timer alarm (see + setitimer(2)) + SIGWINCH discard signal window size change + SIGINFO discard signal status request from keyboard + SIGUSR1 terminate process user-defined signal 1 + SIGUSR2 terminate process user-defined signal 2 + SIGTHR discard signal thread AST +*/ + +#[cfg(target_os = "openbsd")] +pub static ALL_SIGNALS: [&str; 33] = [ + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", + "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO", + "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "THR", ]; pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option {