mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-04 20:17:48 +00:00
55 lines
1.3 KiB
Odin
55 lines
1.3 KiB
Odin
#+build linux, darwin, netbsd, openbsd, freebsd
|
|
package posix
|
|
|
|
import "core:c"
|
|
|
|
when ODIN_OS == .Darwin {
|
|
foreign import lib "system:System"
|
|
} else {
|
|
foreign import lib "system:c"
|
|
}
|
|
|
|
// setjmp.h - stack environment declarations
|
|
|
|
foreign lib {
|
|
/*
|
|
Equivalent to longjmp() but must not touch signals.
|
|
|
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/_longjmp.html ]]
|
|
*/
|
|
_longjmp :: proc(env: ^jmp_buf, val: c.int) -> ! ---
|
|
|
|
/*
|
|
Equivalent to setjmp() but must not touch signals.
|
|
|
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/_longjmp.html ]]
|
|
*/
|
|
_setjmp :: proc(env: ^jmp_buf) -> c.int ---
|
|
|
|
/*
|
|
Equivalent to longjmp() but restores saved signal masks.
|
|
|
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/siglongjump.html ]]
|
|
*/
|
|
@(link_name=LSIGLONGJMP)
|
|
siglongjmp :: proc(env: ^sigjmp_buf, val: c.int) -> ! ---
|
|
|
|
/*
|
|
Equivalent to setjmp() but restores saved signal masks.
|
|
|
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/siglongjump.html ]]
|
|
*/
|
|
@(link_name=LSIGSETJMP)
|
|
sigsetjmp :: proc(env: ^sigjmp_buf, savemask: b32) -> c.int ---
|
|
}
|
|
|
|
sigjmp_buf :: distinct jmp_buf
|
|
|
|
when ODIN_OS == .NetBSD {
|
|
@(private) LSIGSETJMP :: "__sigsetjmp14"
|
|
@(private) LSIGLONGJMP :: "__siglongjmp14"
|
|
} else {
|
|
@(private) LSIGSETJMP :: "sigsetjmp"
|
|
@(private) LSIGLONGJMP :: "siglongjmp"
|
|
}
|