Page MenuHomeFreeBSD

sbin/init/init.c: Add init_exec
ClosedPublic

Authored by trasz on Aug 8 2018, 1:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 10:13 PM
Unknown Object (File)
Fri, Dec 20, 5:51 PM
Unknown Object (File)
Sun, Dec 15, 11:52 AM
Unknown Object (File)
Thu, Dec 12, 2:06 PM
Unknown Object (File)
Oct 5 2024, 8:39 PM
Unknown Object (File)
Oct 2 2024, 8:27 PM
Unknown Object (File)
Sep 30 2024, 5:23 PM
Unknown Object (File)
Sep 30 2024, 2:59 PM
Subscribers

Details

Summary

Add init_exec kenv(1) variable, to make init(8) execute the file
after opening the console, replacing init as PID 1.

From the user point of view, it makes it possible to run eg the
shell as PID 1, using 'set init_exec=/bin/sh' at the loader(8) prompt.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18775
Build 18444: arc lint + arc unit

Event Timeline

This also introduces execute_script() and refactors code a bit. My plan is to commit this part (refactoring) first, and the actual new functionality and man page updates later.

Please split the review into refactor and new functionality. Lets handle the refactoring first.

linimon retitled this revision from Add init_exec to sbin/init/init.c: Add init_exec.Aug 9 2018, 3:53 AM
sbin/init/init.c
340

Should be NULL.

Also, why do you use '_' namespace ?

And, I suggest to move the locals to the common declaration block.

sbin/init/init.c
340

The '_' is because I wan't to avoid shadowing argv - the one passed to main(). The declarations... Normally I'd do that, but decided to comply with the way it's being done in other places in this file, which is keeping it local.

Move the code to a separate function.

This revision is now accepted and ready to land.Aug 13 2018, 7:22 PM
This revision was automatically updated to reflect the committed changes.