[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
iovec member reuse
Query: is it safe to re-use an iovec array without re-initialising it?
What I mean is in the following scenario:
hdr.type = xx;
hdr.len = sizeof(body);
iov.iov_base = &hdr;
iov.iov_len = sizeof(hdr);
iov.iov_base = body;
iov.iov_len = sizeof(body);
for (hdr.id = 0; hdr.id < 5; hdr.id++)
writev(fd, iov, 2);
Is it ok to assume that the iovec array is not being modified inside the
writev function and that the output will be five complete packets with
increasing id fields?
It certainly seems to be the case on NetBSD and the manpage says nothing
about it (nor does opengroup specification page) and I'm thinking that
principle of least surprise should apply, in that where no side effects
are mentioned, there should be none..
Main Index |
Thread Index |