From ee9787a25462dbd58c7626593af0358bd7b9d4f5 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 14 Jan 2023 22:40:23 +0800 Subject: [PATCH] libc: Let _SC_PAGESIZE return 4096 when CONFIG_MM_PGSIZE isn't defined since most application doesn't expect the page size equals one Signed-off-by: Xiang Xiao --- libs/libc/unistd/lib_sysconf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c index 6a141a2e52..8246a2eb17 100644 --- a/libs/libc/unistd/lib_sysconf.c +++ b/libs/libc/unistd/lib_sysconf.c @@ -30,6 +30,12 @@ #include #include +#ifdef CONFIG_MM_PGSIZE +# define DEFAULT_MM_PGSIZE CONFIG_MM_PGSIZE +#else +# define DEFAULT_MM_PGSIZE 4096 +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -226,11 +232,7 @@ long sysconf(int name) return 1; case _SC_PAGESIZE: -#ifdef CONFIG_MM_PGSIZE - return CONFIG_MM_PGSIZE; -#else - return 1; -#endif + return DEFAULT_MM_PGSIZE; default: #if 0 /* Assume valid but not implemented for the time being */