From: Alan Third <alan@idiocy.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 26397@debbugs.gnu.org
Subject: bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397)
Date: Sun, 9 Apr 2017 20:18:49 +0100 [thread overview]
Message-ID: <20170409191849.GA67152@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAHyO48zGKz2zXAbAQSD4np2NLb13J9NVDPVXg6CraPMVQvb20Q@mail.gmail.com>
src/conf_post.h: Remove defines forcing use of fork.
src/process.c (create_process): Use fork if pty_flag is set, otherwise
vfork.
---
src/conf_post.h | 6 ------
src/process.c | 9 +++++++++
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/conf_post.h b/src/conf_post.h
index 30c948e39a..95ebd5511c 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -99,12 +99,6 @@ typedef bool bool_bf;
#define realloc unexec_realloc
#define free unexec_free
#endif
-/* The following solves the problem that Emacs hangs when evaluating
- (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
- does not exist. Also, setsid is not allowed in the vfork child's
- context as of Darwin 9/Mac OS X 10.5. */
-#undef HAVE_WORKING_VFORK
-#define vfork fork
#endif /* DARWIN_OS */
/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
diff --git a/src/process.c b/src/process.c
index 2f2e5c1b25..47a85f1c95 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2049,7 +2049,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
int volatile forkerr_volatile = forkerr;
struct Lisp_Process *p_volatile = p;
+#ifdef DARWIN_OS
+ /* Darwin doesn't let us run setsid after a vfork, so use fork when
+ necessary. */
+ if (pty_flag)
+ pid = fork ();
+ else
+ pid = vfork ();
+#else
pid = vfork ();
+#endif
current_dir = current_dir_volatile;
lisp_pty_name = lisp_pty_name_volatile;
--
Here’s a tidied up version. If nobody complains I’ll push it in a few
days.
Thanks for your help.
--
Alan Third
next prev parent reply other threads:[~2017-04-09 19:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-08 6:25 bug#26397: 25.1; call-process slow on macOS and slower on larger frames Aaron Jensen
2017-04-08 7:37 ` YAMAMOTO Mitsuharu
2017-04-08 15:47 ` Aaron Jensen
2017-04-08 19:19 ` Alan Third
2017-04-09 13:01 ` Alan Third
2017-04-09 15:07 ` Aaron Jensen
2017-04-09 19:18 ` Alan Third [this message]
2017-04-09 20:32 ` bug#26397: [PATCH] Use vfork if possible on Darwin (bug#26397) Andreas Schwab
2017-04-09 21:34 ` Alan Third
2017-04-09 23:46 ` YAMAMOTO Mitsuharu
2017-04-10 0:06 ` Aaron Jensen
2017-04-10 1:11 ` YAMAMOTO Mitsuharu
2017-04-10 4:13 ` Aaron Jensen
2017-04-10 15:42 ` bug#26397: [PATCH v2] " Alan Third
2017-04-11 7:06 ` YAMAMOTO Mitsuharu
2017-04-18 2:29 ` Aaron Jensen
2017-04-18 10:48 ` Alan Third
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170409191849.GA67152@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=26397@debbugs.gnu.org \
--cc=aaronjensen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).