aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorAlan Third2017-04-09 20:10:33 +0100
committerAlan Third2017-04-18 11:42:30 +0100
commita13eaddce2ddbe3ba0b7f4c81715bc0fcdba99f6 (patch)
tree5bf3f0b8fbd2187bb5e08261f29811ea269d4a33 /src/callproc.c
parent4ad6be65f68a5c875ecbaa9e66d8ced28f43670a (diff)
downloademacs-a13eaddce2ddbe3ba0b7f4c81715bc0fcdba99f6.tar.gz
emacs-a13eaddce2ddbe3ba0b7f4c81715bc0fcdba99f6.zip
Use vfork if possible on Darwin (bug#26397)
Co-authored-by: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * src/conf_post.h (HAVE_WORKING_VFORK): Don't undef. (vfork): Don't define. * src/process.c (create_process) [DARWIN_OS]: Use fork if pty_flag is set, otherwise vfork. * src/callproc.c (call_process) [DARWIN_OS]: Use TIOCNOTTY to detach the controlling terminal instead of setsid.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 05048576ce9..792556c8e02 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -52,6 +52,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
52#include "syswait.h" 52#include "syswait.h"
53#include "blockinput.h" 53#include "blockinput.h"
54#include "frame.h" 54#include "frame.h"
55#include "systty.h"
56#include "keyboard.h"
55 57
56#ifdef MSDOS 58#ifdef MSDOS
57#include "msdos.h" 59#include "msdos.h"
@@ -626,7 +628,18 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
626 { 628 {
627 unblock_child_signal (&oldset); 629 unblock_child_signal (&oldset);
628 630
631#ifdef DARWIN_OS
632 /* Darwin doesn't let us run setsid after a vfork, so use
633 TIOCNOTTY when necessary. */
634 int j = emacs_open (DEV_TTY, O_RDWR, 0);
635 if (j >= 0)
636 {
637 ioctl (j, TIOCNOTTY, 0);
638 emacs_close (j);
639 }
640#else
629 setsid (); 641 setsid ();
642#endif
630 643
631 /* Emacs ignores SIGPIPE, but the child should not. */ 644 /* Emacs ignores SIGPIPE, but the child should not. */
632 signal (SIGPIPE, SIG_DFL); 645 signal (SIGPIPE, SIG_DFL);