[Tarantool-patches] [PATCH 1/5] popen: Introduce a backend engine
Konstantin Osipov
kostja.osipov at gmail.com
Fri Nov 29 08:59:39 MSK 2019
* Cyrill Gorcunov <gorcunov at gmail.com> [19/11/28 23:46]:
> +/**
> + * popen_write - write data to the child stdin
> + * @handle: popen handle
> + * @buf: data to write
> + * @count: number of bytes to write
> + * @flags: a flag representing stdin peer
> + *
> + * Returns number of bytes written or -1 on error.
> + */
> +ssize_t
> +popen_write(struct popen_handle *handle, void *buf,
> + size_t count, unsigned int flags)
> +{
> + if (!popen_may_io(handle, STDIN_FILENO, flags))
> + return -1;
> +
> + say_debug("popen: %d: write idx %d",
> + handle->pid, STDIN_FILENO);
> +
> + return write(handle->fds[STDIN_FILENO], buf, count);
I don't understand, is this blocking or not?
If this is blocking, where is it supposed to be called from?
Shouldn't you be using a non-blocking I/O like coio does?
Besides, even though I realize it's a pipe, so real world
return values may be different, but write() can return a partial
result even in blocking mode. Why did you choose to design an API
which will require caller to handle partial writes?
--
Konstantin Osipov, Moscow, Russia
More information about the Tarantool-patches
mailing list