From 7c2f669af03297c0fd2f40ec6e21d427ae57d91d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 30 Apr 2019 22:47:21 -0400 Subject: [PATCH 1/3] Deprecate _pad field on siginfo_t --- src/unix/notbsd/linux/other/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 3d177bd2763b2..798f265042c93 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -48,6 +48,7 @@ s! { pub si_signo: ::c_int, pub si_errno: ::c_int, pub si_code: ::c_int, + #[deprecated(since="0.2.54", note="Please leave a comment on https://github.com/rust-lang/libc/pull/1316 if you're using this field")] pub _pad: [::c_int; 29], #[cfg(target_arch = "x86_64")] _align: [u64; 0], From 53591a693ab8b349cd38372f73d2b99d06d43fa6 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 1 May 2019 12:14:42 +0000 Subject: [PATCH 2/3] Implement si_addr --- src/unix/notbsd/linux/other/mod.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 798f265042c93..c7f98735a6f9b 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -48,7 +48,12 @@ s! { pub si_signo: ::c_int, pub si_errno: ::c_int, pub si_code: ::c_int, - #[deprecated(since="0.2.54", note="Please leave a comment on https://github.com/rust-lang/libc/pull/1316 if you're using this field")] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] pub _pad: [::c_int; 29], #[cfg(target_arch = "x86_64")] _align: [u64; 0], @@ -56,6 +61,19 @@ s! { _align: [usize; 0], } + impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + #[repr(C)] + struct siginfo_sigfault { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + si_addr: *mut ::c_void + } + (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr + } + } + pub struct glob64_t { pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut ::c_char, From 9b43adea005751d60855184719b6c315b6b60035 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 1 May 2019 12:17:56 +0000 Subject: [PATCH 3/3] Oops, move this outside the s! block --- src/unix/notbsd/linux/other/mod.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index c7f98735a6f9b..8a643768de0c8 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -61,19 +61,6 @@ s! { _align: [usize; 0], } - impl siginfo_t { - pub unsafe fn si_addr(&self) -> *mut ::c_void { - #[repr(C)] - struct siginfo_sigfault { - _si_signo: ::c_int, - _si_errno: ::c_int, - _si_code: ::c_int, - si_addr: *mut ::c_void - } - (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr - } - } - pub struct glob64_t { pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut ::c_char, @@ -213,6 +200,19 @@ s! { } } +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + #[repr(C)] + struct siginfo_sigfault { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + si_addr: *mut ::c_void + } + (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr + } +} + s_no_extra_traits! { pub struct utmpx { pub ut_type: ::c_short,