File tree Expand file tree Collapse file tree 4 files changed +26
-44
lines changed
src/unix/bsd/freebsdlike/freebsd Expand file tree Collapse file tree 4 files changed +26
-44
lines changed Original file line number Diff line number Diff line change @@ -2196,6 +2196,9 @@ fn test_freebsd(target: &str) {
21962196 // `ptrace_coredump` introduced in FreeBSD 14.
21972197 "ptrace_coredump" if Some ( 14 ) > freebsd_ver => true ,
21982198
2199+ // `sockcred2` is not available in FreeBSD 12.
2200+ "sockcred2" if Some ( 13 ) > freebsd_ver => true ,
2201+
21992202 _ => false ,
22002203 }
22012204 } ) ;
@@ -2233,6 +2236,9 @@ fn test_freebsd(target: &str) {
22332236 true
22342237 }
22352238
2239+ // This is not available in FreeBSD 12.
2240+ "SOCKCRED2SIZE" if Some ( 13 ) > freebsd_ver => true ,
2241+
22362242 _ => false ,
22372243 }
22382244 } ) ;
Original file line number Diff line number Diff line change 3030 pub ext: [ u64 ; 4 ] ,
3131 }
3232
33- pub struct sockcred2 {
34- pub sc_version: :: c_int,
35- pub sc_pid: :: pid_t,
36- pub sc_uid: :: uid_t,
37- pub sc_euid: :: uid_t,
38- pub sc_gid: :: gid_t,
39- pub sc_egid: :: gid_t,
40- pub sc_ngroups: :: c_int,
41- pub sc_groups: [ :: gid_t; 1 ] ,
42- }
43-
4433 pub struct kvm_page {
4534 pub kp_version: :: u_int,
4635 pub kp_paddr: :: kpaddr_t,
@@ -479,17 +468,6 @@ pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
479468
480469pub const MINCORE_SUPER : :: c_int = 0x20 ;
481470
482- f ! {
483- pub fn SOCKCRED2SIZE ( ngrps: usize ) -> usize {
484- let ngrps = if ngrps > 0 {
485- ngrps - 1
486- } else {
487- 0
488- } ;
489- :: mem:: size_of:: <sockcred2>( ) + :: mem:: size_of:: <:: gid_t>( ) * ngrps
490- }
491- }
492-
493471extern "C" {
494472 pub fn aio_readv ( aiocbp : * mut :: aiocb ) -> :: c_int ;
495473 pub fn aio_writev ( aiocbp : * mut :: aiocb ) -> :: c_int ;
Original file line number Diff line number Diff line change 3030 pub ext: [ u64 ; 4 ] ,
3131 }
3232
33- pub struct sockcred2 {
34- pub sc_version: :: c_int,
35- pub sc_pid: :: pid_t,
36- pub sc_uid: :: uid_t,
37- pub sc_euid: :: uid_t,
38- pub sc_gid: :: gid_t,
39- pub sc_egid: :: gid_t,
40- pub sc_ngroups: :: c_int,
41- pub sc_groups: [ :: gid_t; 1 ] ,
42- }
43-
4433 pub struct kvm_page {
4534 pub kp_version: :: u_int,
4635 pub kp_paddr: :: kpaddr_t,
@@ -479,17 +468,6 @@ pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
479468
480469pub const MINCORE_SUPER : :: c_int = 0x60 ;
481470
482- f ! {
483- pub fn SOCKCRED2SIZE ( ngrps: usize ) -> usize {
484- let ngrps = if ngrps > 0 {
485- ngrps - 1
486- } else {
487- 0
488- } ;
489- :: mem:: size_of:: <sockcred2>( ) + :: mem:: size_of:: <:: gid_t>( ) * ngrps
490- }
491- }
492-
493471extern "C" {
494472 pub fn aio_readv ( aiocbp : * mut :: aiocb ) -> :: c_int ;
495473 pub fn aio_writev ( aiocbp : * mut :: aiocb ) -> :: c_int ;
Original file line number Diff line number Diff line change @@ -945,6 +945,17 @@ s! {
945945 pub generation: :: c_long,
946946 pub numdevs: :: c_int,
947947 }
948+
949+ pub struct sockcred2 {
950+ pub sc_version: :: c_int,
951+ pub sc_pid: :: pid_t,
952+ pub sc_uid: :: uid_t,
953+ pub sc_euid: :: uid_t,
954+ pub sc_gid: :: gid_t,
955+ pub sc_egid: :: gid_t,
956+ pub sc_ngroups: :: c_int,
957+ pub sc_groups: [ :: gid_t; 1 ] ,
958+ }
948959}
949960
950961s_no_extra_traits ! {
@@ -3701,6 +3712,15 @@ f! {
37013712 let ( idx, offset) = ( cpu / bitset_bits, cpu % bitset_bits) ;
37023713 0 != cpuset. __bits[ idx] & ( 1 << offset)
37033714 }
3715+
3716+ pub fn SOCKCRED2SIZE ( ngrps: usize ) -> usize {
3717+ let ngrps = if ngrps > 0 {
3718+ ngrps - 1
3719+ } else {
3720+ 0
3721+ } ;
3722+ :: mem:: size_of:: <sockcred2>( ) + :: mem:: size_of:: <:: gid_t>( ) * ngrps
3723+ }
37043724}
37053725
37063726safe_f ! {
You can’t perform that action at this time.
0 commit comments