diff --git a/lib/std/libc/libc.c3 b/lib/std/libc/libc.c3 index 5b5f175e5..7da66cdcd 100644 --- a/lib/std/libc/libc.c3 +++ b/lib/std/libc/libc.c3 @@ -57,27 +57,12 @@ alias Fd = CInt; alias Fpos_t @if(env::WIN32) = long; alias SignalFunction = fn void(CInt); -const CInt SIGHUP = 1; +// Common signals for all targets const CInt SIGINT = 2; -const CInt SIGQUIT = 3; const CInt SIGILL = 4; -const CInt SIGTRAP = 5; -const CInt SIGABRT = 6; -const CInt SIGBUS = BSD_FLAVOR_SIG ? 10 : 7; // Or Mips const CInt SIGFPE = 8; -const CInt SIGKILL = 9; const CInt SIGSEGV = 11; -const CInt SIGSYS = BSD_FLAVOR_SIG ? 12 : 31; -const CInt SIGPIPE = 13; -const CInt SIGALRM = 14; const CInt SIGTERM = 15; -const CInt SIGURG = BSD_FLAVOR_SIG ? 16 : 23; -const CInt SIGSTOP = BSD_FLAVOR_SIG ? 17 : 19; -const CInt SIGTSTP = BSD_FLAVOR_SIG ? 18 : 20; -const CInt SIGCONT = BSD_FLAVOR_SIG ? 19 : 18; -const CInt SIGCHLD = BSD_FLAVOR_SIG ? 20 : 17; - -const bool BSD_FLAVOR_SIG @local = env::DARWIN || env::BSD_FAMILY; alias Time_t = $typefrom(env::WIN32 ? long.typeid : CLong.typeid); alias Off_t = $typefrom(env::WIN32 ? int.typeid : isz.typeid); diff --git a/lib/std/libc/os/generic_bsd.c3 b/lib/std/libc/os/generic_bsd.c3 new file mode 100644 index 000000000..48c102383 --- /dev/null +++ b/lib/std/libc/os/generic_bsd.c3 @@ -0,0 +1,8 @@ +module libc @if(env::DARWIN ||| env::BSD_FAMILY); + +const CInt SIGIOT = 6; +const CInt SIGEMT = 7; +const CInt SIGIO = 23; +const CInt SIGPROF = 27; +const CInt SIGINFO = 29; +const CInt SIGTHR = 32; diff --git a/lib/std/libc/os/linux.c3 b/lib/std/libc/os/linux.c3 index 7de44dc63..328a8b7c0 100644 --- a/lib/std/libc/os/linux.c3 +++ b/lib/std/libc/os/linux.c3 @@ -60,3 +60,12 @@ extern fn CInt stat(ZString path, Stat* stat); extern fn CInt get_nprocs(); extern fn CInt get_nprocs_conf(); + +// Additional Linux signals +const CInt SIGIOT = 6; +const CInt SIGSTKFLT = 16; +const CInt SIGPROF = 27; +const CInt SIGIO = 29; +const CInt SIGPOLL = 29; +const CInt SIGPWR = 30; +const CInt SIGUNUSED = 31; diff --git a/lib/std/libc/os/posix.c3 b/lib/std/libc/os/posix.c3 index f50174191..3b6f2e880 100644 --- a/lib/std/libc/os/posix.c3 +++ b/lib/std/libc/os/posix.c3 @@ -69,6 +69,32 @@ extern fn CInt sigaction(CInt signum, Sigaction *action, Sigaction *oldaction) @ extern fn CInt sigemptyset(Sigset_t* set) @if(!env::NETBSD); extern fn CInt sigemptyset(Sigset_t* set) @cname("__sigemptyset14") @if(env::NETBSD); +const CInt SIGHUP = 1; +const CInt SIGQUIT = 3; +const CInt SIGTRAP = 5; +const CInt SIGABRT = 6; +const CInt SIGKILL = 9; +const CInt SIGBUS = BSD_FLAVOR_SIG ? 10 : 7; // Or Mips +const CInt SIGSYS = BSD_FLAVOR_SIG ? 12 : 31; +const CInt SIGPIPE = 13; +const CInt SIGALRM = 14; +const CInt SIGURG = BSD_FLAVOR_SIG ? 16 : 23; +const CInt SIGSTOP = BSD_FLAVOR_SIG ? 17 : 19; +const CInt SIGTSTP = BSD_FLAVOR_SIG ? 18 : 20; +const CInt SIGCONT = BSD_FLAVOR_SIG ? 19 : 18; +const CInt SIGCHLD = BSD_FLAVOR_SIG ? 20 : 17; +const CInt SIGTTIN = 21; +const CInt SIGTTOU = 22; +const CInt SIGXCPU = 24; +const CInt SIGXFSZ = 25; +const CInt SIGVTALRM = 26; +const CInt SIGWINCH = 28; +const CInt SIGUSR1 = BSD_FLAVOR_SIG ? 30 : 10; +const CInt SIGUSR2 = BSD_FLAVOR_SIG ? 31 : 12; + +const bool BSD_FLAVOR_SIG @local = env::DARWIN || env::BSD_FAMILY; + + module libc::termios @if(env::LIBC &&& env::POSIX); bitstruct Tc_iflags : CUInt diff --git a/lib/std/libc/os/win32.c3 b/lib/std/libc/os/win32.c3 index 2fa1fffaa..59c797a62 100644 --- a/lib/std/libc/os/win32.c3 +++ b/lib/std/libc/os/win32.c3 @@ -70,3 +70,7 @@ macro CInt setjmp(JmpBuf* buffer) => _setjmp(buffer, null); macro Tm* gmtime_r(Time_t* timer, Tm* buf) => _gmtime64_s(buf, timer); macro isz read(Fd fd, void* buffer, usz buffer_size) => _read(fd, buffer, (CUInt)buffer_size); macro isz write(Fd fd, void* buffer, usz count) => _write(fd, buffer, (CUInt)count); + +const CInt SIGABRT_COMPAT = 6; +const CInt SIGBREAK = 21; +const CInt SIGABRT = 22;