freebsd-nq/gnu/usr.bin/grep/getpagesize.h

49 lines
881 B
C
Raw Normal View History

/* Emulate getpagesize on systems that lack it. */
2004-03-01 08:37:20 +00:00
/* $FreeBSD$ */
2004-03-01 08:37:20 +00:00
#ifndef HAVE_GETPAGESIZE
2000-01-31 13:26:10 +00:00
2004-07-04 10:02:03 +00:00
#if !defined getpagesize && defined __BEOS__
# include <OS.h>
# define getpagesize() B_PAGE_SIZE
#endif
2000-01-31 13:26:10 +00:00
#ifdef HAVE_UNISTD_H
2004-03-01 08:37:20 +00:00
# include <unistd.h>
2000-01-31 13:26:10 +00:00
#endif
2004-03-01 08:37:20 +00:00
#if !defined getpagesize && defined _SC_PAGESIZE
# if !(defined VMS && __VMS_VER < 70000000)
# define getpagesize() sysconf (_SC_PAGESIZE)
# endif
#endif
2004-03-01 08:37:20 +00:00
#if !defined getpagesize && defined VMS
# ifdef __ALPHA
# define getpagesize() 8192
# else
# define getpagesize() 512
# endif
#endif
2004-03-01 08:37:20 +00:00
#ifndef getpagesize
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else
# ifdef NBPG
# ifndef CLSIZE
# define CLSIZE 1
# endif
# define getpagesize() (NBPG * CLSIZE)
# else
# ifdef NBPC
# define getpagesize() NBPC
# endif
# endif
# endif
#endif
2000-01-31 13:26:10 +00:00
#endif /* not HAVE_GETPAGESIZE */