From 56403b637301afde35c51bc99b4e74c356e39add Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 13 Apr 2017 21:14:41 +0200 Subject: [PATCH] limits.h: define PAGE_SIZE only if XSI is requested limits.h is part of the C standard, but POSIX and XSI extend it with various defines. We should not add these unless the application requests support for them. In this case, PAGE_SIZE should only be defined if XSI support is requested by defining _XOPEN_SOURCE. Note that PAGESIZE (plain POSIX for the same thing) and B_PAGE_SIZE are alternatives that remain available. --- headers/posix/limits.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/headers/posix/limits.h b/headers/posix/limits.h index d2699a1498..dfd707bb83 100644 --- a/headers/posix/limits.h +++ b/headers/posix/limits.h @@ -38,12 +38,11 @@ #define NAME_MAX (256) #define NGROUPS_MAX (32) #define OPEN_MAX (128) -#define PAGE_SIZE (4096) #define PAGESIZE (4096) #define PATH_MAX (1024) #define PIPE_MAX (512) #define PTHREAD_KEYS_MAX 256 -#define PTHREAD_STACK_MIN (2 * PAGE_SIZE) +#define PTHREAD_STACK_MIN (2 * PAGESIZE) #define SSIZE_MAX __HAIKU_SADDR_MAX #define TTY_NAME_MAX (256) #define TZNAME_MAX (32) @@ -76,6 +75,13 @@ #define _POSIX2_LINE_MAX (2048) +/* The XSI name for PAGESIZE, with extra underscore included. Only define if + * _XOPEN_SOURCE was requested, otherwise it could conflict with the application. + */ +#ifdef _XOPEN_SOURCE +#define PAGE_SIZE PAGESIZE +#endif + /* _GCC_LIMITS_H_ is defined by GCC's internal limits.h to avoid * collisions with any defines in this file. */