aboutsummaryrefslogtreecommitdiff
path: root/sinit.c
AgeCommit message (Collapse)AuthorLines
2020-05-16Const policeHEADmasterNick Shipp-3/+3
2017-04-12Switch to dietlibcNick Shipp-4/+19
2017-04-12strerror is blotNick Shipp-9/+14
2017-02-14perror is not dieNick Shipp-0/+1
2017-02-13Bring up lo interface (fix #1)Nick Shipp-2/+26
2017-01-29Depend on dhcpcd starting wpa_supplicantNick Shipp-8/+1
2017-01-18Use config.h HOMEDIRNick Shipp-1/+1
2017-01-18Major nshp rewriteNick Shipp-5/+114
2016-09-23Use switch for fork()FRIGN-6/+4
This saves us one local variable and 2 lines of code, while improving readability by using the switch-style we are used to from other suckless projects. We are allowed to check against -1, as POSIX clearly mandates for the RETURN VALUE: "Upon successful completion, fork() shall return 0 to the child process and shall return the process ID of the child process to the parent process. Both processes shall continue to execute from the fork() function. Otherwise, -1 shall be returned to the parent process, no child process shall be created, and errno shall be set to indicate the error." [http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html] This way, checking against < 0 was overdoing it and it's sufficient to compare against -1, justifying the switch statement here.
2015-02-18Prefix signal handlers with 'sig'sin-9/+9
Apparently reboot() is an existing symbol on some BSD systems.
2014-12-04Style fixsin-9/+9
2014-12-04Don't use EXIT_{SUCCESS,FAILURE}sin-3/+3
2014-07-26Re-order includessin-2/+2
2014-04-21Break on first signal foundsin-2/+5
2014-04-19setpgid(0, 0) seems redundant after setsid()sin-1/+0
2014-03-27Fix vertical indentationsin-5/+0
2014-03-27Just block all signalssin-3/+1
2014-03-08Remove util/sin-3/+4
2014-02-16No need to setsid() earlysin-1/+0
2014-02-12Sanitize working dir - default to "/"sin-0/+2
2014-02-10It doesn't really matter what we return - just signal failuresin-2/+1
2014-02-10Use proper type for iteratorsin-1/+1
2014-02-10Remove signalfd include headersin-1/+0
2014-02-10Use sigwait() instead of signalfd()sin-13/+3
2014-02-10Unblock signals before execsin-1/+3
2014-02-10No need to typedefsin-11/+9
2014-02-10Don't clutter codesin-8/+3
2014-02-09Simplify naming of variablessin-11/+11
2014-02-08We can't reach the end of main, add a commentsin-0/+1
2014-02-08Remove unused #includessin-3/+0
2014-02-08No need to use select() - we only have one fdsin-19/+7
2014-02-08Remove Arg - it is a leftover from when we had the FIFO codesin-12/+7
2014-02-07No need for sigfd to be defined at file scopesin-2/+1
2014-02-07*p points to program namesin-1/+1
2014-02-07signum is unused - get rid of itsin-2/+0
2014-02-07Close signalfd fd on execsin-1/+1
2014-02-07Don't nest too muchsin-11/+13
2014-02-07We'll get a SIGCHLD so no need to double-forksin-7/+0
2014-02-07Don't process incomplete readssin-0/+2
If that can ever happen...
2014-02-07Some more error checking just to be suresin-5/+8
2014-02-07Poweroff on SIGUSR1sin-2/+10
2014-02-07Remove FIFO from sinitsin-59/+3
We can just run /bin/rc.shutdown reboot|poweroff etc. It complicates things when rootfs is mounted as ro etc.
2014-02-07Don't leak the fifofd if we re-init the fifosin-0/+2
2014-02-07Refactor codesin-37/+86
We no longer have two processes, one for reaping children and another for handling the FIFO. Use signalfd() to multiplex signal handling and reading from the FIFO. This setup will also allow us to capture ctrl-alt-del and to work with a read-only rootfs. To create the FIFO, we send a SIGHUP signal to init from our init scripts.
2014-02-07Allow fifopath to be NULLsin-0/+3
In that case we do not use the FIFO at all.
2014-02-07Pass the actual FIFO path to weprintf()sin-1/+1
2014-02-07Use the double fork trick to properly reap spawned processessin-4/+11
2014-02-06Create a new session as quickly as possiblesin-0/+1
2014-02-06Use a double pointersin-2/+2
2014-02-06Inform the user when execvp() failssin-0/+1