From 146d83288803c2556d94bd45b8fb2ee71c6b8c6d Mon Sep 17 00:00:00 2001 From: Ben Marsh Date: Thu, 20 Jun 2024 15:26:17 +0100 Subject: [PATCH] posix: sys: sysconf: Unconditionally define POSIX macros The POSIX macros PAGE_SIZE and PAGESIZE (queriable through sysconf()) were conditionally defined only if an existing definition did not already exist. These should be defined unconditionally in their header to ensure they get the correct values. If these macros are defined elsewhere with a different meaning, that's a problem. There was an issue where PAGESIZE was already defined with a different meaning. See #74623 and #74428. The POSIX macro ATEXIT_MAX is also conditionally defined and should be unconditionally defined, but there is currently a definition in picolibc (picolibc/newlib/libc/include/stdlib.h) so this change will be done separately. This commit defines PAGE_SIZE and PAGESIZE unconditionally. (cherry picked from commit 8c0d3de0fbcbc9ff58bde90de6cd32e13de40c46) Original-Signed-off-by: Ben Marsh GitOrigin-RevId: 8c0d3de0fbcbc9ff58bde90de6cd32e13de40c46 Change-Id: Icb9ff7549525906d976333b9327e3b7dd42975b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5692888 Tested-by: ChromeOS Prod (Robot) Tested-by: Keith Short Reviewed-by: Keith Short Commit-Queue: Keith Short --- include/zephyr/posix/posix_features.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/zephyr/posix/posix_features.h b/include/zephyr/posix/posix_features.h index 4e15fbd6950197..eb3c4b44d2d8bd 100644 --- a/include/zephyr/posix/posix_features.h +++ b/include/zephyr/posix/posix_features.h @@ -314,13 +314,8 @@ #define ATEXIT_MAX 8 #endif -#ifndef PAGE_SIZE #define PAGE_SIZE CONFIG_POSIX_PAGE_SIZE -#endif - -#ifndef PAGESIZE #define PAGESIZE PAGE_SIZE -#endif #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS #define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX