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)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 7:45 PM
Unknown Object (File)
Tue, Jul 2, 8:26 AM
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 Not Applicable
Unit
Tests Not Applicable

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
339 ↗(On Diff #46460)

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
339 ↗(On Diff #46460)

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.