File tree 7 files changed +40
-19
lines changed 7 files changed +40
-19
lines changed Original file line number Diff line number Diff line change @@ -146,5 +146,6 @@ mod imp {
146
146
147
147
pub mod mem {
148
148
pub fn size_of_val < T > ( _: & T ) -> usize { 4 }
149
+ pub fn size_of < T > ( _: & T ) -> usize { 4 }
149
150
}
150
151
}
Original file line number Diff line number Diff line change @@ -159,6 +159,15 @@ s! {
159
159
pub int_p_sign_posn: :: c_char,
160
160
pub int_n_sign_posn: :: c_char,
161
161
}
162
+
163
+ pub struct cmsgcred {
164
+ pub cmcred_pid: :: pid_t,
165
+ pub cmcred_uid: :: uid_t,
166
+ pub cmcred_euid: :: uid_t,
167
+ pub cmcred_gid: :: gid_t,
168
+ pub cmcred_ngroups: :: c_short,
169
+ pub cmcred_groups: [ :: gid_t; CMGROUP_MAX ] ,
170
+ }
162
171
}
163
172
164
173
pub const AIO_LISTIO_MAX : :: c_int = 16 ;
@@ -934,6 +943,8 @@ pub const OCRNL: ::tcflag_t = 0x10;
934
943
pub const ONOCR : :: tcflag_t = 0x20 ;
935
944
pub const ONLRET : :: tcflag_t = 0x40 ;
936
945
946
+ pub const CMGROUP_MAX : usize = 16 ;
947
+
937
948
f ! {
938
949
pub fn WIFCONTINUED ( status: :: c_int) -> bool {
939
950
status == 0x13
Original file line number Diff line number Diff line change
1
+ use dox:: mem;
2
+
1
3
pub type clock_t = :: c_uint ;
2
4
pub type suseconds_t = :: c_int ;
3
5
pub type dev_t = u64 ;
@@ -281,6 +283,16 @@ s! {
281
283
pub ifm_index: :: c_ushort,
282
284
pub ifm_data: if_data,
283
285
}
286
+
287
+ pub struct sockcred {
288
+ pub sc_pid: :: pid_t,
289
+ pub sc_uid: :: uid_t,
290
+ pub sc_euid: :: uid_t,
291
+ pub sc_gid: :: gid_t,
292
+ pub sc_egid: :: gid_t,
293
+ pub sc_ngroups: :: c_int,
294
+ pub sc_groups: [ :: gid_t; 1 ] ,
295
+ }
284
296
}
285
297
286
298
pub const AT_FDCWD : :: c_int = -100 ;
@@ -910,12 +922,21 @@ pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
910
922
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
911
923
f ! {
912
924
pub fn dirfd( dirp: * mut :: DIR ) -> :: c_int {
913
- unsafe { * ( dirp as * const :: c_int) }
925
+ * ( dirp as * const :: c_int)
914
926
}
915
927
916
928
pub fn WIFCONTINUED ( status: :: c_int) -> bool {
917
929
status == 0xffff
918
930
}
931
+
932
+ pub fn SOCKCREDSIZE ( ngrps: usize ) -> usize {
933
+ let ngrps = if ngrps > 0 {
934
+ ngrps - 1
935
+ } else {
936
+ 0
937
+ } ;
938
+ mem:: size_of:: <sockcred>( ) + mem:: size_of:: <:: gid_t>( ) * ngrps
939
+ }
919
940
}
920
941
921
942
extern {
Original file line number Diff line number Diff line change @@ -448,6 +448,12 @@ s! {
448
448
pub p_memsz: Elf64_Xword ,
449
449
pub p_align: Elf64_Xword ,
450
450
}
451
+
452
+ pub struct ucred {
453
+ pub pid: :: pid_t,
454
+ pub uid: :: uid_t,
455
+ pub gid: :: gid_t,
456
+ }
451
457
}
452
458
453
459
pub const ABDAY_1 : :: nl_item = 0x20000 ;
Original file line number Diff line number Diff line change 75
75
pub mem_unit: :: c_uint,
76
76
pub __reserved: [ :: c_char; 256 ] ,
77
77
}
78
-
79
- pub struct ucred {
80
- pub pid: :: pid_t,
81
- pub uid: :: uid_t,
82
- pub gid: :: gid_t,
83
- }
84
78
}
85
79
86
80
pub const SFD_CLOEXEC : :: c_int = 0x080000 ;
Original file line number Diff line number Diff line change @@ -104,12 +104,6 @@ s! {
104
104
__unused5: * mut :: c_void,
105
105
}
106
106
107
- pub struct ucred {
108
- pub pid: :: pid_t,
109
- pub uid: :: uid_t,
110
- pub gid: :: gid_t,
111
- }
112
-
113
107
pub struct statfs {
114
108
pub f_type: __fsword_t,
115
109
pub f_bsize: __fsword_t,
Original file line number Diff line number Diff line change @@ -221,12 +221,6 @@ s! {
221
221
__unused5: * mut :: c_void,
222
222
}
223
223
224
- pub struct ucred {
225
- pub pid: :: pid_t,
226
- pub uid: :: uid_t,
227
- pub gid: :: gid_t,
228
- }
229
-
230
224
pub struct flock {
231
225
pub l_type: :: c_short,
232
226
pub l_whence: :: c_short,
You can’t perform that action at this time.
0 commit comments