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) {
2196
2196
// `ptrace_coredump` introduced in FreeBSD 14.
2197
2197
"ptrace_coredump" if Some ( 14 ) > freebsd_ver => true ,
2198
2198
2199
+ // `sockcred2` is not available in FreeBSD 12.
2200
+ "sockcred2" if Some ( 13 ) > freebsd_ver => true ,
2201
+
2199
2202
_ => false ,
2200
2203
}
2201
2204
} ) ;
@@ -2233,6 +2236,9 @@ fn test_freebsd(target: &str) {
2233
2236
true
2234
2237
}
2235
2238
2239
+ // This is not available in FreeBSD 12.
2240
+ "SOCKCRED2SIZE" if Some ( 13 ) > freebsd_ver => true ,
2241
+
2236
2242
_ => false ,
2237
2243
}
2238
2244
} ) ;
Original file line number Diff line number Diff line change 30
30
pub ext: [ u64 ; 4 ] ,
31
31
}
32
32
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
-
44
33
pub struct kvm_page {
45
34
pub kp_version: :: u_int,
46
35
pub kp_paddr: :: kpaddr_t,
@@ -479,17 +468,6 @@ pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
479
468
480
469
pub const MINCORE_SUPER : :: c_int = 0x20 ;
481
470
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
-
493
471
extern "C" {
494
472
pub fn aio_readv ( aiocbp : * mut :: aiocb ) -> :: c_int ;
495
473
pub fn aio_writev ( aiocbp : * mut :: aiocb ) -> :: c_int ;
Original file line number Diff line number Diff line change 30
30
pub ext: [ u64 ; 4 ] ,
31
31
}
32
32
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
-
44
33
pub struct kvm_page {
45
34
pub kp_version: :: u_int,
46
35
pub kp_paddr: :: kpaddr_t,
@@ -479,17 +468,6 @@ pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
479
468
480
469
pub const MINCORE_SUPER : :: c_int = 0x60 ;
481
470
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
-
493
471
extern "C" {
494
472
pub fn aio_readv ( aiocbp : * mut :: aiocb ) -> :: c_int ;
495
473
pub fn aio_writev ( aiocbp : * mut :: aiocb ) -> :: c_int ;
Original file line number Diff line number Diff line change @@ -945,6 +945,17 @@ s! {
945
945
pub generation: :: c_long,
946
946
pub numdevs: :: c_int,
947
947
}
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
+ }
948
959
}
949
960
950
961
s_no_extra_traits ! {
@@ -3701,6 +3712,15 @@ f! {
3701
3712
let ( idx, offset) = ( cpu / bitset_bits, cpu % bitset_bits) ;
3702
3713
0 != cpuset. __bits[ idx] & ( 1 << offset)
3703
3714
}
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
+ }
3704
3724
}
3705
3725
3706
3726
safe_f ! {
You can’t perform that action at this time.
0 commit comments