[v3,25/29] Install the <sys/pagesize.h> header file

Message ID cce1fcc9785e01c0c4c7198dae073d9d434ca92f.1727624528.git.fweimer@redhat.com
State Under Review
Delegated to: Adhemerval Zanella Netto
Headers
Series Teach glibc about possible page sizes and handle gaps in ld.so |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm fail Test failed

Commit Message

Florian Weimer Sept. 29, 2024, 4:36 p.m. UTC
  ---
 NEWS                 |  5 +++++
 manual/resource.texi | 31 +++++++++++++++++++++++++++++++
 misc/Makefile        |  2 ++
 3 files changed, 38 insertions(+)
  

Patch

diff --git a/NEWS b/NEWS
index b1ae1c31ca..d7b522e869 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,11 @@  Major new features:
 * The iconv program now supports converting files in place.  The program
   automatically uses a temporary file if required.
 
+* The header file <sys/pagesize.h> is now available.  It contains macros
+  PAGE_SIZE_MIN, PAGE_SIZE_MAX, PAGE_SHIFT_MIN, PAGE_SHIFT_MAX,
+  reflecting the possible range of page sizes for the target
+  architecture.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The big-endian ARC port (arceb-linux-gnu) has been removed.
diff --git a/manual/resource.texi b/manual/resource.texi
index 612520d4d9..32142dc103 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -1620,6 +1620,37 @@  different runs of the application.
 The function is declared in @file{unistd.h}.
 @end deftypefun
 
+The header file @file{sys/pagesize.h} provides information about the
+possible page sizes an architecture can support.
+
+@deftypevar {unsigned long int} PAGE_SIZE_MIN
+@standards{GNU, sys/pagesize.h}
+The smallest value that @code{getpagesize} can return on this
+architecture.  The pointers returned by @code{mmap} are
+always a multiple of this constant (once cast to @code{uintptr_t}).
+@xref{Memory-mapped I/O}.
+@end deftypevar
+
+@deftypevar {unsigned long int} PAGE_SIZE_MAX
+@standards{GNU, sys/pagesize.h}
+The largest value that @code{getpagesize} can return on this
+architecture.  It is guaranteed that @code{mmap} can create
+mappings at file offsets that are multiples of this constants.
+@xref{Memory-mapped I/O}.
+@end deftypevar
+
+@deftypevar int PAGE_SHIFT_MIN
+@standards{GNU, sys/pagesize.h}
+Base-2 logarithm of @code{PAGE_SIZE_MIN}.
+The @code{PAGE_SHIFT_MIN} lowest bits of pointers
+returned by @code{mmap} are always zero.
+@end deftypevar
+
+@deftypevar int PAGE_SHIFT_MAX
+@standards{GNU, sys/pagesize.h}
+Base-2 logarithm of @code{PAGE_SIZE_MAX}.
+@end deftypevar
+
 Widely available on @w{System V} derived systems is a method to get
 information about the physical memory the system has.  The call
 
diff --git a/misc/Makefile b/misc/Makefile
index 4250b789d1..ff10b3763e 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -79,6 +79,8 @@  headers	:= \
   bits/err-ldbl.h \
   bits/error-ldbl.h \
   sys/single_threaded.h \
+  bits/pagesize.h \
+  sys/pagesize.h \
   # headers
 
 routines := \