Skip to content

Commit 4e825c1

Browse files
committed
Add support for setjmp/longjmp on linux/x86_64.
1 parent 70284d7 commit 4e825c1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/unix/notbsd/linux/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,20 @@ s! {
655655
pub updated: ::c_ulong,
656656
pub ha: [::c_uchar; ::MAX_ADDR_LEN],
657657
}
658+
659+
#[repr(C)]
660+
pub struct jmp_buf {
661+
__jmpbuf: [i64; 8],
662+
__mask_was_saved: ::c_int,
663+
__saved_mask: ::sigset_t,
664+
}
665+
666+
#[repr(C)]
667+
pub struct sigjmp_buf {
668+
__jmpbuf: [i64; 8],
669+
__mask_was_saved: ::c_int,
670+
__saved_mask: ::sigset_t,
671+
}
658672
}
659673

660674
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -2259,6 +2273,12 @@ extern {
22592273
nobj: ::size_t,
22602274
stream: *mut ::FILE
22612275
) -> ::size_t;
2276+
2277+
pub fn setjmp(env: *mut ::jmp_buf) -> ::c_int;
2278+
#[link_name="__sigsetjmp"]
2279+
pub fn sigsetjmp(env: *mut ::sigjmp_buf, savesigs: ::c_int) -> ::c_int;
2280+
pub fn longjmp(env: *mut ::jmp_buf, val: ::c_int);
2281+
pub fn siglongjmp(env: *mut ::sigjmp_buf, val: ::c_int);
22622282
}
22632283

22642284
cfg_if! {

0 commit comments

Comments
 (0)