File tree Expand file tree Collapse file tree 5 files changed +97
-0
lines changed Expand file tree Collapse file tree 5 files changed +97
-0
lines changed Original file line number Diff line number Diff line change @@ -680,6 +680,14 @@ impl siginfo_t {
680680
681681 ( * ( self as * const siginfo_t as * const siginfo_timer ) ) . si_value
682682 }
683+
684+ pub unsafe fn si_pid ( & self ) -> :: pid_t {
685+ self . si_pid
686+ }
687+
688+ pub unsafe fn si_uid ( & self ) -> :: uid_t {
689+ self . si_uid
690+ }
683691}
684692
685693cfg_if ! {
Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ impl siginfo_t {
3131 pub unsafe fn si_value ( & self ) -> :: sigval {
3232 self . si_value
3333 }
34+
35+ pub unsafe fn si_pid ( & self ) -> :: pid_t {
36+ self . si_pid
37+ }
38+
39+ pub unsafe fn si_uid ( & self ) -> :: uid_t {
40+ self . si_uid
41+ }
3442}
3543
3644s ! {
Original file line number Diff line number Diff line change @@ -38,6 +38,20 @@ impl ::Clone for timezone {
3838 }
3939}
4040
41+ impl siginfo_t {
42+ pub unsafe fn si_addr ( & self ) -> * mut :: c_void {
43+ self . si_addr
44+ }
45+
46+ pub unsafe fn si_pid ( & self ) -> :: pid_t {
47+ self . si_pid
48+ }
49+
50+ pub unsafe fn si_uid ( & self ) -> :: uid_t {
51+ self . si_uid
52+ }
53+ }
54+
4155s ! {
4256 pub struct in_addr {
4357 pub s_addr: :: in_addr_t,
Original file line number Diff line number Diff line change @@ -313,6 +313,55 @@ impl siginfo_t {
313313 }
314314}
315315
316+ cfg_if ! {
317+ if #[ cfg( libc_union) ] {
318+ // Internal, for casts to access union fields
319+ #[ repr( C ) ]
320+ #[ derive( Copy , Clone ) ]
321+ struct sifields_sigchld {
322+ si_pid: :: pid_t,
323+ si_uid: :: uid_t,
324+ si_status: :: c_int,
325+ }
326+
327+ // Internal, for casts to access union fields
328+ #[ repr( C ) ]
329+ union sifields {
330+ _align_pointer: * mut :: c_void,
331+ sigchld: sifields_sigchld,
332+ }
333+
334+ // Internal, for casts to access union fields. Note that some variants
335+ // of sifields start with a pointer, which makes the alignment of
336+ // sifields vary on 32-bit and 64-bit architectures.
337+ #[ repr( C ) ]
338+ struct siginfo_f {
339+ _si_signo: :: c_int,
340+ _si_errno: :: c_int,
341+ _si_code: :: c_int,
342+ sifields: sifields,
343+ }
344+
345+ impl siginfo_t {
346+ unsafe fn sifields( & self ) -> & sifields {
347+ & ( * ( self as * const siginfo_t as * const siginfo_f) ) . sifields
348+ }
349+
350+ pub unsafe fn si_pid( & self ) -> :: pid_t {
351+ self . sifields( ) . sigchld. si_pid
352+ }
353+
354+ pub unsafe fn si_uid( & self ) -> :: uid_t {
355+ self . sifields( ) . sigchld. si_uid
356+ }
357+
358+ pub unsafe fn si_status( & self ) -> :: c_int {
359+ self . sifields( ) . sigchld. si_status
360+ }
361+ }
362+ }
363+ }
364+
316365s_no_extra_traits ! {
317366 pub struct utmpx {
318367 pub ut_type: :: c_short,
Original file line number Diff line number Diff line change @@ -112,6 +112,24 @@ impl ::Clone for _Vx_semaphore {
112112 }
113113}
114114
115+ impl siginfo_t {
116+ pub unsafe fn si_addr ( & self ) -> * mut :: c_void {
117+ self . si_addr
118+ }
119+
120+ pub unsafe fn si_value ( & self ) -> :: sigval {
121+ self . si_value
122+ }
123+
124+ pub unsafe fn si_pid ( & self ) -> :: pid_t {
125+ self . si_pid
126+ }
127+
128+ pub unsafe fn si_uid ( & self ) -> :: uid_t {
129+ self . si_uid
130+ }
131+ }
132+
115133s ! {
116134 // b_pthread_condattr_t.h
117135 pub struct pthread_condattr_t {
You can’t perform that action at this time.
0 commit comments