1 /* Emulation of getpagesize() for systems that need it. */
5 @deftypefn Supplemental int getpagesize (void)
7 Returns the number of bytes in a page of memory. This is the
8 granularity of many of the system memory management routines. No
9 guarantee is made as to whether or not it is the same as the basic
10 memory management hardware page size.
16 Is intended as a reasonable replacement for systems where this
17 is not provided as a system call. The value of 4096 may or may
18 not be correct for the systems where it is returned as the default
27 #include <sys/types.h>
28 #ifdef HAVE_SYS_PARAM_H
29 #include <sys/param.h>
32 #undef GNU_OUR_PAGESIZE
33 #if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
36 #define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
40 #ifndef GNU_OUR_PAGESIZE
42 # define GNU_OUR_PAGESIZE PAGESIZE
43 # else /* no PAGESIZE */
45 # define GNU_OUR_PAGESIZE EXEC_PAGESIZE
46 # else /* no EXEC_PAGESIZE */
48 # define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
54 # define GNU_OUR_PAGESIZE NBPC
56 # define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
59 # endif /* EXEC_PAGESIZE */
60 # endif /* PAGESIZE */
61 #endif /* GNU_OUR_PAGESIZE */
66 return (GNU_OUR_PAGESIZE
);
71 #if 0 /* older distributions of gcc-vms are missing <syidef.h> */
74 #ifndef SYI$_PAGE_SIZE /* VMS V5.4 and earlier didn't have this yet */
75 #define SYI$_PAGE_SIZE 4452
77 extern unsigned long lib$
getsyi(const unsigned short *,...);
79 int getpagesize (void)
82 unsigned short itmcod
= SYI$_PAGE_SIZE
;
84 (void) lib$
getsyi (&itmcod
, (void *) &pagsiz
);
86 pagsiz
= 512L; /* VAX default */