summaryrefslogtreecommitdiff
path: root/src/unistd.rs
diff options
context:
space:
mode:
authorPaul Osborne <osbpau@gmail.com>2016-10-27 22:23:00 -0400
committerPaul Osborne <osbpau@gmail.com>2016-10-27 22:23:00 -0400
commita2e0c057bd9acd60b687ed8a2817d69be104d599 (patch)
treecb64130a7cbe38b556c8219cd746828b5fc31752 /src/unistd.rs
parenteba38be7f5ff191954a76171da99da7baeaa1eb2 (diff)
downloadnix-a2e0c057bd9acd60b687ed8a2817d69be104d599.zip
unistd: add setsid implementation
This is a logical companion to setpgid, so adding an implementation. Signed-off-by: Paul Osborne <osbpau@gmail.com>
Diffstat (limited to 'src/unistd.rs')
-rw-r--r--src/unistd.rs7
1 files changed, 7 insertions, 0 deletions
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<pid_t> {
+ Errno::result(unsafe { libc::setsid() })
+}
+
#[cfg(any(target_os = "linux", target_os = "android"))]
#[inline]
pub fn gettid() -> pid_t {