Skip to content

Commit 08720f1

Browse files
authored
Merge pull request #169 from xingxue-ibm/sigaction
Bump libc to 0.2.171 to use sigaction for AIX
2 parents 64a7b3a + 5a1fc51 commit 08720f1

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ members = [
3434
]
3535

3636
[dependencies]
37-
libc = "^0.2"
37+
libc = "^0.2.171"
3838
signal-hook-registry = { version = "^1.4", path = "signal-hook-registry" }
3939

4040
[dev-dependencies]

signal-hook-registry/src/lib.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,7 @@ impl Slot {
158158
fn new(signal: libc::c_int) -> Result<Self, Error> {
159159
// C data structure, expected to be zeroed out.
160160
let mut new: libc::sigaction = unsafe { mem::zeroed() };
161-
#[cfg(not(target_os = "aix"))]
162-
{ new.sa_sigaction = handler as usize; }
163-
#[cfg(target_os = "aix")]
164-
{ new.sa_union.__su_sigaction = handler; }
161+
new.sa_sigaction = handler as usize;
165162
// Android is broken and uses different int types than the rest (and different depending on
166163
// the pointer width). This converts the flags to the proper type no matter what it is on
167164
// the given platform.
@@ -239,10 +236,7 @@ impl Prev {
239236

240237
#[cfg(not(windows))]
241238
unsafe fn execute(&self, sig: c_int, info: *mut siginfo_t, data: *mut c_void) {
242-
#[cfg(not(target_os = "aix"))]
243239
let fptr = self.info.sa_sigaction;
244-
#[cfg(target_os = "aix")]
245-
let fptr = self.info.sa_union.__su_sigaction as usize;
246240
if fptr != 0 && fptr != libc::SIG_DFL && fptr != libc::SIG_IGN {
247241
// Android is broken and uses different int types than the rest (and different
248242
// depending on the pointer width). This converts the flags to the proper type no

src/low_level/signal_details.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,7 @@ fn restore_default(signal: c_int) -> Result<(), Error> {
111111
unsafe {
112112
// A C structure, supposed to be memset to 0 before use.
113113
let mut action: libc::sigaction = mem::zeroed();
114-
#[cfg(target_os = "aix")]
115-
{
116-
action.sa_union.__su_sigaction = mem::transmute::<
117-
usize,
118-
extern "C" fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void),
119-
>(libc::SIG_DFL);
120-
}
121-
#[cfg(not(target_os = "aix"))]
122-
{ action.sa_sigaction = libc::SIG_DFL as _; }
114+
action.sa_sigaction = libc::SIG_DFL as _;
123115
if libc::sigaction(signal, &action, ptr::null_mut()) == 0 {
124116
Ok(())
125117
} else {

0 commit comments

Comments
 (0)