Re: cvs commit: src/lib/libc_r/uthread uthread_write.c

From: Bruce Evans <bde_at_zeta.org.au>
Date: Thu, 18 Dec 2003 16:53:37 +1100 (EST)
On Wed, 17 Dec 2003, Nate Lawson wrote:

> On Wed, 17 Dec 2003, Daniel Eischen wrote:
> > On Wed, 17 Dec 2003, Nate Lawson wrote:
> > > On Wed, 17 Dec 2003, Daniel Eischen wrote:
> > > > Does this fix something other than bacula?
> > >
> > > Anyone else who expected this semantics.  I have no specific examples.
> >
> > I think it probably only pertinent to writing to tape devices
> > where a 0 return means end of tape.  Otherwise you should

Do mean "writing to tape devices with a broken device driver that
returns 0 to mean end of tape".  POSIX seems to be clear enough saying
that write() returns -1 except on successful completion.  I don't
believe write() with a nonzero count is successful if it can write
nothing.

> > get -1 with an appropriate errno or just wait until all
> > the requested data has been written.
> >
> > I asked if this fixed something because I was asked if this
> > was a 5.2R candidate.
>
> Oh, I thought it mattered for people doing non-blocking writes from a
> thread also.

Non-blocking writes (if supported by whatever is behind the file descriptor)
are required to return -1 and EAGAIN if they don't succeed.  Historical
implementations returned 0, but this was fixed in the first version of
POSIX.1.

Bruce
Received on Wed Dec 17 2003 - 21:53:51 UTC