@@ -2,6 +2,126 @@ pub type pthread_t = c_ulong;
2
2
pub type __priority_which_t = :: c_uint ;
3
3
pub type __rlimit_resource_t = :: c_uint ;
4
4
5
+ cfg_if ! {
6
+ if #[ cfg( libc_union) ] {
7
+ #[ repr( C ) ]
8
+ #[ derive( Copy , Clone ) ]
9
+ struct addr_bnd_t {
10
+ lower: * mut :: c_void,
11
+ upper: * mut :: c_void,
12
+ }
13
+
14
+ #[ repr( C ) ]
15
+ #[ derive( Copy , Clone ) ]
16
+ union sigfault_t_anonymous_union {
17
+ addr_bnd: addr_bnd_t,
18
+ pkey: u32 ,
19
+ }
20
+
21
+ #[ repr( C ) ]
22
+ #[ derive( Copy , Clone ) ]
23
+ struct sigfault_t {
24
+ addr: * mut :: c_void,
25
+ #[ cfg( target_arch = "sparc" ) ]
26
+ trapno: :: c_int,
27
+ addr_lsb: :: c_short,
28
+ anonymous_union: sigfault_t_anonymous_union,
29
+ }
30
+
31
+ cfg_if! {
32
+ if #[ cfg( target_pointer_width = "64" ) ] {
33
+ type SI_PADDING = [ :: c_int; 28 ] ;
34
+ } else {
35
+ type SI_PADDING = [ :: c_int; 29 ] ;
36
+ }
37
+ }
38
+
39
+ #[ repr( C ) ]
40
+ #[ derive( Copy , Clone ) ]
41
+ union sifields_t {
42
+ _pad: SI_PADDING ,
43
+ sigfault: sigfault_t,
44
+ }
45
+
46
+ impl :: fmt:: Debug for sigfault_t_anonymous_union {
47
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
48
+ // Excludes the fields because we can't know which is valid
49
+ f. debug_struct( "sigfault_t_anonymous_union" )
50
+ . finish( )
51
+ }
52
+ }
53
+
54
+ impl :: fmt:: Debug for sigfault_t {
55
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
56
+ // TODO: include trapno on Sparc
57
+ f. debug_struct( "sigfault_t" )
58
+ . field( "addr" , & self . addr)
59
+ . field( "addr_lsb" , & self . addr_lsb)
60
+ . field( "anonymous_union" , & self . anonymous_union)
61
+ . finish( )
62
+ }
63
+ }
64
+
65
+ impl :: fmt:: Debug for sifields_t {
66
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
67
+ // No way to print anything more detailed without the
68
+ // discriminant from siginfo_t
69
+ f. debug_struct( "sifields_t" ) . finish( )
70
+ }
71
+ }
72
+ } else {
73
+ type sifields_t = [ :: c_int; 29 ] ;
74
+ }
75
+ }
76
+
77
+ s_no_extra_traits ! {
78
+ pub struct siginfo_t {
79
+ pub si_signo: :: c_int,
80
+ pub si_errno: :: c_int,
81
+ pub si_code: :: c_int,
82
+ sifields: sifields_t,
83
+
84
+ #[ cfg( target_arch = "x86_64" ) ]
85
+ _align: [ u64 ; 0 ] ,
86
+ #[ cfg( not( target_arch = "x86_64" ) ) ]
87
+ _align: [ usize ; 0 ] ,
88
+ }
89
+ }
90
+
91
+ cfg_if ! {
92
+ if #[ cfg( libc_union) ] {
93
+ impl siginfo_t {
94
+ pub unsafe fn si_addr( & self ) -> * mut :: c_void {
95
+ self . sifields. sigfault. addr
96
+ }
97
+ }
98
+ } else {
99
+ impl siginfo_t {
100
+ pub unsafe fn si_addr( & self ) -> * mut :: c_void {
101
+ #[ repr( C ) ]
102
+ struct siginfo_sigfault {
103
+ _si_signo: :: c_int,
104
+ _si_errno: :: c_int,
105
+ _si_code: :: c_int,
106
+ si_addr: * mut :: c_void
107
+ }
108
+ ( * ( self as * const siginfo_t as * const siginfo_sigfault) ) . si_addr
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ impl :: fmt:: Debug for siginfo_t {
115
+ fn fmt ( & self , f : & mut :: fmt:: Formatter ) -> :: fmt:: Result {
116
+ // TODO: include fields from sifields
117
+ f. debug_struct ( "siginfo_t" )
118
+ . field ( "si_signo" , & self . si_signo )
119
+ . field ( "si_errno" , & self . si_errno )
120
+ . field ( "si_code" , & self . si_code )
121
+ . finish ( )
122
+ }
123
+ }
124
+
5
125
s ! {
6
126
pub struct statx {
7
127
pub stx_mask: u32 ,
76
196
pub ss_size: :: size_t
77
197
}
78
198
79
- pub struct siginfo_t {
80
- pub si_signo: :: c_int,
81
- pub si_errno: :: c_int,
82
- pub si_code: :: c_int,
83
- #[ doc( hidden) ]
84
- #[ deprecated(
85
- since="0.2.54" ,
86
- note="Please leave a comment on \
87
- https://github.com/rust-lang/libc/pull/1316 if you're using \
88
- this field"
89
- ) ]
90
- pub _pad: [ :: c_int; 29 ] ,
91
- #[ cfg( target_arch = "x86_64" ) ]
92
- _align: [ u64 ; 0 ] ,
93
- #[ cfg( not( target_arch = "x86_64" ) ) ]
94
- _align: [ usize ; 0 ] ,
95
- }
96
-
97
199
pub struct glob64_t {
98
200
pub gl_pathc: :: size_t,
99
201
pub gl_pathv: * mut * mut :: c_char,
@@ -233,19 +335,6 @@ s! {
233
335
}
234
336
}
235
337
236
- impl siginfo_t {
237
- pub unsafe fn si_addr ( & self ) -> * mut :: c_void {
238
- #[ repr( C ) ]
239
- struct siginfo_sigfault {
240
- _si_signo : :: c_int ,
241
- _si_errno : :: c_int ,
242
- _si_code : :: c_int ,
243
- si_addr : * mut :: c_void
244
- }
245
- ( * ( self as * const siginfo_t as * const siginfo_sigfault ) ) . si_addr
246
- }
247
- }
248
-
249
338
s_no_extra_traits ! {
250
339
pub struct utmpx {
251
340
pub ut_type: :: c_short,
0 commit comments