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, 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?
> 
> 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

struct fdvec
{
        int fd;
        size_t nwritten;
};

int write2v(
        struct fdvec *fdv, int fdvcnt, const struct iovec *iov, int iovcnt);

For each file descriptor, the function sets nwritten to the number of
bytes written. It returns 0 when all buffers in iovec structures were
written to all file descriptors, otherwise it returns >0 for each file
descriptor that was partially written.


Home | Main Index | Thread Index | Old Index