comments on proposed uthread_write.c changes

Kern Sibbald kern at sibbald.com
Wed Sep 10 00:19:57 PDT 2003


Hello,

On Wed, 2003-09-10 at 02:34, Garrett Wollman wrote:
> <<On Tue, 9 Sep 2003 19:46:12 -0400 (EDT), Daniel Eischen <eischen at vigrid.com> said:
> 
> >   Libc_r's write treats a return of 0 from __sys_write() as a
> >   partial write and continues looping.
> 
> This is a bug.  The Standard is quite clear that a write of zero bytes
> is not possible unless the supplied buffer length is zero.  In the
> specific case of non-blocking files, if data might be written but
> doing so would cause the calling thread to block, write() must return
> -1 with errno set to [EAGAIN]; it may not return zero.  Therefore, a
> zero return from write() always indicates a permanent condition.
> 
> -GAWollman

Can you explain how you came to the conclusion that a non-zero
write may not return zero?  Keep in mind that from the
user's or my standpoint, we are talking about blocking
writes.

In reading the standard, the paragraph cited below permits a
zero to be returned. 

    If a write() requests that more bytes be written than there is room
for (for example, [XSI] [Option Start]  the process' file size limit    
or [Option End] the physical end of a medium), only as many bytes     as
there is room for shall be written.



Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-standards/attachments/20030910/0c3c050a/attachment.bin


More information about the freebsd-standards mailing list