Skip to content

Commit b1e8398

Browse files
Add support for setjmp/longjmp on x86_64.
1 parent 70284d7 commit b1e8398

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/unix/notbsd/linux/mod.rs

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

660676
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -2259,6 +2275,17 @@ extern {
22592275
nobj: ::size_t,
22602276
stream: *mut ::FILE
22612277
) -> ::size_t;
2278+
2279+
#[cfg(target_arch="x86_64")]
2280+
pub fn setjmp(env: *mut ::jmp_buf) -> ::c_int;
2281+
#[cfg(target_arch="x86_64")]
2282+
#[link_name="__sigsetjmp"]
2283+
#[cfg(target_arch="x86_64")]
2284+
pub fn sigsetjmp(env: *mut ::sigjmp_buf, savesigs: ::c_int) -> ::c_int;
2285+
#[cfg(target_arch="x86_64")]
2286+
pub fn longjmp(env: *mut ::jmp_buf, val: ::c_int);
2287+
#[cfg(target_arch="x86_64")]
2288+
pub fn siglongjmp(env: *mut ::sigjmp_buf, val: ::c_int);
22622289
}
22632290

22642291
cfg_if! {

0 commit comments

Comments
 (0)