From f08f0182f00b2dfe11e6657ebd51f9d6b0e5f79a Mon Sep 17 00:00:00 2001 From: shawn_he Date: Mon, 19 Dec 2022 20:16:45 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- .../subsystems/subsys-boot-init-service.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/en/device-dev/subsystems/subsys-boot-init-service.md b/en/device-dev/subsystems/subsys-boot-init-service.md index 5b6954c4d5..1317afb01d 100644 --- a/en/device-dev/subsystems/subsys-boot-init-service.md +++ b/en/device-dev/subsystems/subsys-boot-init-service.md @@ -89,6 +89,19 @@ Service configuration allows you to configure services on demand to create diffe "secon" : "u:r:distributedsche:s0" // SELinux tag setting for service processes. In this example, u:r:distributedsche:s0 is the SELinux tag. } ``` + +- SELinux tag + + To enable the SELinux policy for a service, add the SELinux tag to the service in the **secon** field. For example, to add the SELinux tag to watchdog_service, use the following code snippet: + + ``` + "services" : [{ + "name" : "watchdog_service", + "secon" : "u:r:watchdog_service:s0" + }] + ``` + Note that you need to define the tag in SELinux. For details, see the appropriate SELinux guide. + - init service FD proxy (for standard system or higher) FD proxy is an extended mechanism for on-demand startup. It can ensure that the FD state handle is not lost before the service process exits. Specifically, a service process sends the FD to the init process before it exits, and then reclaims the FD from the init process when it is started again. @@ -150,7 +163,7 @@ By parsing the *.cfg file, you can obtain **service** fields, a | API | Function| Description | | ---------- | ---------- |--------| | int *ServiceGetFd(const char *serviceName, size_t *outfdCount) | Obtains the proxy FD from the init process.| Return value: Returns the pointer to the fd array if the operation is successful; returns **NULL** otherwise. (Note: Manual release is required.)
Arguments:
**serviceName**: service name.
**outfdCount**: length of the returned FD array.| - | int ServiceSaveFd(const char *serviceName, int *fds, int fdCount) | Requests the init process for FD proxy.| Return value: Returns **0** if the operation is successful; returns **-1** otherwise.
Arguments:
**serviceName**: service name.
**fds**: pointer to the FD array for FD proxy.
**fdCount**: length of the FD array + | int ServiceSaveFd(const char *serviceName, int *fds, int fdCount) | Requests the init process for FD proxy.| Return value: Returns **0** if the operation is successful; returns **-1** otherwise.
Arguments:
**serviceName**: service name.
**fds**: pointer to the FD array for FD proxy.
**fdCount**: length of the FD array. | int ServiceSaveFdWithPoll(const char *serviceName, int *fds, int fdCount) | Requests FD proxy in poll mode.| Return value: Returns **0** if the operation is successful; returns **-1** otherwise.
Arguments:
**serviceName**: service name.
**fds**: pointer to the FD array.
**fdCount**: length of the FD array. **Table 4** Service control APIs -- GitLab