all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: sbaugh@catern.com
Cc: emacs-devel@gnu.org
Subject: Re: Using file descriptors in Emacs
Date: Sat, 10 Sep 2016 10:12:42 +0300	[thread overview]
Message-ID: <83oa3w8byt.fsf@gnu.org> (raw)
In-Reply-To: <87r38s4xmv.fsf@earth.catern.com> (sbaugh@catern.com)

> From: sbaugh@catern.com
> Date: Fri, 09 Sep 2016 16:38:16 -0400
> 
> >> Not as far as I know - what in my patches suggests that I need a pipe?
> >
> > A pipe is a set of 2 file descriptors between 2 programs, one of the
> > descriptors is used for reading by one program and writing by the
> > other, the other descriptor used similarly in the opposite direction.
> > Isn't that what you set up?
> >
> > If not, then I must be missing something, so please describe the data
> > flow between emacsclient, emacs server, and the external program.
> 
> There is not necessarily any external program. Even emacsclient can exit
> just fine once the file descriptors are passed in and a process object
> created from them.
> 
> Once a process object P is created, the data flow is as follows:
> 
> When emacs writes to P, emacs is directly writing to the file descriptor
> that emacsclient had as its stdout. It is literally calling "write" on
> the file descriptor that was/is emacsclient's stdout.
> 
> When emacs reads from P, emacs is directly reading from the file
> descriptor that emacsclient had as its stdin. It is literally calling
> "read" on the file descriptor that was/is emacsclient's stdin.

Emacs doesn't normally read or write from/to file descriptors.  The
only features that do such things are communications with
subprocesses, which could be either local subprocesses (in which case
Emacs talks to them via a pipe) or remote processes (in which case we
use network or serial connections).  One other kind of feature that
uses file descriptors is external data sources, such as D-Bus and
inotify, which are a kind of local process (the OS kernel or some
other daemon) that doesn't need to be run by Emacs, only communicated
with.

As we already have a framework for all of the above, what other kinds
of descriptors, which don't fit into the framework, would we like to
have?

> For example I would like to bring eshell up to par with other Unix
> shells, and the ability to manipulate file descriptors directly is
> pretty much required for that.

Please elaborate: how are file descriptors required for that?  A shell
needs to pass file descriptors to the subprocesses it invokes, which
AFAIK we already do in the primitives that invoke subprocesses.  What
else is needed, and how does the feature you propose fit into that?



  reply	other threads:[~2016-09-10  7:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07  1:25 Teaching emacsclient to act as a pager, and more Spencer Baugh
2016-06-07  1:25 ` [PATCH 1/5] process: add features for direct use of FDs Spencer Baugh
2016-06-07  1:25 ` [PATCH 2/5] server.el: accept FDs from emacsclient Spencer Baugh
2016-06-07  1:25 ` [PATCH 3/5] emacsclient: support passing stdin/out/err to emacs Spencer Baugh
2016-06-07  1:25 ` [PATCH 4/5] server: add pager tapping and show-active Spencer Baugh
2016-06-07  1:25 ` [PATCH 5/5] emacsclient: add extra-quiet mode Spencer Baugh
2016-06-08 15:51 ` Teaching emacsclient to act as a pager, and more Tassilo Horn
2016-06-08 16:13   ` Anders Lindgren
2016-06-08 17:30     ` Tassilo Horn
2016-06-09  0:25   ` raman
2016-06-09 11:31 ` H. Dieter Wilhelm
2016-06-27 22:42 ` Ole JørgenBrønner
2016-07-24 18:22 ` sbaugh
2016-09-09 13:42   ` Noam Postavsky
2016-09-09 14:14     ` sbaugh
2016-09-09 14:59       ` Stefan Monnier
2016-09-09 15:58         ` sbaugh
2016-09-09 19:26           ` Stefan Monnier
2016-09-09 19:42             ` Eli Zaretskii
2016-09-09 21:13             ` sbaugh
2016-09-10  6:37               ` Using file descriptors in Emacs (was: Teaching emacsclient to act as a pager, and more) Eli Zaretskii
2016-09-10 20:15             ` Teaching emacsclient to act as a pager, and more sbaugh
2016-09-11  2:11               ` Leo Liu
2018-02-16 23:14               ` Kaushal Modi
2018-02-17 15:46                 ` Göktuğ Kayaalp
2016-09-09 15:53       ` Eli Zaretskii
2016-09-09 17:16         ` sbaugh
2016-09-09 18:50           ` Eli Zaretskii
2016-09-09 19:03             ` sbaugh
2016-09-09 19:26               ` Eli Zaretskii
2016-09-09 20:38                 ` sbaugh
2016-09-10  7:12                   ` Eli Zaretskii [this message]
2016-09-10 14:28                     ` Using file descriptors in Emacs sbaugh
2016-09-11 15:28                       ` Eli Zaretskii
2016-09-11 16:00                         ` sbaugh
2016-09-11 16:39                           ` Eli Zaretskii
2016-09-11 16:57                             ` sbaugh
2016-09-11 17:13                               ` Eli Zaretskii
2016-09-12 15:40                               ` Davis Herring
2016-09-09 13:27 ` Teaching emacsclient to act as a pager, and more sbaugh

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83oa3w8byt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=sbaugh@catern.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.