emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 2c79a8f 2/2: Use posix_spawn if possible.


From: Philipp Stephani
Subject: Re: master 2c79a8f 2/2: Use posix_spawn if possible.
Date: Thu, 31 Dec 2020 17:24:41 +0100

Am Di., 29. Dez. 2020 um 17:43 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
> Am Sa., 26. Dez. 2020 um 13:16 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
> >
> > > Date: Sat, 26 Dec 2020 14:08:11 +0200
> > > From: Eli Zaretskii <eliz@gnu.org>
> > > Cc: emacs-devel@gnu.org
> > >
> > > See Savannah bug #59093 for one subtle issue:
> > >
> > >   https://savannah.gnu.org/bugs/?59093
> > >
> > > Since Emacs also sets its stack limit in some cases, this could be
> > > directly relevant to us.  (But I didn't look into it close enough to
> > > tell whether it actually is relevant.)
> >
> > Btw, given this condition for using posix_spawn:
> >
> >   +  /* `posix_spawn' doesn't yet support setting up pseudoterminals, so
> >   +     we fall back to `vfork' if we're supposed to use a
> >   +     pseudoterminal.  */
> >   +
> >   +  bool use_posix_spawn = can_use_posix_spawn && pty == NULL;
> >
> > I understand that the absolute majority of subprocesses on GNU and
> > Posix platforms will not use posix_spawn, because we usually do use
> > PTYs?  If so, one wonders why it is a good idea to complicate our code
> > and make it more dependent on Gnulib, for such small gains?  Should we
> > perhaps wait until posix_spawn does support PTYs?
>
> I think posix_spawn supports TTYs well enough by now. From what I see
> in the code we perform 5 TTY-related actions between fork and exec:
> [...]
> 2. Making the TTY the controlling terminal of the process. IIUC we
> first try using TIOCSCTTY, and then opening the TTY file without
> O_NOCTTY. On GNU/Linux, the former one probably fails because stdin is
> -1. So we could only do the latter one, which is supported by
> posix_spawn (since it's just opening a file).

The annoying thing about this, though, is that it doesn't work on the
BSDs (including macOS). For pty processes on those systems we'll have
to continue using fork/vfork for the time being.
I think that using posix_spawn on GNU/Linux and for non-pty processes
is still a significant win, though.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]