summaryrefslogtreecommitdiff
path: root/src/unistd.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd.rs')
-rw-r--r--src/unistd.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/unistd.rs b/src/unistd.rs
index 85cec3da..c3b2b61e 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -1236,6 +1236,26 @@ pub fn getegid() -> Gid {
Gid(unsafe { libc::getegid() })
}
+/// Set the effective user ID
+///
+/// See also [seteuid(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/seteuid.html)
+#[inline]
+pub fn seteuid(euid: Uid) -> Result<()> {
+ let res = unsafe { libc::seteuid(euid.into()) };
+
+ Errno::result(res).map(drop)
+}
+
+/// Set the effective group ID
+///
+/// See also [setegid(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setegid.html)
+#[inline]
+pub fn setegid(egid: Gid) -> Result<()> {
+ let res = unsafe { libc::setegid(egid.into()) };
+
+ Errno::result(res).map(drop)
+}
+
/// Set the user ID
///
/// See also [setuid(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html)
@@ -1246,7 +1266,7 @@ pub fn setuid(uid: Uid) -> Result<()> {
Errno::result(res).map(drop)
}
-/// Set the user ID
+/// Set the group ID
///
/// See also [setgid(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setgid.html)
#[inline]