From: Taylor R. Campbell Date: Sun, 29 Oct 2006 17:25:15 +0000 (+0000) Subject: Redefine `UX_vfork' to be `fork' on OS X, because setsid and others are X-Git-Tag: 20090517-FFI~857 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=bb34801dd63e0f02d1c49ad0bb0b1a874f39da8e;p=mit-scheme.git Redefine `UX_vfork' to be `fork' on OS X, because setsid and others are not allowed in vforked processes. Always check the value of setsid, since it should work on OS X now that we use fork there instead of vfork. --- diff --git a/v7/src/microcode/ux.h b/v7/src/microcode/ux.h index 568b091fa..2732f9f49 100644 --- a/v7/src/microcode/ux.h +++ b/v7/src/microcode/ux.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ux.h,v 1.79 2006/09/16 11:19:09 gjr Exp $ +$Id: ux.h,v 1.80 2006/10/29 17:25:15 riastradh Exp $ Copyright 1990,1991,1992,1993,1994,1995 Massachusetts Institute of Technology Copyright 1996,1997,1998,1999,2000,2003 Massachusetts Institute of Technology @@ -736,6 +736,13 @@ extern int EXFUN (UX_terminal_set_state, (int, Ttty_state *)); extern int EXFUN (UX_tcsetpgrp, (int, pid_t)); # define EMULATE_TCSETPGRP #endif + +/* In Darwin, setsid doesn't work in vforked processes, + so force the use of fork instead. */ +#ifdef __APPLE__ +# undef UX_vfork +# define UX_vfork fork +#endif #ifdef HAVE_SIGACTION diff --git a/v7/src/microcode/uxproc.c b/v7/src/microcode/uxproc.c index a814351c8..e4e7fbc15 100644 --- a/v7/src/microcode/uxproc.c +++ b/v7/src/microcode/uxproc.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: uxproc.c,v 1.30 2006/09/16 11:19:09 gjr Exp $ +$Id: uxproc.c,v 1.31 2006/10/29 17:25:15 riastradh Exp $ Copyright (c) 1990-2001, 2006 Massachusetts Institute of Technology @@ -335,12 +335,8 @@ DEFUN (OS_make_subprocess, { /* If the control terminal is not inherited, force the child into a different session. */ -#ifdef __APPLE__ - UX_setsid (); -#else if ((UX_setsid ()) < 0) goto kill_child; -#endif /* If the control terminal is explicit, open the given device now so it becomes the control terminal. */ if (ctty_type == process_ctty_type_explicit)