Linux kernel action upon init process exiting

Say I am writing my own init program running on a Linux kernel.

What happens when my init program exits with return value 0 ?

Additionally is the behaviour different if the return value is non-zero?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

What happens when my init program exits with return value 0?

This code, from the find_child_reaper function in kernel/exit.c, is run:

panic("Attempted to kill init! exitcode=0x%08xn",
       father->signal->group_exit_code ?: father->exit_code);

And consequently this message appears on your console:

Kernel panic – not syncing: Attempted to kill init! exitcode=0x00000000


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x