lkml.org 
[lkml]   [2001]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] s_maxbytes handling
Alan Cox wrote:
>
> > If ->f_pos is positioned exactly at sb->s_maxbytes, a non-zero-length
> > write to the file doesn't write anything, and write() returns zero.
>
> Are you absolutely sure here. Because I ran that code through a set of standards
> verification tests. So unless you can cite page and paragraph from SuS and
> the LFS spec I think the 0 might in fact be correct..

I don't know the standards Alan, but returning zero
from write() when f_pos is at s_maxbytes will make
a lot of apps hang up. dd, bash and zsh certainly do.

Are they buggy? Should they be testing the return value
of write() and assuming that zero is file-full?

The s_maxbytes logic is different from the
MAX_NON_LFS logic:

/*
* LFS rule
*/
if ( pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
if (pos >= MAX_NON_LFS) {
send_sig(SIGXFSZ, current, 0);
goto out;
}

This makes more sense. If the file is full, and
you're trying to grow it, you fail.
-
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/

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.048 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site