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.
This commit is contained in:
Adrien Destugues 2017-04-13 21:14:41 +02:00
parent b68cf9d6f6
commit 56403b6373

View File

@ -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.
*/