I did read init.c, it didn't help. But my tests have shown that things are willing to run in place of init, but, stdout/stderr/stdin are unavailable to init? I assume this is some kind of security thing. freopen() has failed me here.
=== Wow, what chatter. === === It is obvious that you have not read the source to our init.c, === nor looked at the commit logs. === === I don't understand society is producing a generation of people === incapable of self-help. Probably something in the water. === ===> === On Wed, Apr 30, 2014 at 12:02 AM, Ben Dibell ===> === wrote: ===> ===> Hi, I've tried other resources, even reading the source for init, ===> but I ===> ===> can't seem to locate the magic that makes /sbin/init the approved ===> init. ===> ===> I'm porting my init system Epoch to BSD for personal reasons, and ===> I'd ===> ===> like ===> ===> it to work under OpenBSD, which I've been enjoying as of late. I ===> come ===> ===> from ===> ===> the linux world where init=/bin/sh is perfectly valid, ===> === ===> === Hmm, I haven't tried, but /bin/sh should work. ===> === ===> === ===> ===> so some aspects are ===> ===> probably simpler in Linux. I am hoping there is a concise and clean ===> ===> explanation as to how to write/port an init system to BSD. Is it ===> signal ===> ===> trickery? A checksum burned into the kernel? I'm lost. I'm given ===> "init ===> ===> has ===> ===> died, signal 0 exit 0" or something nearly identical to this. ===> === ===> === This means the original thread of process 1 exited. Are you by ===> chance ===> === trying to write a threaded init, because there are a number of ===> places ===> === where the kernel currently assumes pid 1 is not a threaded process. ===> === ===> === ===> === Philip Guenther ===> === ===> ===> Thanks, hmm, yeah no, /bin/sh didn't work. Epoch is single threaded and ===> is ===> mature and stable on Linux at 1.0.1. I tried a statically linked build ===> but ===> it didn't work either. ===> It's possible it's a bug in Epoch somewhere, but I've read the code many ===> times and it should have printed something to the console, anything by ===> the ===> time it dies, since all the previous code seems pretty fool-proof, and ===> since /bin/sh wouldn't work as an init either, it makes me strongly ===> suspect it's not Epoch's fault. ===> ===> === BSD has an init system. The source is there. ===> === What exactly is your problem? What do you want to do ===> === with your init that you can't do with the default install? ===> ===> Jan: A lot of things can be done in Epoch easier, actually. Especially ===> status related stuff is quite nice in Epoch, I made sure of it since I ===> use ===> it a lot. To answer the question as to what problems I have, the agency ===> has not yet finished collating the list. I'll be sure to write when they ===> complete it. ===> ===> === Not that I know what init=/bin/sh means, ===> === but how does it make anything simpler? ===> ===> It allows me to use not only any binary as init, but Linux permits ===> executable scripts with a hashbang to be run as init as well. Reaping ===> however, is a little more complicated. Most shells seem to do this on ===> their own somehow anyways. ===> === === === Acrt