blob: a26bdb93e10750e7bfcd4019414032c6d718d37d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#+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"
}
|