]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | #! /bin/sh |
2 | # | |
3 | # psize.sh -- determine this system's pipe size, and write a define to | |
4 | # pipesize.h so ulimit.c can use it. | |
5 | ||
bb70624e | 6 | : ${TMPDIR:=/tmp} |
cce855bc JA |
7 | TMPNAME=pipsize.$$ |
8 | TMPFILE=$TMPDIR/$TMPNAME | |
9 | ||
10 | trap 'rm -f $TMPFILE' 0 1 2 3 6 15 | |
11 | ||
726f6388 JA |
12 | echo "/*" |
13 | echo " * pipesize.h" | |
14 | echo " *" | |
15 | echo " * This file is automatically generated by psize.sh" | |
16 | echo " * Do not edit!" | |
17 | echo " */" | |
18 | echo "" | |
19 | ||
cce855bc JA |
20 | # |
21 | # Try to avoid tempfile races. We can't really check for the file's | |
22 | # existance before we run psize.aux, because `test -e' is not portable, | |
23 | # `test -h' (test for symlinks) is not portable, and `test -f' only | |
24 | # checks for regular files | |
25 | # | |
26 | rm -f $TMPFILE | |
27 | ||
28 | ./psize.aux 2>$TMPFILE | sleep 3 | |
726f6388 | 29 | |
cce855bc JA |
30 | if [ -s $TMPFILE ]; then |
31 | echo "#define PIPESIZE `cat $TMPFILE`" | |
726f6388 JA |
32 | else |
33 | echo "#define PIPESIZE 512" | |
34 | fi | |
35 | ||
726f6388 | 36 | exit 0 |