modified version of felker's init

This commit is contained in:
Bradford Morgan White
2026-02-08 12:01:20 -05:00
parent 45e80e1f07
commit 86ba125208
6 changed files with 115 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#include <signal.h>
#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>
int main()
{
if (getpid() != 1) return 1;
sigset_t set, old;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &old);
posix_spawnattr_t attr;
posix_spawnattr_init(&attr);
posix_spawnattr_setsigmask(&attr, &old);
posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSID|POSIX_SPAWN_SETSIGMASK);
posix_spawn(0, "/etc/rc", 0, &attr,
((char *[]){ "rc", 0 }),
((char *[]){ 0 }));
for (;;) wait(0);
}