Skip to content

Commit 659de79

Browse files
committed
Auto merge of #941 - wictory:ucred_openbsd, r=alexcrichton
Added ucred (sockpeercred) for OpenBSD and Bitrig OpenBSD and Bitrig has `struct ucred`implemented in the way it is used in `getsockopt(2)` with `SOL_SOCKET` and `SO_PEERCRED`. However, it is called `struct sockpeercred`. Source: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/socket.h?rev=1.65&content-type=text/x-cvsweb-markup I added a type alias for `ucred` to enable Linux compatibility, but I'm not sure this is the correct way to do it.
2 parents ed04152 + 2e38d9a commit 659de79

File tree

1 file changed

+7
-0
lines changed
  • src/unix/bsd/netbsdlike/openbsdlike

1 file changed

+7
-0
lines changed

src/unix/bsd/netbsdlike/openbsdlike/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub type pthread_cond_t = *mut ::c_void;
1414
pub type pthread_condattr_t = *mut ::c_void;
1515
pub type pthread_rwlock_t = *mut ::c_void;
1616
pub type pthread_rwlockattr_t = *mut ::c_void;
17+
pub type ucred = ::sockpeercred;
1718

1819
s! {
1920
pub struct dirent {
@@ -187,6 +188,12 @@ s! {
187188
pub sdl_slen: ::c_uchar,
188189
pub sdl_data: [::c_char; 24],
189190
}
191+
192+
pub struct sockpeercred {
193+
pub uid: ::uid_t,
194+
pub gid: ::gid_t,
195+
pub pid: ::pid_t,
196+
}
190197
}
191198

192199
pub const UT_NAMESIZE: usize = 32;

0 commit comments

Comments
 (0)