Skip to content

Fix siginfo_t for Illumos #2696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,45 @@ s! {
}
}

s_no_extra_traits! {
#[cfg_attr(all(
any(target_arch = "x86", target_arch = "x86_64"),
libc_packedN
), repr(packed(4)))]
#[cfg_attr(all(
any(target_arch = "x86", target_arch = "x86_64"),
not(libc_packedN)
), repr(packed))]
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
pub si_code: ::c_int,
si_pid: ::pid_t,
si_uid: ::uid_t,
si_status: ::c_int,
pub si_addr: *mut ::c_void,
__pad: [u8; 36],
}

impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
self.si_addr
}

pub unsafe fn si_pid(&self) -> ::pid_t {
self.si_pid
}

pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}

pub unsafe fn si_status(&self) -> ::c_int {
self.si_status
}
}
}

pub const AF_LOCAL: ::c_int = 1; // AF_UNIX
pub const AF_FILE: ::c_int = 1; // AF_UNIX

Expand Down Expand Up @@ -65,6 +104,14 @@ pub const B4000000: ::speed_t = 31;
// sys/systeminfo.h
pub const SI_ADDRESS_WIDTH: ::c_int = 520;

// sys/siginfo.h
pub const CLD_EXITED: c_int = 1;
pub const CLD_KILLED: c_int = 2;
pub const CLD_DUMPED: c_int = 3;
pub const CLD_TRAPPED: c_int = 4;
pub const CLD_STOPPED: c_int = 5;
pub const CLD_CONTINUED: c_int = 6;

extern "C" {
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;

Expand Down
1 change: 1 addition & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ s_no_extra_traits! {
__ss_pad2: [u8; 240],
}

#[cfg(not(target_os = "illumos"))]
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
Expand Down