tech-kern archive

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

Re: Writing to multiple descriptors with one system call



On Wed, Mar 17, 2010 at 01:10:44PM +0000, Sad Clouds wrote:
> On Wed, 17 Mar 2010 12:50:51 +0000
> Sad Clouds <cryintothebluesky%googlemail.com@localhost> wrote:
> 
> > Hi is there some undocumented system call that allows a user process
> > to write to multiple descriptors in one go?

Do you have a real world use for that?  For instance, I wouldn't call a
web server that sends the same data to all its clients *at the same
time* realistic.

> > What I'm looking for is a variation of writev() system call, e.g.:
> > 
> > size_t write2v(int *d, int dcnt, const struct iovec *iov, int iovcnt);
> > 
> > So the application builds an array of file descriptors and an array of
> > iovec structures. It then calls write2v(), which goes through each
> > file descriptor and writes buffers from iovec structures.
> > 
> 
> On second thoughts, there needs to be a way to handle partial writes

What do you do when you get EIO for the first fd, EPIPE for the second,
EFBIG for the third, EINTR for the fourth and an undefined return status
for the 4996 that follow?  (I guess on a socket you might only get EIO,
ENOSPC and EINTR, but you get the idea.)

-- 
Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgpDm8SouAP9P.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index