1 /* Emulation of getpagesize() for systems that need it. */
7 getpagesize -- return the number of bytes in page of memory
11 int getpagesize (void)
15 Returns the number of bytes in a page of memory. This is the
16 granularity of many of the system memory management routines.
17 No guarantee is made as to whether or not it is the same as the
18 basic memory management hardware page size.
22 Is intended as a reasonable replacement for systems where this
23 is not provided as a system call. The value of 4096 may or may
24 not be correct for the systems where it is returned as the default
33 #include <sys/types.h>
34 #ifdef HAVE_SYS_PARAM_H
35 #include <sys/param.h>
38 #undef GNU_OUR_PAGESIZE
39 #if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
42 #define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
46 #ifndef GNU_OUR_PAGESIZE
48 # define GNU_OUR_PAGESIZE PAGESIZE
49 # else /* no PAGESIZE */
51 # define GNU_OUR_PAGESIZE EXEC_PAGESIZE
52 # else /* no EXEC_PAGESIZE */
54 # define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
60 # define GNU_OUR_PAGESIZE NBPC
62 # define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
65 # endif /* EXEC_PAGESIZE */
66 # endif /* PAGESIZE */
67 #endif /* GNU_OUR_PAGESIZE */
72 return (GNU_OUR_PAGESIZE
);
77 #if 0 /* older distributions of gcc-vms are missing <syidef.h> */
80 #ifndef SYI$_PAGE_SIZE /* VMS V5.4 and earlier didn't have this yet */
81 #define SYI$_PAGE_SIZE 4452
83 extern unsigned long lib$
getsyi(const unsigned short *,...);
88 unsigned short itmcod
= SYI$_PAGE_SIZE
;
90 (void) lib$
getsyi (&itmcod
, (void *) &pagsiz
);
92 pagsiz
= 512L; /* VAX default */
This page took 0.031223 seconds and 4 git commands to generate.