3 # psize.sh -- determine this system's pipe size, and write a define to
4 # pipesize.h so ulimit.c can use it.
7 # try to use mktemp(1) if the system supports it
8 { TMPFILE
="`mktemp $TMPDIR/pipsize.XXXXXX 2>/dev/null`"; } 2>/dev
/null
11 if [ -z "$TMPFILE" ]; then
13 TMPFILE
=$TMPDIR/$TMPNAME
17 trap 'rm -f "$TMPFILE" ; exit 1' 1 2 3 6 15
18 trap 'rm -f "$TMPFILE"' 0
23 echo " * This file is automatically generated by psize.sh"
24 echo " * Do not edit!"
29 # Try to avoid tempfile races. We can't really check for the file's
30 # existance before we run psize.aux, because `test -e' is not portable,
31 # `test -h' (test for symlinks) is not portable, and `test -f' only
32 # checks for regular files. If we used mktemp(1), we're ahead of the
35 $used_mktemp ||
rm -f "$TMPFILE"
37 .
/psize.aux
2>"$TMPFILE" |
sleep 3
39 if [ -s "$TMPFILE" ]; then
40 echo "#define PIPESIZE `cat "$TMPFILE"`"
42 echo "#define PIPESIZE 512"