Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
sigset_t set;
int status;
if (getpid() != 1) return 1;
sigprocmask(SIG_BLOCK, &set, 0);
if (fork()) for (;;) wait(&status);
sigprocmask(SIG_UNBLOCK, &set, 0);
setpgid(0, 0);
return execve("/etc/rc", (char *[]){ "rc", 0 }, (char *[]){ 0 });
Copy link

oxr463 commented Jan 10, 2020


Copy link

rofl0r commented Jan 11, 2020

... explicitly licensing it under the following terms (standard MIT license)

Copy link

handchin commented Feb 16, 2020

#include <sys/wait.h> should be added after the third line to stop the warnings.

Copy link

startredirect commented Jul 23, 2021

I concur with ktr in regards to disliking those particular species.

Copy link

rofl0r commented Jul 24, 2021

@startredirect wtf r u talking about

Copy link

abanoub-R commented Jan 17, 2022

i have no words

Copy link

projjalm commented Jun 25, 2022

i have no words

same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment