Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Konstantin Osipov <kostja.osipov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v6 2/4] popen: Introduce a backend engine
Date: Thu, 9 Jan 2020 14:23:32 +0300	[thread overview]
Message-ID: <20200109112332.GD2436@uranus> (raw)
In-Reply-To: <20191226071441.GB6901@atlas>

On Thu, Dec 26, 2019 at 10:14:41AM +0300, Konstantin Osipov wrote:
> * Cyrill Gorcunov <gorcunov@gmail.com> [19/12/17 15:57]:
> > +ssize_t
> > +popen_read_timeout(struct popen_handle *handle, void *buf,
> > +		   size_t count, unsigned int flags,
> > +		   ev_tstamp timeout)
> > +{
> > +	int idx = flags & POPEN_FLAG_FD_STDOUT ?
> > +		STDOUT_FILENO : STDERR_FILENO;
> > +
> > +	if (!popen_may_io(handle, idx, flags))
> > +		return -1;
> > +
> > +	if (count > (size_t)SSIZE_MAX) {
> > +		errno = E2BIG;
> > +		return -1;
> > +	}
> > +
> > +	if (timeout < 0.)
> > +		timeout = TIMEOUT_INFINITY;
> > +
> > +	say_debug("popen: %d: read idx [%s:%d] buf %p count %zu "
> > +		  "fds %d timeout %.9g",
> > +		  handle->pid, stdX_str(idx), idx, buf, count,
> > +		  handle->fds[idx], timeout);
> > +
> > +	return coio_read_fd_timeout(handle->fds[idx],
> > +				    buf, count, timeout);
> > +}
> 
> Right, so could you please use struct coio here, and not
> coio_read_fd_timeout? I.e. convert handle->fds to coio?

Kostya, could you please elaborate this moment, since I
suspect I'm missing something.

1) coio service data, such as coio_wdata, coio_wait_cb is
   static to coio.cc file, you propose to make it exportable
   to other parts of tarantool code?

2) the case where timeout is really needed is when pipes
   are either empty (thus we will wait with timout until
   data appear, and adding fd into event loop doesn't look
   like a hot path) or full (where we will wait for data
   to be read first by another peer).

3) assuming we somehow exported data from (1) I don't really
   see how could we code the way we would put fd into backend
   once for all timelife of the popen object. Could you point
   please?

  parent reply	other threads:[~2020-01-09 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 12:54 [Tarantool-patches] [PATCH v6 0/4] popen: Add ability to run external process Cyrill Gorcunov
2019-12-17 12:54 ` [Tarantool-patches] [PATCH v6 1/4] coio: Export helpers and provide coio_read_fd_timeout Cyrill Gorcunov
2019-12-20  7:48   ` Konstantin Osipov
2019-12-20 14:50     ` Cyrill Gorcunov
2019-12-17 12:54 ` [Tarantool-patches] [PATCH v6 2/4] popen: Introduce a backend engine Cyrill Gorcunov
2019-12-20  8:11   ` Konstantin Osipov
2019-12-20 11:52     ` Cyrill Gorcunov
2019-12-20 12:04       ` Konstantin Osipov
2019-12-20 12:10         ` Cyrill Gorcunov
2019-12-20 12:11     ` Alexander Turenko
2019-12-26  7:14   ` Konstantin Osipov
2019-12-26  7:19     ` Cyrill Gorcunov
2020-01-09 11:23     ` Cyrill Gorcunov [this message]
2019-12-17 12:54 ` [Tarantool-patches] [PATCH v6 3/4] popen/lua: Add popen module Cyrill Gorcunov
2019-12-20 15:41   ` Maxim Melentiev
2019-12-17 12:54 ` [Tarantool-patches] [PATCH v6 4/4] popen/test: Add base test cases Cyrill Gorcunov

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=20200109112332.GD2436@uranus \
    --to=gorcunov@gmail.com \
    --cc=kostja.osipov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v6 2/4] popen: Introduce a backend engine' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox