Added BECOME-SESSION-LEADER.

This commit is contained in:
shivers 1995-10-26 13:35:40 +00:00
parent 4ae0a89c53
commit f244b7532f
2 changed files with 25 additions and 2 deletions

View File

@ -273,6 +273,19 @@ scheme_value df_setpgid(long nargs, scheme_value *args)
return ret1; 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) scheme_value df_umask(long nargs, scheme_value *args)
{ {

View File

@ -210,7 +210,8 @@
(define-foreign parent-pid (getppid) pid_t) (define-foreign parent-pid (getppid) pid_t)
;;; Process Groups -dalbertz ;;; Process groups and session ids
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-foreign process-group (getpgrp) pid_t) (define-foreign process-group (getpgrp) pid_t)
(define-foreign %set-process-group/errno (define-foreign %set-process-group/errno
@ -220,12 +221,22 @@
(define-simple-errno-syscall (%set-process-group pid pgrp) (define-simple-errno-syscall (%set-process-group pid pgrp)
%set-process-group/errno) %set-process-group/errno)
(define (set-process-group arg1 . maybe-arg2) (define (set-process-group arg1 . maybe-arg2)
(receive (pid pgrp) (if (null? maybe-arg2) (receive (pid pgrp) (if (null? maybe-arg2)
(values (pid) arg1) (values (pid) arg1)
(values arg1 (car maybe-arg2))) (values arg1 (car maybe-arg2)))
(%set-process-group pid pgrp))) (%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 ;;; UMASK
(define-foreign set-umask (umask (mode_t mask)) no-declare ; integer on SunOS (define-foreign set-umask (umask (mode_t mask)) no-declare ; integer on SunOS
@ -665,7 +676,6 @@
integer)) integer))
;;; Signals (rather incomplete) ;;; Signals (rather incomplete)
;;; --------------------------- ;;; ---------------------------