From 0e57f0c510b7d7eb688695359048a1f0a585e26a Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Thu, 24 Aug 2006 12:32:52 +0000 Subject: Moving project to sourceforge. git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@1 2592e710-e01b-42a5-8df0-11608a6cc53d --- mcon/U/d_getpagsz.U | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 mcon/U/d_getpagsz.U (limited to 'mcon/U/d_getpagsz.U') diff --git a/mcon/U/d_getpagsz.U b/mcon/U/d_getpagsz.U new file mode 100644 index 0000000..6083653 --- /dev/null +++ b/mcon/U/d_getpagsz.U @@ -0,0 +1,104 @@ +?RCS: $Id$ +?RCS: +?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic Licence, +?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 Licence; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?RCS: $Log: d_getpagsz.U,v $ +?RCS: Revision 3.0.1.1 1994/10/29 16:13:10 ram +?RCS: patch36: added ?F: line for metalint file checking +?RCS: +?RCS: Revision 3.0 1993/08/18 12:06:14 ram +?RCS: Baseline for dist 3.0 netwide release. +?RCS: +?MAKE:d_getpagsz pagesize: Oldconfig Myread Inlibc cat contains +cc +ccflags \ + libs rm Findhdr +?MAKE: -pick add $@ %< +?S:d_getpagsz: +?S: This variable conditionally defines HAS_GETPAGESIZE if getpagesize() +?S: is available to get the system page size. +?S:. +?S:pagesize (pagsize): +?S: This variable holds the size in bytes of a system page. +?S:. +?C:HAS_GETPAGESIZE (GETPAGESIZE): +?C: This symbol, if defined, indicates that the getpagesize system call +?C: is available to get system page size, which is the granularity of +?C: many memory management calls. +?C:. +?X: Don't name it PAGESIZE, this is sometimes used by +?C:PAGESIZE_VALUE (PAGSIZE): +?C: This symbol holds the size in bytes of a system page (obtained via +?C: the getpagesize() system call at configuration time or asked to the +?C: user if the system call is not available). +?C:. +?H:#$d_getpagsz HAS_GETPAGESIZE /**/ +?H:#define PAGESIZE_VALUE $pagesize /* System page size, in bytes */ +?H:. +?F:!page +?T:guess +?LINT:set d_getpagsz +: see if getpagesize exists +set getpagesize d_getpagsz +eval $inlibc + +@if pagesize || PAGESIZE_VALUE +: determine the system page size +echo " " +guess=' (OK to guess)' +case "$pagesize" in +'') + $cat >page.c <&4 + dflt='4096' + case "$d_getpagsz" in + "$define") + if $cc $ccflags -o page page.c $libs >/dev/null 2>&1; then + dflt=`./page` + guess='' + else + echo "(I can't seem to compile the test program--guessing)" + fi + ;; + *) + if $cc $ccflags -o page page.c $libs -lPW >/dev/null 2>&1; then + dflt=`./page` + guess='' + echo "(For your eyes only: I used the getpagesize() from -lPW.)" + else + if $contains PAGESIZE `./findhdr sys/param.h` >/dev/null 2>&1; then + $cat >page.c < +int main() +{ + printf("%d\n", PAGESIZE); +} +EOP + if $cc $ccflags -o page page.c $libs >/dev/null 2>&1; then + dflt=`./page` + guess='' + echo "(Using value of PAGESIZE found in .)" + fi + fi + fi + ;; + esac + ;; +*) dflt="$pagesize"; guess='';; +esac +rp="What is the system page size, in bytes$guess?" +. ./myread +pagesize=$ans +$rm -f page.c page + +@end -- cgit v1.2.3