2024-06-14 Paul Eggert <eggert@cs.ucla.edu>
+ mprotect: don’t assume pointers fit in long
+ * m4/mprotect.m4 (gl_FUNC_MPROTECT_WORKS): Don’t assume pointers
+ fit into unsigned long, as this is not true on CheriBSD. Prefer
+ sysconf (_SC_PAGESIZE) to getpagesize.
+
memchr,strncat: prefer sysconf (_SC_PAGESIZE)
* m4/memchr.m4 (gl_FUNC_MEMCHR):
* m4/strncat.m4 (gl_FUNC_STRNCAT):
# mprotect.m4
-# serial 3
+# serial 4
dnl Copyright (C) 1993-2024 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License as published by the Free Software Foundation;
#include <sys/types.h>
/* Declare malloc(). */
#include <stdlib.h>
- /* Declare getpagesize(). */
- #if HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- #ifdef __hpux
- extern
- #ifdef __cplusplus
- "C"
- #endif
- int getpagesize (void);
- #endif
+ /* Declare sysconf(). */
+ #include <unistd.h>
/* Declare mprotect(). */
#include <sys/mman.h>
char foo;
+ static unsigned long int pagesize;
+ static char *
+ page_align (char *address)
+ {
+ return address - ((unsigned long int) address & (pagesize - 1));
+ }
int main ()
{
- unsigned long pagesize = getpagesize ();
- #define page_align(address) (char*)((unsigned long)(address) & -pagesize)
+ pagesize = sysconf (_SC_PAGESIZE);
'
no_mprotect=
AC_RUN_IFELSE(