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 17:17:52 +0000 (UTC) (Christos Zoulas) wrote:

> if you are going to build that, then it is probably easier to include
> all the info in the iovec:
> struct iovec2 {
>       int iov_fd;
>       int iov_errno;
>       ssize_t iov_nwritten;
>       void *iov_base;
>       size_t iov_len;
> };
> int writev2(const struct iovec2 *iov, size_t iovcnt);
> And then you have to define the semantics of what to do on error
> (continue with the next fd or abort). It is pretty simple to write
> otherwise, since you can just call the old writev call in a loop for
> each...
> christos

struct fdvec
        int fd;
        int errno;
        ssize_t nwritten;
        struct iovec *iov;
        int iovcnt;

int writev2(struct fdvec *fdv, int fdvcnt);

This way each fdvec structure can have iov pointer pointing the same or
different iovec structures. So you could call writev2() to copy the
same or different data to multiple file descriptors.

Home | Main Index | Thread Index | Old Index