24 const char* argv[] = {path,
NULL};
31 if (
spawn(argv, fds,
"/usr", &attr) ==
ERR)
62 printf(
"init: timeout waiting for service file '%s'\n", serviceFiles->
items[i]);
94 printf(
"init: loading config file...\n");
102 printf(
"init: starting services...\n");
104 printf(
"init: starting programs...\n");
107 printf(
"init: executing commands...\n");
110 printf(
"init: all startup tasks completed!\n");
config_array_t * config_get_array(config_t *config, const char *section, const char *key)
Get an array of strings from a configuration file.
config_t * config_open(const char *prefix, const char *name)
Open a configuration file.
int64_t config_get_int(config_t *config, const char *section, const char *key, int64_t fallback)
Get an integer value from a configuration file.
void config_close(config_t *config)
Close a configuration file.
#define errno
Error number variable.
uint64_t stat(const char *path, stat_t *stat)
System call for retrieving info about a file or directory.
fd_t open(const char *path)
System call for opening files.
uint64_t close(fd_t fd)
System call for closing files.
pid_t spawn(const char **argv, const spawn_fd_t *fds, const char *cwd, spawn_attr_t *attr)
System call for creating child processes.
#define SPAWN_FD_END
Spawn fds termination constant.
clock_t uptime(void)
System call for retreving the time since boot.
uint8_t priority_t
Priority type.
#define NULL
Pointer error value.
__UINT64_TYPE__ fd_t
A file descriptor.
__UINT64_TYPE__ clock_t
A nanosecond time.
static void start_services(config_t *config)
static void execute_commands(config_t *config)
static void start_programs(config_t *config)
static void spawn_program(const char *path, priority_t priority)
_PUBLIC int printf(const char *_RESTRICT format,...)
_PUBLIC int system(const char *string)
_PUBLIC _NORETURN void abort(void)
_PUBLIC char * strerror(int errnum)
Configuration array structure.
Opaque configuration structure.
Stucture used to duplicate fds in spawn().
fd_t parent
The source file descriptor in the parent.
_PUBLIC void thrd_yield(void)