You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/06/23 16:35:14 UTC
[incubator-nuttx] 01/02: sysconf: Implement _SC_ATEXIT_MAX query
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 1e166f7ecbddc2e59005d9b17a967c57d7331a8a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jun 22 12:37:37 2020 +0800
sysconf: Implement _SC_ATEXIT_MAX query
and remove the incorrect macro ATEXIT_MAX
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
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 0d4283a..e51ab9f 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 7f51d9e..c27acf7 100644
--- a/libs/libc/unistd/lib_sysconf.c
+++ b/libs/libc/unistd/lib_sysconf.c
@@ -41,6 +41,7 @@
#include <nuttx/config.h>
#include <unistd.h>
+#include <sched.h>
#include <errno.h>
/****************************************************************************
@@ -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;