[lxc-devel] [PATCH 4/5 v2] Implement simple utility functions for reading and writing to fds

Christian Seiler christian at iwakd.de
Mon May 20 18:20:59 UTC 2013


Hi,

> These routines will be good to have. I think your names are fine, but
> thought I'd point that out that there seems to be some sort of
> convention in other projects I've seen to name them safe_read(),
> safe_write(). They are usually accompanied by full_read() and
> full_write() which handle short return counts as well.

I've seen _nointr as well, but I don't really care.

Regarding full variants: lxc-attach only transfers miniscule amounts of
data (pid_t and int are at most 8 bytes long on any architecture I know,
usually only 4) in one call, so that should never be split up by the
kernel, especially if the fds are blocking. But I have no objection to
adding additional variants for transfering more data.

> Also, it might be good to have their return type be ssize_t to match
> actual read(3) and write(3). Thanks!

I've attached an updated version of this specific patch with the fixed
return values.

(The other patches should still apply regardless.)

-- Christian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0004-Implement-simple-utility-functions-for-reading-and-w.patch.txt
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130520/2666e9fd/attachment.txt>


More information about the lxc-devel mailing list