From a2e0c057bd9acd60b687ed8a2817d69be104d599 Mon Sep 17 00:00:00 2001 From: Paul Osborne Date: Thu, 27 Oct 2016 22:23:00 -0400 Subject: unistd: add setsid implementation This is a logical companion to setpgid, so adding an implementation. Signed-off-by: Paul Osborne --- src/unistd.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/unistd.rs') diff --git a/src/unistd.rs b/src/unistd.rs index 5ce002ba..36f72c31 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -117,6 +117,13 @@ pub fn setpgid(pid: pid_t, pgid: pid_t) -> Result<()> { Errno::result(res).map(drop) } +/// Create new session and set process group id (see +/// [setsid(2)](http://man7.org/linux/man-pages/man2/setsid.2.html)). +#[inline] +pub fn setsid() -> Result { + Errno::result(unsafe { libc::setsid() }) +} + #[cfg(any(target_os = "linux", target_os = "android"))] #[inline] pub fn gettid() -> pid_t { -- cgit v1.2.3