From f244b7532ff0df61fb0675ea02089660e1f7f676 Mon Sep 17 00:00:00 2001 From: shivers Date: Thu, 26 Oct 1995 13:35:40 +0000 Subject: [PATCH] Added BECOME-SESSION-LEADER. --- scsh/syscalls.c | 13 +++++++++++++ scsh/syscalls.scm | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scsh/syscalls.c b/scsh/syscalls.c index 153f7cb..75f636c 100644 --- a/scsh/syscalls.c +++ b/scsh/syscalls.c @@ -273,6 +273,19 @@ scheme_value df_setpgid(long nargs, scheme_value *args) return ret1; } +scheme_value df_setsid(long nargs, scheme_value *args) +{ + extern pid_t setsid(void); + scheme_value ret1; + pid_t r1; + + cig_check_nargs(1, nargs, "setsid"); + r1 = setsid(); + ret1 = errno_or_false(r1); + VECTOR_REF(*args,0) = ENTER_FIXNUM(r1); + return ret1; + } + scheme_value df_umask(long nargs, scheme_value *args) { diff --git a/scsh/syscalls.scm b/scsh/syscalls.scm index a6fdf94..1c91249 100644 --- a/scsh/syscalls.scm +++ b/scsh/syscalls.scm @@ -210,7 +210,8 @@ (define-foreign parent-pid (getppid) pid_t) -;;; Process Groups -dalbertz +;;; Process groups and session ids +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-foreign process-group (getpgrp) pid_t) (define-foreign %set-process-group/errno @@ -220,12 +221,22 @@ (define-simple-errno-syscall (%set-process-group pid pgrp) %set-process-group/errno) + (define (set-process-group arg1 . maybe-arg2) (receive (pid pgrp) (if (null? maybe-arg2) (values (pid) arg1) (values arg1 (car maybe-arg2))) (%set-process-group pid pgrp))) + +(define-foreign become-session-leader/errno (setsid) + (multi-rep (to-scheme pid_t errno_or_false) + pid_t)) + +(define-errno-syscall (become-session-leader) become-session-leader/errno + sid) + + ;;; UMASK (define-foreign set-umask (umask (mode_t mask)) no-declare ; integer on SunOS @@ -665,7 +676,6 @@ integer)) - ;;; Signals (rather incomplete) ;;; ---------------------------