[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] getpagesize.h vs sys/param.h
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] getpagesize.h vs sys/param.h |
Date: |
Fri, 22 Oct 2004 15:27:23 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
"Mark D. Baushke" <mdb@cvshome.org> writes:
> +#if !defined (getpagesize)
> +# define getpagesize() 4096 /* Just punt and use reasonable value */
> +#endif
I'm leery of this sort of approach, as it many cases it's important to
get the pagesize exactly right.
I installed this change instead: it is safe, and allows the caller to
decide what to do if !HAVE_GETPAGSZIE && !defined getpagesize.
Admittedly this is not as nice.
2004-10-22 Paul Eggert <eggert@cs.ucla.edu>
* lib/getpagesize.c (getpagesize): Don't assume <sys/param.h> exists.
It's now the caller's responsibility to handle the case where
!HAVE_GETPAGESIZE && !defined getpagesize.
* m4/getpagesize.m4 (gl_GETPAGESIZE): Check for <sys/param.h>.
Index: lib/getpagesize.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getpagesize.h,v
retrieving revision 1.6
diff -p -u -r1.6 getpagesize.h
--- lib/getpagesize.h 4 Oct 2004 04:18:46 -0000 1.6
+++ lib/getpagesize.h 22 Oct 2004 22:25:17 -0000
@@ -1,5 +1,5 @@
/* Emulate getpagesize on systems that lack it.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
# endif
#endif
-#ifndef getpagesize
+#if !defined getpagesize && HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
Index: m4/getpagesize.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/getpagesize.m4,v
retrieving revision 1.1
diff -p -u -r1.1 getpagesize.m4
--- m4/getpagesize.m4 31 Dec 2002 13:42:06 -0000 1.1
+++ m4/getpagesize.m4 22 Oct 2004 22:25:17 -0000
@@ -1,5 +1,5 @@
-# getpagesize.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# getpagesize.m4 serial 2
+dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
@@ -9,7 +9,7 @@ dnl the same distribution terms as the r
AC_DEFUN([gl_GETPAGESIZE],
[
dnl Prerequisites of lib/getpagesize.h.
- AC_CHECK_HEADERS_ONCE(unistd.h)
+ AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
AC_CHECK_HEADERS(OS.h)
AC_CHECK_FUNCS(getpagesize)
])