[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397)
From: |
YAMAMOTO Mitsuharu |
Subject: |
bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397) |
Date: |
Mon, 10 Apr 2017 10:11:16 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Sun, 9 Apr 2017 17:06:21 -0700, Aaron Jensen <aaronjensen@gmail.com>
>>>>> said:
> For me, this slows down call-process in TTY emacs by 3ms (from
> 2.5ms->5.5ms). I typically launch a GUI emacs and connect to the
> server in TTY via emacsclient, and in that scenario this patch does
> not slow down call-process in the TTY, but it will affect those who
> use TTY only, it seems.
Then use "obsolete" ioctl TIOCNOTTY instead of setsid? I'm not
familiar with this matter, so could someone check if this is OK? I
confirmed that only the controlling terminal of the child process was
detached.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
diff --git a/src/callproc.c b/src/callproc.c
index 05048576ce..3f6df422f3 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/>. */
#include "syswait.h"
#include "blockinput.h"
#include "frame.h"
+#include "systty.h"
+#include "keyboard.h"
#ifdef MSDOS
#include "msdos.h"
@@ -626,7 +628,18 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int
filefd,
{
unblock_child_signal (&oldset);
+#ifdef DARWIN_OS
+ /* Darwin doesn't let us run setsid after a vfork, so use
+ TIOCNOTTY when necessary. */
+ int j = emacs_open (DEV_TTY, O_RDWR, 0);
+ if (j >= 0)
+ {
+ ioctl (j, TIOCNOTTY, 0);
+ emacs_close (j);
+ }
+#else
setsid ();
+#endif
/* Emacs ignores SIGPIPE, but the child should not. */
signal (SIGPIPE, SIG_DFL);
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, (continued)
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, YAMAMOTO Mitsuharu, 2017/04/08
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, Aaron Jensen, 2017/04/08
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, Alan Third, 2017/04/08
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, Alan Third, 2017/04/09
- bug#26397: 25.1; call-process slow on macOS and slower on larger frames, Aaron Jensen, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), Alan Third, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), Andreas Schwab, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), Alan Third, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), YAMAMOTO Mitsuharu, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), Aaron Jensen, 2017/04/09
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397),
YAMAMOTO Mitsuharu <=
- bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397), Aaron Jensen, 2017/04/10
- bug#26397: [PATCH v2] Use vfork if possible on Darwin (bug#26397), Alan Third, 2017/04/10
- bug#26397: [PATCH v2] Use vfork if possible on Darwin (bug#26397), YAMAMOTO Mitsuharu, 2017/04/11
- bug#26397: [PATCH v2] Use vfork if possible on Darwin (bug#26397), Aaron Jensen, 2017/04/17
- bug#26397: [PATCH v2] Use vfork if possible on Darwin (bug#26397), Alan Third, 2017/04/18