This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 17c768164289bae44b3002de4bc27c496442118c
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 21:06:37 2026 +0200

    Documentation/reference/user: Describe the exit function list.
    
    The documentation named options that no longer exist
    (CONFIG_SCHED_ATEXIT, CONFIG_SCHED_ATEXIT_MAX, CONFIG_SCHED_ONEXIT) and
    said that only one function can be registered.  The list is now limited
    only by memory, and the functions need CONFIG_LIBC_MAX_EXITFUNS > 0.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 Documentation/reference/user/03_task_control.rst | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/Documentation/reference/user/03_task_control.rst 
b/Documentation/reference/user/03_task_control.rst
index 56aec5eee17..00fe36663d2 100644
--- a/Documentation/reference/user/03_task_control.rst
+++ b/Documentation/reference/user/03_task_control.rst
@@ -413,18 +413,23 @@ Functions
   normal process termination, whether via ``exit()`` or via return from
   the program's ``main()``.
 
-  .. note:: ``CONFIG_SCHED_ATEXIT`` must be defined to enable this function.
+  .. note:: ``CONFIG_LIBC_MAX_EXITFUNS`` must be larger than 0 to build
+    ``atexit()``, ``on_exit()`` and ``at_quick_exit()``.  A C++ ELF
+    program (built with ``-fno-use-cxa-atexit``) with a static object in
+    a function calls ``atexit()`` too.
+
+  The number of functions is limited only by memory: the first
+  ``CONFIG_LIBC_MAX_EXITFUNS`` entries are in the task information, the
+  next ones come from the heap.  ``atexit()``, ``on_exit()``,
+  ``at_quick_exit()`` and ``__cxa_atexit()`` share the list.
 
   :param func: A pointer to the function to be called when the task exits.
-  :return: On success, ``atexit()`` returns OK (0). On error,
-    ERROR (-1) is returned, and ```errno`` <#ErrnoAccess>`__ is set to
-    indicate the cause of the failure.
+  :return: On success, ``atexit()`` returns OK (0). On error (no memory),
+    a non-zero value is returned.
 
   **POSIX Compatibility:** Comparable to the ISO C interface of the same
   name. Limitations in the current implementation:
 
-    #. Only a single ``atexit`` function can be registered unless
-       ``CONFIG_SCHED_ATEXIT_MAX`` defines a larger number.
     #. ``atexit()`` functions are not inherited when a new task is created.
 
 .. c:function:: int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
@@ -436,8 +441,8 @@ Functions
   given to the last call to ``exit()`` and the ``arg`` argument from
   ``on_exit()``.
 
-  .. note: ``CONFIG_SCHED_ONEXIT`` must be defined to enable this
-    function
+  .. note:: ``CONFIG_LIBC_MAX_EXITFUNS`` must be larger than 0 to build
+    this function.
 
   :param func: A pointer to the function to be called when the task exits.
   :param arg: An argument that will be provided to the ``on_exit()``
@@ -451,6 +456,5 @@ Functions
   present in libc4, libc5 and glibc. It no longer occurs in Solaris (SunOS
   5). Avoid this function, and use the standard ``atexit()`` instead.
 
-    #. Only a single ``on_exit`` function can be registered unless
-       ``CONFIG_SCHED_ONEXIT_MAX`` defines a larger number.
+    #. ``on_exit()`` shares the list of ``atexit()``.
     #. ``on_exit()`` functions are not inherited when a new task is created.

Reply via email to