|
89 | 89 | pub msg_ctime: ::time_t,
|
90 | 90 | }
|
91 | 91 |
|
92 |
| - pub struct xucred { |
93 |
| - pub cr_version: ::c_uint, |
94 |
| - pub cr_uid: ::uid_t, |
95 |
| - pub cr_ngroups: ::c_short, |
96 |
| - pub cr_groups: [::gid_t;16], |
97 |
| - __cr_unused1: *mut ::c_void, |
98 |
| - } |
99 |
| - |
100 | 92 | pub struct stack_t {
|
101 | 93 | pub ss_sp: *mut ::c_void,
|
102 | 94 | pub ss_size: ::size_t,
|
@@ -143,6 +135,23 @@ s_no_extra_traits! {
|
143 | 135 | pub __ut_spare: [::c_char; 64],
|
144 | 136 | }
|
145 | 137 |
|
| 138 | + #[cfg(libc_union)] |
| 139 | + pub union __c_anonymous_cr_pid { |
| 140 | + __cr_unused: *mut ::c_void, |
| 141 | + pub cr_pid: ::pid_t, |
| 142 | + } |
| 143 | + |
| 144 | + pub struct xucred { |
| 145 | + pub cr_version: ::c_uint, |
| 146 | + pub cr_uid: ::uid_t, |
| 147 | + pub cr_ngroups: ::c_short, |
| 148 | + pub cr_groups: [::gid_t; 16], |
| 149 | + #[cfg(libc_union)] |
| 150 | + pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid, |
| 151 | + #[cfg(not(libc_union))] |
| 152 | + __cr_unused1: *mut ::c_void, |
| 153 | + } |
| 154 | + |
146 | 155 | pub struct sockaddr_dl {
|
147 | 156 | pub sdl_len: ::c_uchar,
|
148 | 157 | pub sdl_family: ::c_uchar,
|
@@ -225,6 +234,73 @@ cfg_if! {
|
225 | 234 | }
|
226 | 235 | }
|
227 | 236 |
|
| 237 | + #[cfg(libc_union)] |
| 238 | + impl PartialEq for __c_anonymous_cr_pid { |
| 239 | + fn eq(&self, other: &__c_anonymous_cr_pid) -> bool { |
| 240 | + unsafe { self.cr_pid == other.cr_pid} |
| 241 | + } |
| 242 | + } |
| 243 | + #[cfg(libc_union)] |
| 244 | + impl Eq for __c_anonymous_cr_pid {} |
| 245 | + #[cfg(libc_union)] |
| 246 | + impl ::fmt::Debug for __c_anonymous_cr_pid { |
| 247 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 248 | + f.debug_struct("cr_pid") |
| 249 | + .field("cr_pid", unsafe { &self.cr_pid }) |
| 250 | + .finish() |
| 251 | + } |
| 252 | + } |
| 253 | + #[cfg(libc_union)] |
| 254 | + impl ::hash::Hash for __c_anonymous_cr_pid { |
| 255 | + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 256 | + unsafe { self.cr_pid.hash(state) }; |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + impl PartialEq for xucred { |
| 261 | + fn eq(&self, other: &xucred) -> bool { |
| 262 | + #[cfg(libc_union)] |
| 263 | + let equal_cr_pid = self.cr_pid__c_anonymous_union |
| 264 | + == other.cr_pid__c_anonymous_union; |
| 265 | + #[cfg(not(libc_union))] |
| 266 | + let equal_cr_pid = self.__cr_unused1 == other.__cr_unused1; |
| 267 | + |
| 268 | + self.cr_version == other.cr_version |
| 269 | + && self.cr_uid == other.cr_uid |
| 270 | + && self.cr_ngroups == other.cr_ngroups |
| 271 | + && self.cr_groups == other.cr_groups |
| 272 | + && equal_cr_pid |
| 273 | + } |
| 274 | + } |
| 275 | + impl Eq for xucred {} |
| 276 | + impl ::fmt::Debug for xucred { |
| 277 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 278 | + let mut struct_formatter = f.debug_struct("xucred"); |
| 279 | + struct_formatter.field("cr_version", &self.cr_version); |
| 280 | + struct_formatter.field("cr_uid", &self.cr_uid); |
| 281 | + struct_formatter.field("cr_ngroups", &self.cr_ngroups); |
| 282 | + struct_formatter.field("cr_groups", &self.cr_groups); |
| 283 | + #[cfg(libc_union)] |
| 284 | + struct_formatter.field( |
| 285 | + "cr_pid__c_anonymous_union", |
| 286 | + &self.cr_pid__c_anonymous_union |
| 287 | + ); |
| 288 | + struct_formatter.finish() |
| 289 | + } |
| 290 | + } |
| 291 | + impl ::hash::Hash for xucred { |
| 292 | + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 293 | + self.cr_version.hash(state); |
| 294 | + self.cr_uid.hash(state); |
| 295 | + self.cr_ngroups.hash(state); |
| 296 | + self.cr_groups.hash(state); |
| 297 | + #[cfg(libc_union)] |
| 298 | + self.cr_pid__c_anonymous_union.hash(state); |
| 299 | + #[cfg(not(libc_union))] |
| 300 | + self.__cr_unused1.hash(state); |
| 301 | + } |
| 302 | + } |
| 303 | + |
228 | 304 | impl PartialEq for sockaddr_dl {
|
229 | 305 | fn eq(&self, other: &sockaddr_dl) -> bool {
|
230 | 306 | self.sdl_len == other.sdl_len
|
@@ -629,7 +705,6 @@ pub const SO_PROTOCOL: ::c_int = 0x1016;
|
629 | 705 | pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
|
630 | 706 | pub const SO_VENDOR: ::c_int = 0x80000000;
|
631 | 707 |
|
632 |
| -pub const LOCAL_PEERCRED: ::c_int = 1; |
633 | 708 | pub const LOCAL_CREDS: ::c_int = 2;
|
634 | 709 | pub const LOCAL_CONNWAIT: ::c_int = 4;
|
635 | 710 | pub const LOCAL_VENDOR: ::c_int = SO_VENDOR;
|
@@ -1103,9 +1178,6 @@ pub const _PC_ACL_NFS4: ::c_int = 64;
|
1103 | 1178 |
|
1104 | 1179 | pub const _SC_CPUSET_SIZE: ::c_int = 122;
|
1105 | 1180 |
|
1106 |
| -pub const XU_NGROUPS: ::c_int = 16; |
1107 |
| -pub const XUCRED_VERSION: ::c_uint = 0; |
1108 |
| - |
1109 | 1181 | // Flags which can be passed to pdfork(2)
|
1110 | 1182 | pub const PD_DAEMON: ::c_int = 0x00000001;
|
1111 | 1183 | pub const PD_CLOEXEC: ::c_int = 0x00000002;
|
|
0 commit comments