changeset 39976 | 44840bcc411a |
parent 39973 | ba447b83cd56 |
child 40120 | 89742f1fa6cb |
--- a/rust/chg/src/procutil.rs Mon Sep 24 18:21:10 2018 +0900 +++ b/rust/chg/src/procutil.rs Mon Sep 24 18:33:46 2018 +0900 @@ -15,6 +15,11 @@ fn sendfds(sockfd: c_int, fds: *const c_int, fdlen: size_t) -> ssize_t; } +/// Returns the effective uid of the current process. +pub fn get_effective_uid() -> u32 { + unsafe { libc::geteuid() } +} + /// Changes the given fd to blocking mode. pub fn set_blocking_fd(fd: RawFd) -> io::Result<()> { let flags = unsafe { libc::fcntl(fd, libc::F_GETFL) };