Skip to content

Commit

Permalink
Auto merge of #1998 - dylni:make-si-status-method-more-compatible, r=…
Browse files Browse the repository at this point in the history
…JohnTitor

Make si_status method more compatible

Now that [this PR](https://github.com/rust-lang/libc/pull/1858/files) has been merged, `siginfo_t::si_status` is a method for some targets and a field on others. This PR adds the method on targets that already expose the field, which lets the method be used without target detection.

I think this change is backward compatible, but it would be better if someone else could confirm that. The struct would now have a method and a field with the same name on some targets. If that's incompatible, another method could be added that accesses the field or calls the method depending on the target, but this is cleaner.
  • Loading branch information
bors committed Dec 17, 2020
2 parents 80eb0cf + 29b4fae commit f26757a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/bsd/apple/mod.rs
Expand Up @@ -690,6 +690,10 @@ impl siginfo_t {
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}

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

cfg_if! {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Expand Up @@ -71,6 +71,10 @@ impl siginfo_t {
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}

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

s! {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/haiku/mod.rs
Expand Up @@ -50,6 +50,10 @@ impl siginfo_t {
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}

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

s! {
Expand Down
4 changes: 4 additions & 0 deletions src/vxworks/mod.rs
Expand Up @@ -128,6 +128,10 @@ impl siginfo_t {
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}

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

s! {
Expand Down

0 comments on commit f26757a

Please sign in to comment.