acassis commented on code in PR #18967:
URL: https://github.com/apache/nuttx/pull/18967#discussion_r3311391713


##########
Documentation/applications/system/init/index.rst:
##########
@@ -0,0 +1,157 @@
+======================
+``init`` Init
+======================
+
+Overview
+========
+
+In NuttX, there are various options for the init entry point, with NSH being
+one of the commonly used ones. However, taking NSH as an example, it is not
+suitable for all usage scenarios. For instance, the code size required by
+NSH and NSH_LIBRARY is relatively large, and NSH lacks management
+capabilities for daemons/services (such as restarting services).
+
+Therefore, we have newly implemented an Init component that is compatible
+with most of the syntax of Android Init. It is lightweight, supports
+command execution triggered by events, supports service/daemon management,
+and its configuration files support include/import functionalities.
+
+Init.rc consists of five categories of statements, all line-oriented with
+parameters separated by spaces. The content is processed by a preprocessor,
+following C language specifications for escape rules and comment formats.
+File path: /etc/init.d/init.rc.
+
+1. Actions and Commands
+-----------------------
+.. code-block::
+
+    on <trigger>
+       <command>
+       <command>
+       <command>
+
+- An Action (command sequence) contains trigger conditions. When satisfied,
+  it is added to the execution queue.
+- Commands are the specific execution content of actions, such as setprop
+  (set system properties), start (start services), and mount (mount file
+  systems).
+
+2. Services and Options
+-----------------------
+.. code-block::
+
+    service <name> <pathname> [ <argument> ]*
+       <option>
+       <option>
+       ...
+
+- A Service is a program started by Init, with a unique name (can be overridden
+  via the override option).
+- Options are modifiers for services, affecting their running mode and timing.
+  Examples include class (specify service category for batch start/stop),
+  override (override previously defined services), restart_period (interval
+  for restarting exited services), and reboot_on_failure (critical services
+  trigger device reboot on startup failure or abnormal exit).
+
+3. Imports
+----------
+Used to import other configuration files, supporting single files or all files
+in a directory (non-recursive).
+
+.. code-block::
+
+    import <path>
+
+In addition, since init.rc undergoes compiler preprocessing, we can also
+include other configuration files during the preprocessing stage using
+the #include directive.
+
+.. code-block::
+
+    #include "example.rc"

Review Comment:
   Good catch! Removed!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to