@@ -42,6 +42,19 @@ cfg_if! {
42
42
uc_sigmask: __c_anonymous_uc_sigmask_with_padding,
43
43
uc_sigmask64: :: sigset64_t,
44
44
}
45
+
46
+ pub struct ucontext_t {
47
+ pub uc_flags: :: c_ulong,
48
+ pub uc_link: * mut ucontext_t,
49
+ pub uc_stack: :: stack_t,
50
+ pub uc_mcontext: mcontext_t,
51
+ pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask,
52
+ /* The kernel adds extra padding after uc_sigmask to match
53
+ * glibc sigset_t on ARM. */
54
+ __padding: [ c_char; 120 ] ,
55
+ __align: [ :: c_longlong; 0 ] ,
56
+ uc_regspace: [ :: c_ulong; 128 ] ,
57
+ }
45
58
}
46
59
47
60
cfg_if! {
@@ -88,81 +101,63 @@ cfg_if! {
88
101
unsafe { self . uc_sigmask. hash( state) }
89
102
}
90
103
}
91
- }
92
- }
93
- }
94
- }
95
-
96
- s_no_extra_traits ! {
97
- pub struct ucontext_t {
98
- pub uc_flags: :: c_ulong,
99
- pub uc_link: * mut ucontext_t,
100
- pub uc_stack: :: stack_t,
101
- pub uc_mcontext: mcontext_t,
102
- pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask,
103
- /* The kernel adds extra padding after uc_sigmask to match
104
- * glibc sigset_t on ARM. */
105
- __padding: [ c_char; 120 ] ,
106
- __align: [ :: c_longlong; 0 ] ,
107
- uc_regspace: [ :: c_ulong; 128 ] ,
108
- }
109
- }
110
104
111
- cfg_if ! {
112
- if #[ cfg( feature = "extra_traits" ) ] {
113
- struct Array128 <T >( [ T ; 128 ] ) ;
105
+ struct Array128 <T >( [ T ; 128 ] ) ;
114
106
115
- impl <T : :: fmt:: Debug > :: fmt:: Debug for Array128 <T > {
116
- fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
117
- let mut dlist = f. debug_list( ) ;
118
- for i in 0 ..self . 0 . len( ) {
119
- dlist. entry( & self . 0 [ i] ) ;
107
+ impl <T : :: fmt:: Debug > :: fmt:: Debug for Array128 <T > {
108
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
109
+ let mut dlist = f. debug_list( ) ;
110
+ for i in 0 ..self . 0 . len( ) {
111
+ dlist. entry( & self . 0 [ i] ) ;
112
+ }
113
+ dlist. finish( )
114
+ }
120
115
}
121
- dlist. finish( )
122
- }
123
- }
124
116
125
- impl PartialEq for ucontext_t {
126
- fn eq( & self , other: & Self ) -> bool {
127
- self . uc_flags == other. uc_flags
128
- && self . uc_link == other. uc_link
129
- && self . uc_stack == other. uc_stack
130
- && self . uc_mcontext == other. uc_mcontext
131
- && self . uc_sigmask__c_anonymous_union
132
- == other. uc_sigmask__c_anonymous_union
133
- && & self . uc_regspace[ ..] == & other. uc_regspace[ ..]
134
- // Ignore padding field
135
- }
136
- }
137
- impl Eq for ucontext_t { }
138
- impl :: fmt:: Debug for ucontext_t {
139
- fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
140
- f. debug_struct( "ucontext_t" )
141
- . field( "uc_flags" , & self . uc_flags)
142
- . field( "uc_link" , & self . uc_link)
143
- . field( "uc_stack" , & self . uc_stack)
144
- . field( "uc_mcontext" , & self . uc_mcontext)
145
- . field(
146
- "uc_sigmask__c_anonymous_union" ,
147
- & self . uc_sigmask__c_anonymous_union
148
- )
149
- // &self.uc_regspace[..] doesn't work due to error[E0277]:
150
- // the size for values of type `[u32]` cannot be known
151
- // at compilation time
152
- . field( "uc_regspace" , & Array128 ( self . uc_regspace) )
153
- // Ignore padding field
154
- . finish( )
155
- }
156
- }
157
- impl :: hash:: Hash for ucontext_t {
158
- fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
159
- self . uc_flags. hash( state) ;
160
- self . uc_link. hash( state) ;
161
- self . uc_stack. hash( state) ;
162
- self . uc_mcontext. hash( state) ;
163
- self . uc_sigmask__c_anonymous_union. hash( state) ;
164
- & self . uc_regspace[ ..] . hash( state) ;
165
- // Ignore padding field
117
+ impl PartialEq for ucontext_t {
118
+ fn eq( & self , other: & Self ) -> bool {
119
+ self . uc_flags == other. uc_flags
120
+ && self . uc_link == other. uc_link
121
+ && self . uc_stack == other. uc_stack
122
+ && self . uc_mcontext == other. uc_mcontext
123
+ && self . uc_sigmask__c_anonymous_union
124
+ == other. uc_sigmask__c_anonymous_union
125
+ && & self . uc_regspace[ ..] == & other. uc_regspace[ ..]
126
+ // Ignore padding field
127
+ }
128
+ }
129
+ impl Eq for ucontext_t { }
130
+ impl :: fmt:: Debug for ucontext_t {
131
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
132
+ f. debug_struct( "ucontext_t" )
133
+ . field( "uc_flags" , & self . uc_flags)
134
+ . field( "uc_link" , & self . uc_link)
135
+ . field( "uc_stack" , & self . uc_stack)
136
+ . field( "uc_mcontext" , & self . uc_mcontext)
137
+ . field(
138
+ "uc_sigmask__c_anonymous_union" ,
139
+ & self . uc_sigmask__c_anonymous_union
140
+ )
141
+ // &self.uc_regspace[..] doesn't work due
142
+ // to error[E0277]:
143
+ // the size for values of type `[u32]` cannot be
144
+ // known at compilation time
145
+ . field( "uc_regspace" , & Array128 ( self . uc_regspace) )
146
+ // Ignore padding field
147
+ . finish( )
148
+ }
149
+ }
150
+ impl :: hash:: Hash for ucontext_t {
151
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
152
+ self . uc_flags. hash( state) ;
153
+ self . uc_link. hash( state) ;
154
+ self . uc_stack. hash( state) ;
155
+ self . uc_mcontext. hash( state) ;
156
+ self . uc_sigmask__c_anonymous_union. hash( state) ;
157
+ & self . uc_regspace[ ..] . hash( state) ;
158
+ // Ignore padding field
159
+ }
160
+ }
166
161
}
167
162
}
168
163
}
0 commit comments