@@ -345,39 +345,176 @@ s! {
345345}
346346
347347s_no_extra_traits ! {
348- #[ allow( missing_debug_implementations) ]
349348 #[ cfg( libc_union) ]
350349 pub union __sigaction_sa_union {
351350 pub __su_handler: extern fn ( c: :: c_int) ,
352351 pub __su_sigaction: extern fn ( c: :: c_int, info: * mut siginfo_t, ptr: * mut :: c_void) ,
353352 }
354353
355- #[ allow( missing_debug_implementations) ]
356354 pub struct sigaction {
355+ #[ cfg( libc_union) ]
357356 pub sa_union: __sigaction_sa_union,
358357 pub sa_mask: sigset_t,
359358 pub sa_flags: :: c_int,
360359 }
361360
362- #[ allow( missing_debug_implementations) ]
363361 #[ cfg( libc_union) ]
364362 pub union __poll_ctl_ext_u {
365363 pub addr: * mut :: c_void,
366364 pub data32: u32 ,
367365 pub data: u64 ,
368366 }
369367
370- #[ allow( missing_debug_implementations) ]
371368 pub struct poll_ctl_ext {
372369 pub version: u8 ,
373370 pub command: u8 ,
374371 pub events: :: c_short,
375372 pub fd: :: c_int,
373+ #[ cfg( libc_union) ]
376374 pub u: __poll_ctl_ext_u,
377375 pub reversed64: [ u64 ; 6 ] ,
378376 }
379377}
380378
379+
380+ cfg_if ! {
381+ if #[ cfg( feature = "extra_traits" ) ] {
382+ #[ cfg( libc_union) ]
383+ impl PartialEq for __sigaction_sa_union {
384+ fn eq( & self , other: & __sigaction_sa_union) -> bool {
385+ unsafe {
386+ self . __su_handler == other. __su_handler
387+ && self . __su_sigaction == other. __su_sigaction
388+ }
389+ }
390+ }
391+ #[ cfg( libc_union) ]
392+ impl Eq for __sigaction_sa_union { }
393+ #[ cfg( libc_union) ]
394+ impl :: fmt:: Debug for __sigaction_sa_union {
395+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
396+ f. debug_struct( "__sigaction_sa_union" )
397+ . field( "__su_handler" , unsafe { & self . __su_handler } )
398+ . field( "__su_sigaction" , unsafe { & self . __su_sigaction } )
399+ . finish( )
400+ }
401+ }
402+ #[ cfg( libc_union) ]
403+ impl :: hash:: Hash for __sigaction_sa_union {
404+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
405+ unsafe {
406+ self . __su_handler. hash( state) ;
407+ self . __su_sigaction. hash( state) ;
408+ }
409+ }
410+ }
411+
412+ impl PartialEq for sigaction {
413+ fn eq( & self , other: & sigaction) -> bool {
414+ #[ cfg( libc_union) ]
415+ let union_eq = self . sa_union == other. sa_union;
416+ #[ cfg( not( libc_union) ) ]
417+ let union_eq = true ;
418+ self . sa_mask == other. sa_mask
419+ && self . sa_flags == other. sa_flags
420+ && union_eq
421+ }
422+ }
423+ impl Eq for sigaction { }
424+ impl :: fmt:: Debug for sigaction {
425+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
426+ let mut struct_formatter = f. debug_struct( "sigaction" ) ;
427+ #[ cfg( libc_union) ]
428+ struct_formatter. field( "sa_union" , & self . sa_union) ;
429+ struct_formatter. field( "sa_mask" , & self . sa_mask) ;
430+ struct_formatter. field( "sa_flags" , & self . sa_flags) ;
431+ struct_formatter. finish( )
432+ }
433+ }
434+ impl :: hash:: Hash for sigaction {
435+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
436+ #[ cfg( libc_union) ]
437+ self . sa_union. hash( state) ;
438+ self . sa_mask. hash( state) ;
439+ self . sa_flags. hash( state) ;
440+ }
441+ }
442+
443+ #[ cfg( libc_union) ]
444+ impl PartialEq for __poll_ctl_ext_u {
445+ fn eq( & self , other: & __poll_ctl_ext_u) -> bool {
446+ unsafe {
447+ self . addr == other. addr
448+ && self . data32 == other. data32
449+ && self . data == other. data
450+ }
451+ }
452+ }
453+ #[ cfg( libc_union) ]
454+ impl Eq for __poll_ctl_ext_u { }
455+ #[ cfg( libc_union) ]
456+ impl :: fmt:: Debug for __poll_ctl_ext_u {
457+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
458+ f. debug_struct( "__poll_ctl_ext_u" )
459+ . field( "addr" , unsafe { & self . addr } )
460+ . field( "data32" , unsafe { & self . data32 } )
461+ . field( "data" , unsafe { & self . data } )
462+ . finish( )
463+ }
464+ }
465+ #[ cfg( libc_union) ]
466+ impl :: hash:: Hash for __poll_ctl_ext_u {
467+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
468+ unsafe {
469+ self . addr. hash( state) ;
470+ self . data32. hash( state) ;
471+ self . data. hash( state) ;
472+ }
473+ }
474+ }
475+
476+ impl PartialEq for poll_ctl_ext {
477+ fn eq( & self , other: & poll_ctl_ext) -> bool {
478+ #[ cfg( libc_union) ]
479+ let union_eq = self . u == other. u;
480+ #[ cfg( not( libc_union) ) ]
481+ let union_eq = true ;
482+ self . version == other. version
483+ && self . command == other. command
484+ && self . events == other. events
485+ && self . fd == other. fd
486+ && self . reversed64 == other. reversed64
487+ && union_eq
488+ }
489+ }
490+ impl Eq for poll_ctl_ext { }
491+ impl :: fmt:: Debug for poll_ctl_ext {
492+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
493+ let mut struct_formatter = f. debug_struct( "poll_ctl_ext" ) ;
494+ struct_formatter. field( "version" , & self . version) ;
495+ struct_formatter. field( "command" , & self . command) ;
496+ struct_formatter. field( "events" , & self . events) ;
497+ struct_formatter. field( "fd" , & self . fd) ;
498+ #[ cfg( libc_union) ]
499+ struct_formatter. field( "u" , & self . u) ;
500+ struct_formatter. field( "reversed64" , & self . reversed64) ;
501+ struct_formatter. finish( )
502+ }
503+ }
504+ impl :: hash:: Hash for poll_ctl_ext {
505+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
506+ self . version. hash( state) ;
507+ self . command. hash( state) ;
508+ self . events. hash( state) ;
509+ self . fd. hash( state) ;
510+ #[ cfg( libc_union) ]
511+ self . u. hash( state) ;
512+ self . reversed64. hash( state) ;
513+ }
514+ }
515+ }
516+ }
517+
381518// dlfcn.h
382519pub const RTLD_LAZY : :: c_int = 0x4 ;
383520pub const RTLD_NOW : :: c_int = 0x2 ;
0 commit comments