diff options
Diffstat (limited to 'meta/recipes-devtools/autoconf/autoconf/backports/0022-Fix-port-of-AC_FUNC_MMAP.patch')
-rw-r--r-- | meta/recipes-devtools/autoconf/autoconf/backports/0022-Fix-port-of-AC_FUNC_MMAP.patch | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/meta/recipes-devtools/autoconf/autoconf/backports/0022-Fix-port-of-AC_FUNC_MMAP.patch b/meta/recipes-devtools/autoconf/autoconf/backports/0022-Fix-port-of-AC_FUNC_MMAP.patch new file mode 100644 index 0000000000..1b168c7b55 --- /dev/null +++ b/meta/recipes-devtools/autoconf/autoconf/backports/0022-Fix-port-of-AC_FUNC_MMAP.patch | |||
@@ -0,0 +1,91 @@ | |||
1 | From 33c26d2700f927432c756ccf7a4fc89403d35b95 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Eggert <eggert@cs.ucla.edu> | ||
3 | Date: Wed, 10 May 2023 22:57:27 -0700 | ||
4 | Subject: [PATCH 22/29] Fix port of AC_FUNC_MMAP | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Problem reported by Matt Turner in: | ||
10 | https://lists.gnu.org/r/bug-autoconf/2023-05/msg00005.html | ||
11 | * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Go back to getting the | ||
12 | page size, since the zero-fill test needs this after all. | ||
13 | However, prefer sysconf (_SC_PAGESIZE) or sysconf (_SC_PAGE_SIZE) | ||
14 | to getpagesize (), and use ‘long’ not ‘int’ to store the page size. | ||
15 | Also, declare getpagesize if it is used as a function. | ||
16 | |||
17 | Upstream-Status: Backport | ||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | --- | ||
20 | lib/autoconf/functions.m4 | 41 ++++++++++++++++++++++++++++++++++----- | ||
21 | 1 file changed, 36 insertions(+), 5 deletions(-) | ||
22 | |||
23 | diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 | ||
24 | index 5a0f01856..3d6e4aca8 100644 | ||
25 | --- a/lib/autoconf/functions.m4 | ||
26 | +++ b/lib/autoconf/functions.m4 | ||
27 | @@ -1283,7 +1283,6 @@ AU_ALIAS([AM_FUNC_MKTIME], [AC_FUNC_MKTIME]) | ||
28 | AN_FUNCTION([mmap], [AC_FUNC_MMAP]) | ||
29 | AC_DEFUN([AC_FUNC_MMAP], | ||
30 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles | ||
31 | -dnl FIXME: Remove the unnecessary checks for unistd.h, sys/param.h, getpagesize. | ||
32 | AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) | ||
33 | AC_CHECK_FUNCS_ONCE([getpagesize]) | ||
34 | AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped], | ||
35 | @@ -1311,17 +1310,49 @@ AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped], | ||
36 | #include <fcntl.h> | ||
37 | #include <sys/mman.h> | ||
38 | |||
39 | +#ifndef getpagesize | ||
40 | +# ifdef _SC_PAGESIZE | ||
41 | +# define getpagesize() sysconf (_SC_PAGESIZE) | ||
42 | +# elif defined _SC_PAGE_SIZE | ||
43 | +# define getpagesize() sysconf (_SC_PAGE_SIZE) | ||
44 | +# elif HAVE_GETPAGESIZE | ||
45 | +int getpagesize (); | ||
46 | +# else | ||
47 | +# ifdef HAVE_SYS_PARAM_H | ||
48 | +# include <sys/param.h> | ||
49 | +# ifdef EXEC_PAGESIZE | ||
50 | +# define getpagesize() EXEC_PAGESIZE | ||
51 | +# else /* no EXEC_PAGESIZE */ | ||
52 | +# ifdef NBPG | ||
53 | +# define getpagesize() NBPG * CLSIZE | ||
54 | +# ifndef CLSIZE | ||
55 | +# define CLSIZE 1 | ||
56 | +# endif /* no CLSIZE */ | ||
57 | +# else /* no NBPG */ | ||
58 | +# ifdef NBPC | ||
59 | +# define getpagesize() NBPC | ||
60 | +# else /* no NBPC */ | ||
61 | +# ifdef PAGESIZE | ||
62 | +# define getpagesize() PAGESIZE | ||
63 | +# endif /* PAGESIZE */ | ||
64 | +# endif /* no NBPC */ | ||
65 | +# endif /* no NBPG */ | ||
66 | +# endif /* no EXEC_PAGESIZE */ | ||
67 | +# else /* no HAVE_SYS_PARAM_H */ | ||
68 | +# define getpagesize() 8192 /* punt totally */ | ||
69 | +# endif /* no HAVE_SYS_PARAM_H */ | ||
70 | +# endif | ||
71 | +#endif | ||
72 | + | ||
73 | int | ||
74 | main (void) | ||
75 | { | ||
76 | char *data, *data2, *data3; | ||
77 | const char *cdata2; | ||
78 | - int i, pagesize; | ||
79 | + long i, pagesize; | ||
80 | int fd, fd2; | ||
81 | |||
82 | - /* The "page size" need not equal the system page size, | ||
83 | - and need not even be a power of 2. */ | ||
84 | - pagesize = 8192; | ||
85 | + pagesize = getpagesize (); | ||
86 | |||
87 | /* First, make a file with some known garbage in it. */ | ||
88 | data = (char *) malloc (pagesize); | ||
89 | -- | ||
90 | 2.41.0 | ||
91 | |||