Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion system/nxinit/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ config SYSTEM_NXINIT_PROGNAME

comment "NXInit Run Control(RC)"

config SYSTEM_NXINIT_RC_FILE_PATH
string "Path to RC file"
default "/etc/init.d/init.rc"
---help---
Path to the init.rc file to use for NXInit's boot logic.

config SYSTEM_NXINIT_RC_LINE_MAX
int "Max line length of RC file"
default 128
Expand Down Expand Up @@ -77,7 +83,7 @@ config SYSTEM_NXINIT_ACTION_MANAGER_EVENT_MAX
config SYSTEM_NXINIT_FINALINIT
bool "Enable NXInit final event"
default n
--help--
---help---
Enable support to run the "final" event. Currently only "boot",
and "init" event are enabled by default, where "netinit" and
"final" are optional.
Expand Down
10 changes: 2 additions & 8 deletions system/nxinit/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ static void reap_process(FAR struct service_manager_s *sm,

for (; ; )
{
pid = waitpid(-1,
#ifdef CONFIG_SYSTEM_NXINIT_DEBUG
&wstatus,
#else
NULL,
#endif
WNOHANG);
pid = waitpid(-1, &wstatus, WNOHANG);
if (pid <= 0)
{
break;
Expand Down Expand Up @@ -180,7 +174,7 @@ int main(int argc, FAR char *argv[])
}
}

r = init_parse_config_file(parser, "/etc/init.d/init.rc");
r = init_parse_config_file(parser, CONFIG_SYSTEM_NXINIT_RC_FILE_PATH);
if (r < 0)
{
goto out;
Expand Down
9 changes: 6 additions & 3 deletions system/nxinit/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,12 @@ static int option_class(FAR struct service_manager_s *sm,
{
FAR struct service_s *s = list_last_entry(&sm->services, struct service_s,
node);
size_t len = strlen(argv[1]) + 1;
size_t len;
FAR struct service_class_s *c;

len = strlen(argv[1]) + 1;
len = (len >= NXINIT_SERVICE_NAME_MAX) ? NXINIT_SERVICE_NAME_MAX : len;

list_for_every_entry(&s->classes, c, struct service_class_s, node)
{
if (!strcmp(c->name, argv[1]))
Expand All @@ -217,15 +220,15 @@ static int option_class(FAR struct service_manager_s *sm,
}
}

c = malloc(sizeof(*c) + len);
c = malloc(sizeof(*c));
if (c == NULL)
{
init_err("Alloc class");
return -errno;
}

len = (len >= MAX_NXINIT_SERVICE_NAME) ? MAX_NXINIT_SERVICE_NAME : len;
memcpy(c->name, argv[1], len);
c->name[len] = '\0'; /* Always ensure null termination */
list_add_tail(&s->classes, &c->node);
return 0;
}
Expand Down
Loading