diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-10-03 22:25:51 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-10-03 22:25:51 +0000 |
commit | c5bccf11cc7e4d05f09e726ee9d2afffe00b3309 (patch) | |
tree | 1300dab18cf23d86b5339b92b3bfef81d626cf86 | |
parent | 1d4ac49f9db4c81c07e6bfec6c3bfe039901af19 (diff) | |
download | coreutils-c5bccf11cc7e4d05f09e726ee9d2afffe00b3309.tar.xz |
* src/system.h (ST_BLKSIZE): Ceiling at SIZE_MAX / 8 + 1, not at 4
MiB, since XFS hosts can legitimately have large values of
st_blksize. Problem reported by Tony Ernst in
<http://savannah.gnu.org/bugs/?17903>.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/system.h | 11 |
2 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2006-10-03 Paul Eggert <eggert@cs.ucla.edu> + + * src/system.h (ST_BLKSIZE): Ceiling at SIZE_MAX / 8 + 1, not at 4 + MiB, since XFS hosts can legitimately have large values of + st_blksize. Problem reported by Tony Ernst in + <http://savannah.gnu.org/bugs/?17903>. + 2006-10-04 Jim Meyering <jim@meyering.net> * src/remove.c (nonexistent_file_errno): Remove ENAMETOOLONG. diff --git a/src/system.h b/src/system.h index 56636c735..29d170fd3 100644 --- a/src/system.h +++ b/src/system.h @@ -206,11 +206,14 @@ enum /* Some systems, like Sequents, return st_blksize of 0 on pipes. Also, when running `rsh hpux11-system cat any-file', cat would determine that the output stream had an st_blksize of 2147421096. - So here we arbitrarily limit the `optimal' block size to 4MB. - If anyone knows of a system for which the legitimate value for - st_blksize can exceed 4MB, please report it as a bug in this code. */ + Conversely st_blksize can be 2 GiB (or maybe even larger) with XFS + on 64-bit hosts. Somewhat arbitrarily, limit the `optimal' block + size to SIZE_MAX / 8 + 1. (Dividing SIZE_MAX by only 4 wouldn't + suffice, since "cat" sometimes multiplies the result by 4.) If + anyone knows of a system for which this limit is too small, please + report it as a bug in this code. */ # define ST_BLKSIZE(statbuf) ((0 < (statbuf).st_blksize \ - && (statbuf).st_blksize <= (1 << 22)) /* 4MB */ \ + && (statbuf).st_blksize <= SIZE_MAX / 8 + 1) \ ? (statbuf).st_blksize : DEV_BSIZE) # if defined hpux || defined __hpux__ || defined __hpux /* HP-UX counts st_blocks in 1024-byte units. |