From 1e166f7ecbddc2e59005d9b17a967c57d7331a8a Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 22 Jun 2020 12:37:37 +0800 Subject: [PATCH] sysconf: Implement _SC_ATEXIT_MAX query and remove the incorrect macro ATEXIT_MAX Signed-off-by: Xiang Xiao Change-Id: Ia5d7dafc50e942f62f95137313c34741c6dd60ba --- include/unistd.h | 6 ------ libs/libc/unistd/lib_sysconf.c | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index 0d4283a117..e51ab9fc3e 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -48,12 +48,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* The number of functions that may be registered to be called - * at program exit. - */ - -#define ATEXIT_MAX 1 - /* Values for seeking */ #define SEEK_SET 0 /* From the start of the file */ diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c index 7f51d9e99e..c27acf740e 100644 --- a/libs/libc/unistd/lib_sysconf.c +++ b/libs/libc/unistd/lib_sysconf.c @@ -41,6 +41,7 @@ #include #include +#include #include /**************************************************************************** @@ -225,6 +226,13 @@ long sysconf(int name) case _SC_OPEN_MAX: return CONFIG_NFILE_DESCRIPTORS; + case _SC_ATEXIT_MAX: +#ifdef CONFIG_SCHED_EXIT_MAX + return CONFIG_SCHED_EXIT_MAX; +#else + return 0; +#endif + default: #if 0 /* Assume valid but not implemented for the time being */ errcode = EINVAL;