From 1086a05e50b97439b1a1dc44cfe6da5048e40702 Mon Sep 17 00:00:00 2001 From: chenzhijia Date: Mon, 8 Apr 2024 14:54:47 +0800 Subject: [PATCH] libc/sysconf: add _SC_GETPW_R_SIZE_MAX pass tlpi example: https://man7.org/tlpi/code/online/dist/users_groups/t_getpwnam_r.c.html Signed-off-by: chenzhijia --- include/unistd.h | 3 +++ libs/libc/unistd/lib_sysconf.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/unistd.h b/include/unistd.h index 10463f28b5dc1..3c576d6e1f99d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -57,6 +57,9 @@ #undef _POSIX_MEMLOCK_RANGE #undef _POSIX_FSYNC #define _POSIX_SYNCHRONIZED_IO 1 +#ifdef CONFIG_LIBC_PASSWD_LINESIZE +# define _POSIX_GETPW_R_SIZE_MAX CONFIG_LIBC_PASSWD_LINESIZE +#endif #define _POSIX_VERSION 201712L #define _POSIX_PRIORITIZED_IO _POSIX_VERSION diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c index eff4e718e2dc6..a35120e5d1a15 100644 --- a/libs/libc/unistd/lib_sysconf.c +++ b/libs/libc/unistd/lib_sysconf.c @@ -223,6 +223,10 @@ long sysconf(int name) return _POSIX_PRIORITIZED_IO; case _SC_AIO_MAX: return _POSIX_AIO_MAX; +#ifdef CONFIG_LIBC_PASSWD_LINESIZE + case _SC_GETPW_R_SIZE_MAX: + return _POSIX_GETPW_R_SIZE_MAX; +#endif case _SC_CPUTIME: return _POSIX_CPUTIME; case _SC_THREAD_CPUTIME: