Crinit -- Configurable Rootfs Init
Loading...
Searching...
No Matches
minsetup.c File Reference

(/usr/bin/git 2025-11-10, commit: 4b42b707)

Implementation of minimal early system setup. More...

#include "minsetup.h"
#include <stdbool.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "logio.h"
Include dependency graph for minsetup.c:

Functions

int crinitForkZombieReaper (void)
 
int crinitMountDevtmpfs (void)
 
int crinitSetupSystemFs (void)
 

Detailed Description

Implementation of minimal early system setup.

Function Documentation

◆ crinitForkZombieReaper()

int crinitForkZombieReaper ( void  )

Forks the calling process, parent will enter a wait-loop, child will return.

Meant to be used during early startup if the calling process is PID 1. After the call, PID 1 will be in a permanent wait-loop to take care of orphaned processes. The new process will return from the funtion and go on.

Returns
-1 if fork() fails, 0 on success in the child process, parent process will never return

◆ crinitMountDevtmpfs()

int crinitMountDevtmpfs ( void  )

Sets up devtmpfs

Meant to be used during early startup, so that necessary dev interfaces are available. For kmsg logging the devtmpfs needs to be very early available, therefore it is separated from crinitSetupSystemFs().

Returns
0 on success, -1 on error

◆ crinitSetupSystemFs()

int crinitSetupSystemFs ( void  )

Sets up devpts, sysfs, procfs, and a tmpfs on /run

Meant to be used during early startup, so that necessary system interfaces are available.

Returns
0 on success, -1 on error