Skip to content

Commit 08ff18d

Browse files
committed
Auto merge of #2320 - devnexen:fbsd_sockcred2, r=JohnTitor
adding LOCAL_CREDS_PERSISTENT for FreeBSD.
2 parents e02b7e5 + 64271cc commit 08ff18d

File tree

1 file changed

+25
-0
lines changed
  • src/unix/bsd/freebsdlike/freebsd/freebsd13

1 file changed

+25
-0
lines changed

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

+25
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ s! {
2626
pub udata: *mut ::c_void,
2727
pub ext: [u64; 4],
2828
}
29+
30+
pub struct sockcred2 {
31+
pub sc_version: ::c_int,
32+
pub sc_pid: ::pid_t,
33+
pub sc_uid: ::uid_t,
34+
pub sc_euid: ::uid_t,
35+
pub sc_gid: ::gid_t,
36+
pub sc_egid: ::gid_t,
37+
pub sc_ngroups: ::c_int,
38+
pub sc_groups: [::gid_t; 1],
39+
}
2940
}
3041

3142
s_no_extra_traits! {
@@ -208,6 +219,20 @@ pub const EINTEGRITY: ::c_int = 97;
208219
pub const ELAST: ::c_int = 97;
209220
pub const GRND_INSECURE: ::c_uint = 0x4;
210221

222+
pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3;
223+
pub const SCM_CREDS2: ::c_int = 0x08;
224+
225+
f! {
226+
pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
227+
let ngrps = if ngrps > 0 {
228+
ngrps - 1
229+
} else {
230+
0
231+
};
232+
::mem::size_of::<sockcred2>() + ::mem::size_of::<::gid_t>() * ngrps
233+
}
234+
}
235+
211236
extern "C" {
212237
pub fn aio_readv(aiocbp: *mut ::aiocb) -> ::c_int;
213238
pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int;

0 commit comments

Comments
 (0)