diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-08-06 15:12:00 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-08-06 15:12:00 +0000 |
commit | 70cce1a384ec21c6ba0ef38d64d2f67333e4b7d7 (patch) | |
tree | c970e39408b21bc1f6994dddf2415267d1b41ad7 /src/unistd.rs | |
parent | 237ec7bc13d045f21ae653c74bfd41fe411860f9 (diff) | |
parent | 9f0af4479742386c4ce30d05ad20e2450bbd0d54 (diff) | |
download | nix-70cce1a384ec21c6ba0ef38d64d2f67333e4b7d7.zip |
Merge #923
923: Fix control message *decoding* and add support for `ScmCredentials` r=asomers a=jonas-schievink
While https://github.com/nix-rust/nix/pull/918 fixed the *encoding*, the *decoding* done by the `CmsgIterator` still remained broken when multiple messages are received. However, since nix didn't support any control message that could reliably be sent twice in one `sendmsg` call, this couldn't be tested properly.
This PR addresses this by adding `SCM_CREDENTIALS` support and testing all of this by passing both an `SCM_CREDENTIALS` and a `SCM_RIGHTS` message at the same time.
I've also verified that the resulting encoding is the same as for roughly equivalent C code.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'src/unistd.rs')
-rw-r--r-- | src/unistd.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index 8022aa0b..32d0405e 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -48,6 +48,11 @@ impl Uid { pub fn is_root(&self) -> bool { *self == ROOT } + + /// Get the raw `uid_t` wrapped by `self`. + pub fn as_raw(&self) -> uid_t { + self.0 + } } impl From<Uid> for uid_t { @@ -87,6 +92,11 @@ impl Gid { pub fn effective() -> Self { getegid() } + + /// Get the raw `gid_t` wrapped by `self`. + pub fn as_raw(&self) -> gid_t { + self.0 + } } impl From<Gid> for gid_t { @@ -123,6 +133,11 @@ impl Pid { pub fn parent() -> Self { getppid() } + + /// Get the raw `pid_t` wrapped by `self`. + pub fn as_raw(&self) -> pid_t { + self.0 + } } impl From<Pid> for pid_t { |