summaryrefslogtreecommitdiff
path: root/libguile/posix.c
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2009-12-27 16:59:54 +0000
committerNeil Jerram <neil@ossau.uklinux.net>2009-12-27 16:59:54 +0000
commit3e5aed1c3be296b92f3a21e0dfde315deaef9daa (patch)
tree826150939f1707e036247d4de5f2bce632ea264e /libguile/posix.c
parent0ca3a342d19ec89b8ae6bba0a74f0f9ecc5cf7c2 (diff)
downloadguile-3e5aed1c3be296b92f3a21e0dfde315deaef9daa.tar.gz
Add support for getsid
* configure.ac: Check availability of getsid() C library call. * libguile/posix.c (scm_getsid): New primitive. * libguile/posix.h: Declaration for new primitive.
Diffstat (limited to 'libguile/posix.c')
-rw-r--r--libguile/posix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libguile/posix.c b/libguile/posix.c
index 5187ff943..ef52c38f6 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -983,6 +983,18 @@ SCM_DEFINE (scm_setsid, "setsid", 0, 0, 0,
#undef FUNC_NAME
#endif /* HAVE_SETSID */
+#ifdef HAVE_GETSID
+SCM_DEFINE (scm_getsid, "getsid", 1, 0, 0,
+ (SCM pid),
+ "Returns the session ID of process @var{pid}. (The session\n"
+ "ID of a process is the process group ID of its session leader.)")
+#define FUNC_NAME s_scm_getsid
+{
+ return scm_from_int (getsid (scm_to_int (pid)));
+}
+#undef FUNC_NAME
+#endif /* HAVE_GETSID */
+
/* ttyname returns its result in a single static buffer, hence
scm_i_misc_mutex for thread safety. In glibc 2.3.2 two threads