David Bartley wrote: > On Sat, Mar 14, 2009 at 11:06 AM, Jim Meyering <[email protected]> wrote: >> David Bartley wrote: >>> Just a quick heads up, the following commit breaks the build on Solaris: >>> >>> http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=55efc5f3ee485b3e31a91c331f07c89aeccc4e89 >>> >>> In src/system.h, MAX may not be defined before it is used in >>> io_blksize. I think you can just move the io_blksize function below >>> the later definition of MAX to fix this. >> >> Thanks for the heads up. >> Moving it "down" does sound like the right thing to do, >> but we should document which compiler/version is complaining about the >> current set-up. Can you provide details? > > The OS is OpenSolaris and the compiler is gcc 3.4, but it probably > affects any compiler and other Solaris versions. On Solaris MAX is > defined in sys/sysmacros.h which never gets included (on Linux it's in > sys/param.h which does get included).
Thanks. I've done this: (the latter just pulls in recent gnulib changes) >From a4780e67f4ad5151724f078ebe25ad4c347af82c Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Sat, 14 Mar 2009 21:29:33 +0100 Subject: [PATCH 1/2] system.h: correct compilation error: MAX not defined * src/system.h (io_blksize): Move definition down, so it follows that of MAX -- to avoid compilation failure on OpenSolaris. Reported by David Bartley. Details in http://lists.gnu.org/archive/html/bug-coreutils/2009-03/msg00190.html --- THANKS | 1 + src/system.h | 90 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/THANKS b/THANKS index 46d077b..f894e1d 100644 --- a/THANKS +++ b/THANKS @@ -131,6 +131,7 @@ Darrel Francis [email protected] Darren Salt [email protected] Dave Beckett [email protected] David Alan Gilbert [email protected] +David Bartley [email protected] David Dyck [email protected] David Eisner [email protected] David Flynn [email protected] diff --git a/src/system.h b/src/system.h index dbb4da1..eafcc25 100644 --- a/src/system.h +++ b/src/system.h @@ -221,51 +221,6 @@ enum # endif #endif -/* As of Mar 2009, 32KiB is determined to be the minimium - blksize to best minimize system call overhead. - This can be tested with this script with the results - shown for a 1.7GHz pentium-m with 2GB of 400MHz DDR2 RAM: - - for i in $(seq 0 10); do - size=$((8*1024**3)) #ensure this is big enough - bs=$((1024*2**$i)) - printf "%7s=" $bs - dd bs=$bs if=/dev/zero of=/dev/null count=$(($size/$bs)) 2>&1 | - sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p' - done - - 1024=734 MB/s - 2048=1.3 GB/s - 4096=2.4 GB/s - 8192=3.5 GB/s - 16384=3.9 GB/s - 32768=5.2 GB/s - 65536=5.3 GB/s - 131072=5.5 GB/s - 262144=5.7 GB/s - 524288=5.7 GB/s - 1048576=5.8 GB/s - - Note that this is to minimize system call overhead. - Other values may be appropriate to minimize file system - or disk overhead. For example on my current linux system - the readahead setting is 128KiB which was read using: - - file="." - device=$(df -P --local "$file" | tail -n1 | cut -d' ' -f1) - echo $(( $(blockdev --getra $device) * 512 )) - - However there isn't a portable way to get the above. - In the future we could use the above method if available - and default to io_blksize() if not. - */ -enum { IO_BUFSIZE = 32*1024 }; -static inline size_t -io_blksize (struct stat sb) -{ - return MAX (IO_BUFSIZE, ST_BLKSIZE (sb)); -} - /* Redirection and wildcarding when done by the utility itself. Generally a noop, but used in particular for native VMS. */ #ifndef initialize_main @@ -701,4 +656,49 @@ bad_cast (char const *s) return (char *) s; } +/* As of Mar 2009, 32KiB is determined to be the minimium + blksize to best minimize system call overhead. + This can be tested with this script with the results + shown for a 1.7GHz pentium-m with 2GB of 400MHz DDR2 RAM: + + for i in $(seq 0 10); do + size=$((8*1024**3)) #ensure this is big enough + bs=$((1024*2**$i)) + printf "%7s=" $bs + dd bs=$bs if=/dev/zero of=/dev/null count=$(($size/$bs)) 2>&1 | + sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p' + done + + 1024=734 MB/s + 2048=1.3 GB/s + 4096=2.4 GB/s + 8192=3.5 GB/s + 16384=3.9 GB/s + 32768=5.2 GB/s + 65536=5.3 GB/s + 131072=5.5 GB/s + 262144=5.7 GB/s + 524288=5.7 GB/s + 1048576=5.8 GB/s + + Note that this is to minimize system call overhead. + Other values may be appropriate to minimize file system + or disk overhead. For example on my current linux system + the readahead setting is 128KiB which was read using: + + file="." + device=$(df -P --local "$file" | tail -n1 | cut -d' ' -f1) + echo $(( $(blockdev --getra $device) * 512 )) + + However there isn't a portable way to get the above. + In the future we could use the above method if available + and default to io_blksize() if not. + */ +enum { IO_BUFSIZE = 32*1024 }; +static inline size_t +io_blksize (struct stat sb) +{ + return MAX (IO_BUFSIZE, ST_BLKSIZE (sb)); +} + void usage (int status) ATTRIBUTE_NORETURN; -- 1.6.2.rc1.285.gc5f54 >From bd23509bef79b7d984f8a484e58d767adce9847f Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Sun, 15 Mar 2009 08:09:53 +0100 Subject: [PATCH 2/2] * gnulib: Update submodule to latest. --- gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gnulib b/gnulib index f93bd98..77d1b17 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit f93bd98a9570a4455f16eafc49c6227e5caa5a53 +Subproject commit 77d1b17de32d8299a8c550944b922e55db5dc22e -- 1.6.2.rc1.285.gc5f54 _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
