Author: Edward Bartolo Date: To: dng Subject: Re: [DNG] Custom OS initiator. In need of some hints...
Hi,
Since Felker's minimal init as coded in C works, I will now try to
implement it in /bin/sh script, hopefully.
If it works as intended, I will post the resulting script.
Edward
On 14/06/2016, Edward Bartolo <edbarx@???> wrote: > Hi,
>
> I wrote a small shell script, nothing special, mind you, that calls rc
> S and then rc 2 if rc S is successful. With Felker's minimal init,
> which I edited to call my script version, I was able to load a useable
> XFCE4 session through which I am sending this email.
>
> I am attaching both Felker's C code as I modified it and my little
> shell script.
>
> Now I would like to ask what is the need of the fork() call in
> Felker's code. Yes, I know, it creates a child that continues
> execution just after the fork call.
>
> My reasoning goes like this. Since the parent process calling fork()
> gets a return value consisting of the child's PID, the infinite loop
> executes to reap zombies. Hence, the parent's execution end point is
> the infinite loop. The created child inherits many aspects of its
> parent and STARTS execution just after the fork() call but it gets a
> return value of ZERO. This means, the child will not enter the
> infinite loop and will call execve at the end. On termination, I
> expect the child to exit. In the end, according to my reasoning, only
> the parent should remain.
>
> I checked with XFCE4 loaded how many instances of felker2.bin existed
> and found that only one existed.
>
> Edward
>