@@ -476,16 +476,11 @@ s! {
476476 }
477477
478478 pub struct glob_t {
479- pub gl_pathc: size_t,
479+ pub gl_pathc: crate :: size_t,
480480 pub gl_pathv: * mut * mut c_char,
481- pub gl_offs: size_t,
482- pub gl_flags: c_int,
483-
484- __unused1: Padding <* mut c_void>,
485- __unused2: Padding <* mut c_void>,
486- __unused3: Padding <* mut c_void>,
487- __unused4: Padding <* mut c_void>,
488- __unused5: Padding <* mut c_void>,
481+ pub gl_offs: crate :: size_t,
482+ __dummy1: Padding <c_int>,
483+ __dummy2: Padding <[ * mut c_void; 5 ] >,
489484 }
490485
491486 pub struct ifaddrs {
@@ -529,15 +524,10 @@ s! {
529524 pub f_files: crate :: fsfilcnt_t,
530525 pub f_ffree: crate :: fsfilcnt_t,
531526 pub f_favail: crate :: fsfilcnt_t,
532- #[ cfg( target_endian = "little" ) ]
533- pub f_fsid: c_ulong,
534- #[ cfg( all( target_pointer_width = "32" , not( target_arch = "x86_64" ) ) ) ]
535- __f_unused: Padding <c_int>,
536- #[ cfg( target_endian = "big" ) ]
537527 pub f_fsid: c_ulong,
538528 pub f_flag: c_ulong,
539529 pub f_namemax: c_ulong,
540- __f_spare: [ c_int; 6 ] ,
530+ __f_spare: Padding < [ c_int; 6 ] > ,
541531 }
542532
543533 pub struct dqblk {
@@ -583,14 +573,11 @@ s! {
583573 }
584574
585575 pub struct fsid_t {
586- __val: [ c_int; 2 ] ,
576+ pub __val: [ c_int; 2 ] ,
587577 }
588578
589579 pub struct cpu_set_t {
590- #[ cfg( all( target_pointer_width = "32" , not( target_arch = "x86_64" ) ) ) ]
591- bits: [ u32 ; 32 ] ,
592- #[ cfg( not( all( target_pointer_width = "32" , not( target_arch = "x86_64" ) ) ) ) ]
593- bits: [ u64 ; 16 ] ,
580+ pub __bits: [ c_ulonglong; 128 / size_of:: <c_long>( ) ] ,
594581 }
595582
596583 pub struct if_nameindex {
@@ -733,26 +720,13 @@ s! {
733720 }
734721
735722 pub struct dl_phdr_info {
736- #[ cfg( target_pointer_width = "64" ) ]
737723 pub dlpi_addr: Elf64_Addr ,
738- #[ cfg( target_pointer_width = "32" ) ]
739- pub dlpi_addr: Elf32_Addr ,
740-
741724 pub dlpi_name: * const c_char,
742-
743- #[ cfg( target_pointer_width = "64" ) ]
744725 pub dlpi_phdr: * const Elf64_Phdr ,
745- #[ cfg( target_pointer_width = "32" ) ]
746- pub dlpi_phdr: * const Elf32_Phdr ,
747-
748- #[ cfg( target_pointer_width = "64" ) ]
749726 pub dlpi_phnum: Elf64_Half ,
750- #[ cfg( target_pointer_width = "32" ) ]
751- pub dlpi_phnum: Elf32_Half ,
752-
753727 pub dlpi_adds: c_ulonglong,
754728 pub dlpi_subs: c_ulonglong,
755- pub dlpi_tls_modid: size_t,
729+ pub dlpi_tls_modid: crate :: size_t,
756730 pub dlpi_tls_data: * mut c_void,
757731 }
758732
808782 }
809783
810784 pub struct sigset_t {
811- __val : [ c_ulong; 16 ] ,
785+ pub __bits : [ c_ulong; 128 / size_of :: <c_long> ( ) ] ,
812786 }
813787
814788 pub struct shmid_ds {
@@ -873,15 +847,16 @@ s! {
873847 }
874848
875849 pub struct sem_t {
876- __val: [ c_int; 8 ] ,
850+ pub _s_value: c_int,
851+ pub _s_waiters: c_int,
877852 }
878853
854+ #[ repr( align( 8 ) ) ]
879855 pub struct siginfo_t {
880856 pub si_signo: c_int,
881857 pub si_errno: c_int,
882858 pub si_code: c_int,
883- pub _pad: [ c_int; 29 ] ,
884- _align: [ usize ; 0 ] ,
859+ pub __si_fields: [ c_int; 28 ] ,
885860 }
886861
887862 #[ deprecated(
@@ -952,13 +927,14 @@ s! {
952927
953928 pub struct sockaddr_storage {
954929 pub ss_family: sa_family_t,
955- __ss_pad2: Padding <[ u8 ; 128 - 2 - 8 ] >,
956- __ss_align: size_t,
930+ __ss_padding:
931+ Padding <[ c_char; 128 - size_of:: <c_long>( ) - size_of:: <crate :: sa_family_t>( ) ] >,
932+ __ss_align: c_ulong,
957933 }
958934
959935 pub struct utsname {
960936 pub sysname: [ c_char; 65 ] ,
961- pub nodename: [ c_char; 65 ] ,
937+ pub nodename: [ c_char; crate :: HOST_NAME_MAX . cast_unsigned ( ) as usize + 1 ] ,
962938 pub release: [ c_char; 65 ] ,
963939 pub version: [ c_char; 65 ] ,
964940 pub machine: [ c_char; 65 ] ,
967943
968944 pub struct dirent {
969945 pub d_ino: crate :: ino_t,
970- pub d_off: off_t,
946+ pub d_off: crate :: off_t,
971947 pub d_reclen: c_ushort,
972948 pub d_type: c_uchar,
973949 pub d_name: [ c_char; 256 ] ,
@@ -1160,8 +1136,10 @@ cfg_if! {
11601136
11611137// PUB_CONST
11621138
1163- pub const INT_MIN : c_int = -2147483648 ;
1164- pub const INT_MAX : c_int = 2147483647 ;
1139+ pub const HOST_NAME_MAX : c_int = 255 ;
1140+
1141+ pub const INT_MIN : c_int = -1 - 0x7fffffff ;
1142+ pub const INT_MAX : c_int = 0x7fffffff ;
11651143
11661144pub const SIG_DFL : sighandler_t = 0 as sighandler_t ;
11671145pub const SIG_IGN : sighandler_t = 1 as sighandler_t ;
@@ -3140,31 +3118,43 @@ f! {
31403118 }
31413119
31423120 pub fn CPU_ZERO ( cpuset: & mut cpu_set_t) -> ( ) {
3143- cpuset. bits . fill( 0 ) ;
3121+ cpuset. __bits . fill( 0 ) ;
31443122 }
31453123
3146- pub fn CPU_SET ( cpu: usize , cpuset: & mut cpu_set_t) -> ( ) {
3147- let size_in_bits = 8 * size_of_val( & cpuset. bits[ 0 ] ) ; // 32, 64 etc
3148- let ( idx, offset) = ( cpu / size_in_bits, cpu % size_in_bits) ;
3149- cpuset. bits[ idx] |= 1 << offset;
3150- ( )
3124+ pub fn CPU_SET ( cpu: usize , cpuset: & mut cpu_set_t) -> c_ulonglong {
3125+ ( cpu / 8 >= size_of:: <crate :: cpu_set_t>( ) )
3126+ . then_some( 0 )
3127+ . unwrap_or_else( || {
3128+ let c = & mut cpuset. __bits[ cpu / 8 / size_of:: <c_long>( ) ] ;
3129+ * c |= 1 << ( cpu % ( 8 * size_of:: <c_long>( ) ) ) ;
3130+
3131+ * c
3132+ } )
31513133 }
31523134
3153- pub fn CPU_CLR ( cpu: usize , cpuset: & mut cpu_set_t) -> ( ) {
3154- let size_in_bits = 8 * size_of_val( & cpuset. bits[ 0 ] ) ; // 32, 64 etc
3155- let ( idx, offset) = ( cpu / size_in_bits, cpu % size_in_bits) ;
3156- cpuset. bits[ idx] &= !( 1 << offset) ;
3157- ( )
3135+ pub fn CPU_CLR ( cpu: usize , cpuset: & mut cpu_set_t) -> c_ulonglong {
3136+ ( cpu / 8 >= size_of:: <crate :: cpu_set_t>( ) )
3137+ . then_some( 0 )
3138+ . unwrap_or_else( || {
3139+ let c = & mut cpuset. __bits[ cpu / 8 / size_of:: <c_long>( ) ] ;
3140+ * c &= !( 1 << ( cpu % ( 8 * size_of:: <c_long>( ) ) ) ) ;
3141+
3142+ * c
3143+ } )
31583144 }
31593145
31603146 pub fn CPU_ISSET ( cpu: usize , cpuset: & cpu_set_t) -> bool {
3161- let size_in_bits = 8 * size_of_val( & cpuset. bits[ 0 ] ) ;
3162- let ( idx, offset) = ( cpu / size_in_bits, cpu % size_in_bits) ;
3163- 0 != ( cpuset. bits[ idx] & ( 1 << offset) )
3147+ ( cpu / 8 >= size_of:: <crate :: cpu_set_t>( ) )
3148+ . then_some( false )
3149+ . unwrap_or_else( || {
3150+ ( cpuset. __bits[ cpu / 8 / size_of:: <c_long>( ) ]
3151+ & ( 1 << ( cpu % ( 8 * size_of:: <c_long>( ) ) ) ) )
3152+ != 0
3153+ } )
31643154 }
31653155
31663156 pub fn CPU_EQUAL ( set1: & cpu_set_t, set2: & cpu_set_t) -> bool {
3167- set1. bits == set2. bits
3157+ set1. __bits == set2. __bits
31683158 }
31693159
31703160 pub fn CMSG_DATA ( cmsg: * const cmsghdr) -> * mut c_uchar {
0 commit comments