Files
Odin/core/c/libc/signal.odin
T
vassvik 102d080a31 Fix core:c/libc Windows compilation errors by linking to the right libraries.
Fix some name typos and missing types in Windows.
Add explicit cast on MB_CUR_MAX
2021-08-28 13:27:41 +02:00

44 lines
850 B
Odin

package libc
// 7.14 Signal handling
when ODIN_OS == "windows" {
foreign import libc "system:libucrt.lib"
} else {
foreign import libc "system:c"
}
sig_atomic_t :: distinct atomic_int;
@(default_calling_convention="c")
foreign libc {
signal :: proc(sig: int, func: proc "c" (int)) -> proc "c" (int) ---;
raise :: proc(sig: int) -> int ---;
}
when ODIN_OS == "windows" {
SIG_ERR :: rawptr(~uintptr(0));
SIG_DFL :: rawptr(uintptr(0));
SIG_IGN :: rawptr(uintptr(1));
SIGABRT :: 22;
SIGFPE :: 8;
SIGILL :: 4;
SIGINT :: 2;
SIGSEGV :: 11;
SIGTERM :: 15;
}
when ODIN_OS == "linux" || ODIN_OS == "freebsd" || ODIN_OS == "darwin" {
SIG_ERR :: rawptr(~uintptr(0));
SIG_DFL :: rawptr(uintptr(0));
SIG_IGN :: rawptr(uintptr(1));
SIGABRT :: 6;
SIGFPE :: 8;
SIGILL :: 4;
SIGINT :: 2;
SIGSEGV :: 11;
SIGTERM :: 15;
}