Re: manipulating sigmask from filesystems and drivers

yodaiken@fsmlabs.com
Fri, 2 Aug 2002 09:59:37 -0600


On Thu, Aug 01, 2002 at 03:40:56PM -0700, Linus Torvalds wrote:
>
> On Thu, 1 Aug 2002, David Woodhouse wrote:
> >
> > torvalds@transmeta.com said:
> > > Any regular file IO is supposed to give you the full result.
> >
> > read(2) is permitted to return -EINTR.
>
> It is _not_ allowed to do that for regular UNIX filesystems.
>

SusV2 and POSIX seem to have changed the prior standard

The value returned may be less than nbyte if the number of bytes
left in the file is less than nbyte, if the read() request was
interrupted by a signal, or if the file is a pipe or FIFO or
special file and has fewer than nbyte bytes immediately available
for reading.

The rationale mentions that
while( read(...) > 0)
must work
but, I think Linus is correct that many programs rely on
while( read(fd,&b,n) == n)

------------------susv2

If a read() is interrupted by a signal before it reads any data, it
will return -1 with errno set to [EINTR].

If a read() is interrupted by a signal after it has successfully
read some data, it will return the number of bytes read.
----------------------

The grim effects of "cancel" spread through the system.

-------------------------------------
The transitive closure of a design error is limited only by the size of
the program.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/