@@ -144,6 +144,11 @@ s! {
144
144
pub imr_address: :: in_addr,
145
145
pub imr_ifindex: :: c_int,
146
146
}
147
+
148
+ pub struct __exit_status {
149
+ pub e_termination: :: c_short,
150
+ pub e_exit: :: c_short,
151
+ }
147
152
}
148
153
149
154
s_no_extra_traits ! {
@@ -163,6 +168,36 @@ s_no_extra_traits! {
163
168
pub mem_unit: :: c_uint,
164
169
pub __reserved: [ :: c_char; 256 ] ,
165
170
}
171
+
172
+ // FIXME: musl added paddings and adjusted
173
+ // layout in 1.2.0 but our CI is still 1.1.24.
174
+ // So, I'm leaving some fields as comments for now.
175
+ // ref. https://github.com/bminor/musl/commit/
176
+ // 1e7f0fcd7ff2096904fd93a2ee6d12a2392be392
177
+ pub struct utmpx {
178
+ pub ut_type: :: c_short,
179
+ //__ut_pad1: ::c_short,
180
+ pub ut_pid: :: pid_t,
181
+ pub ut_line: [ :: c_char; 32 ] ,
182
+ pub ut_id: [ :: c_char; 4 ] ,
183
+ pub ut_user: [ :: c_char; 32 ] ,
184
+ pub ut_host: [ :: c_char; 256 ] ,
185
+ pub ut_exit: __exit_status,
186
+
187
+ //#[cfg(target_endian = "little")]
188
+ pub ut_session: :: c_long,
189
+ //#[cfg(target_endian = "little")]
190
+ //__ut_pad2: ::c_long,
191
+
192
+ //#[cfg(not(target_endian = "little"))]
193
+ //__ut_pad2: ::c_int,
194
+ //#[cfg(not(target_endian = "little"))]
195
+ //pub ut_session: ::c_int,
196
+
197
+ pub ut_tv: :: timeval,
198
+ pub ut_addr_v6: [ :: c_uint; 4 ] ,
199
+ __unused: [ :: c_char; 20 ] ,
200
+ }
166
201
}
167
202
168
203
cfg_if ! {
@@ -231,6 +266,68 @@ cfg_if! {
231
266
self . __reserved. hash( state) ;
232
267
}
233
268
}
269
+
270
+ impl PartialEq for utmpx {
271
+ fn eq( & self , other: & utmpx) -> bool {
272
+ self . ut_type == other. ut_type
273
+ //&& self.__ut_pad1 == other.__ut_pad1
274
+ && self . ut_pid == other. ut_pid
275
+ && self . ut_line == other. ut_line
276
+ && self . ut_id == other. ut_id
277
+ && self . ut_user == other. ut_user
278
+ && self
279
+ . ut_host
280
+ . iter( )
281
+ . zip( other. ut_host. iter( ) )
282
+ . all( |( a, b) | a == b)
283
+ && self . ut_exit == other. ut_exit
284
+ && self . ut_session == other. ut_session
285
+ //&& self.__ut_pad2 == other.__ut_pad2
286
+ && self . ut_tv == other. ut_tv
287
+ && self . ut_addr_v6 == other. ut_addr_v6
288
+ && self . __unused == other. __unused
289
+ }
290
+ }
291
+
292
+ impl Eq for utmpx { }
293
+
294
+ impl :: fmt:: Debug for utmpx {
295
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
296
+ f. debug_struct( "utmpx" )
297
+ . field( "ut_type" , & self . ut_type)
298
+ //.field("__ut_pad1", &self.__ut_pad1)
299
+ . field( "ut_pid" , & self . ut_pid)
300
+ . field( "ut_line" , & self . ut_line)
301
+ . field( "ut_id" , & self . ut_id)
302
+ . field( "ut_user" , & self . ut_user)
303
+ //FIXME: .field("ut_host", &self.ut_host)
304
+ . field( "ut_exit" , & self . ut_exit)
305
+ . field( "ut_session" , & self . ut_session)
306
+ //.field("__ut_pad2", &self.__ut_pad2)
307
+ . field( "ut_tv" , & self . ut_tv)
308
+ . field( "ut_addr_v6" , & self . ut_addr_v6)
309
+ . field( "__unused" , & self . __unused)
310
+ . finish( )
311
+ }
312
+ }
313
+
314
+ impl :: hash:: Hash for utmpx {
315
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
316
+ self . ut_type. hash( state) ;
317
+ //self.__ut_pad1.hash(state);
318
+ self . ut_pid. hash( state) ;
319
+ self . ut_line. hash( state) ;
320
+ self . ut_id. hash( state) ;
321
+ self . ut_user. hash( state) ;
322
+ self . ut_host. hash( state) ;
323
+ self . ut_exit. hash( state) ;
324
+ self . ut_session. hash( state) ;
325
+ //self.__ut_pad2.hash(state);
326
+ self . ut_tv. hash( state) ;
327
+ self . ut_addr_v6. hash( state) ;
328
+ self . __unused. hash( state) ;
329
+ }
330
+ }
234
331
}
235
332
}
236
333
0 commit comments