?RCS: $Id: sbrksmart.U 167 2013-05-08 17:58:00Z rmanfredi $ ?RCS: ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic License, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of ?RCS: that same Artistic License; a copy of which may be found at the root ?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: sbrksmart.U,v $ ?RCS: Revision 3.0.1.2 1995/01/11 15:35:41 ram ?RCS: patch45: now sets sbrksmart to undef explicitly when lacking sbrk() ?RCS: patch45: forgot a cast when using return value from sbrk() ?RCS: ?RCS: Revision 3.0.1.1 1994/01/24 14:16:45 ram ?RCS: patch16: created ?RCS: ?MAKE:sbrksmart: cat d_sbrk +cc +ccflags +libs rm ?MAKE: -pick add $@ %< ?S:sbrksmart: ?S: This variable conditionally defines HAS_SMART_SBRK if the sbrk() ?S: routine honors a negative argument to lower the break value. ?S:. ?C:HAS_SMART_SBRK: ?C: This symbol is defined when the sbrk() system call may be used with ?C: a negative argument to lower the break value, therefore releasing ?C: core to the system. If not, you'd probably be better off using the ?C: mmap() system call. ?C:. ?H:#$sbrksmart HAS_SMART_SBRK /**/ ?H:. ?T:dumb ?F:!sbrk : see whether sbrk can release core to the kernel echo " " case "$d_sbrk" in "$define") echo "Let's see if your sbrk() is smart enough to release core..." >&4 $cat > sbrk.c </dev/null 2>&1; then ./sbrk >/dev/null 2>&1 case $? in 0) sbrksmart="$define" echo "Yes, it can be used with negative values." ;; 1) echo "Sorry, not enough memory $dumb" ;; 2) echo "No it's not, and besides it seems to be buggy..." ;; 3) echo "No, it fails with negative values." ;; 4) echo "Nope, your sbrk() is too dumb." ;; *) echo "Err... Unexpected result $dumb" ;; esac else echo "(Could not compile test program $dumb)" fi ;; *) echo "Since you don't have sbrk(), let's forget about the smart test!" sbrksmart="$undef" ;; esac $rm -f sbrk sbrk.* core