[ace-users] ACE_OS::sendv() behavior question concerning
partial writes
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Fri Aug 24 10:18:31 CDT 2007
Hi Olivier,
To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form (PRF),
which is in
$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM
or in
$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM
in older versions of ACE+TAO. Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness. If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
to.
> By looking at the ACE::sendv_n_i() code, I have found out that
> writev() can perform partial writes. I am surprised of that behavior
> because in the book Unix network programming vol. 1, second edition,
> it is written that writev() is an atomic operation.
I don't think that's correct. Please see the official documentation for
writev() at
http://www.opengroup.org/onlinepubs/009695399/functions/writev.html
and look at this statement:
"Upon successful completion, writev() shall return the number of bytes
actually written. Otherwise, it shall return a value of -1, the
file-pointer shall remain unchanged, and errno shall be set to indicate
an error."
> My understanding of what an atomic operation is, is that it either
> writes all the data or it does not write anything but obviously in the
> writev() context, atomic operation means something else.
Can you please provide the quote from the UNPv1 book that you're
referring to?
> So I would like to ask this group what atomic operation means for
> writev() and besides if ACE_IOV_MAX is defined what are the conditions
> with a non blocking stream socket that could result in a writev()
> partial write?
I suspect it's the usual suspects, e.g, a flow controlled connection
that leads to "short writes". Please see
http://www.linuxjournal.com/comment/reply/2333
for a summary of why short writes can occur.
Thanks,
Doug
More information about the Ace-users
mailing list