Re: [patch] s_maxbytes handling

Stephen C. Tweedie (
Wed, 23 May 2001 19:02:22 +0100


On Tue, May 22, 2001 at 04:05:14PM +0100, Alan Cox wrote:

> > The s_maxbytes logic is different from the
> > MAX_NON_LFS logic:
> > if ( pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
> > if (pos >= MAX_NON_LFS) {
> > send_sig(SIGXFSZ, current, 0);
> > goto out;
> > }

> The spec says of write
> The file is a regular file, nbyte is greater than 0 and the
> starting position is greater than or equal to the offset
> maximum established in the open file description associated
> with fildes.
> Which seems to say to me that if we write > 0 bytes and we start at or
> on the boundary we should error - which would agree with your change.

SuS also states

If a write() requests that more bytes be written than there is room
for (for example, the ulimit or the physical end of a medium), only as
many bytes as there is room for will be written. For example, suppose
there is space for 20 bytes more in a file before reaching a limit. A
write of 512 bytes will return 20. The next write of a non-zero number
of bytes will give a failure return (except as noted below) and the
implementation will generate a SIGXFSZ signal for the thread.

so SIGXFSZ plus -EFBIG returned would appear to be the correct
behaviour. That's certainly what 2.2 used to when it encountered such

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at