mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
parent
7478114b23
commit
28223e3146
@ -99,7 +99,7 @@ namespace Noux {
|
||||
class Child;
|
||||
|
||||
bool is_init_process(Child *child);
|
||||
void init_process_exited();
|
||||
void init_process_exited(int);
|
||||
|
||||
class Child : public Rpc_object<Session>,
|
||||
public File_descriptor_registry,
|
||||
@ -390,7 +390,7 @@ namespace Noux {
|
||||
_entrypoint.dissolve(this);
|
||||
|
||||
if (is_init_process(this))
|
||||
init_process_exited();
|
||||
init_process_exited(_child_policy.exit_value());
|
||||
}
|
||||
|
||||
void start() { _entrypoint.activate(); }
|
||||
@ -412,7 +412,7 @@ namespace Noux {
|
||||
PINF("init process exited");
|
||||
|
||||
/* trigger exit of main event loop */
|
||||
init_process_exited();
|
||||
init_process_exited(_child_policy.exit_value());
|
||||
} else {
|
||||
Signal_transmitter(_destruct_context_cap).submit();
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ namespace Noux {
|
||||
File_descriptor_registry &_file_descriptor_registry;
|
||||
Signal_context_capability _destruct_context_cap;
|
||||
Ram_session &_ref_ram_session;
|
||||
int _exit_value;
|
||||
bool _verbose;
|
||||
|
||||
public:
|
||||
@ -79,9 +80,16 @@ namespace Noux {
|
||||
_file_descriptor_registry(file_descriptor_registry),
|
||||
_destruct_context_cap(destruct_context_cap),
|
||||
_ref_ram_session(ref_ram_session),
|
||||
_exit_value(~0),
|
||||
_verbose(verbose)
|
||||
{ }
|
||||
|
||||
int exit_value() const { return _exit_value; }
|
||||
|
||||
/****************************
|
||||
** Child policy interface **
|
||||
****************************/
|
||||
|
||||
const char *name() const { return _name; }
|
||||
|
||||
Service *resolve_session_request(const char *service_name,
|
||||
@ -124,6 +132,8 @@ namespace Noux {
|
||||
|
||||
void exit(int exit_value)
|
||||
{
|
||||
_exit_value = exit_value;
|
||||
|
||||
if (_verbose || (exit_value != 0))
|
||||
PERR("child %s exited with exit value %d", _name, exit_value);
|
||||
|
||||
|
@ -50,9 +50,10 @@ static bool verbose = false;
|
||||
namespace Noux {
|
||||
|
||||
static Noux::Child *init_child;
|
||||
static int exit_value = ~0;
|
||||
|
||||
bool is_init_process(Child *child) { return child == init_child; }
|
||||
void init_process_exited() { init_child = 0; }
|
||||
void init_process_exited(int exit) { init_child = 0; exit_value = exit; }
|
||||
|
||||
};
|
||||
|
||||
@ -1169,6 +1170,6 @@ int main(int argc, char **argv)
|
||||
env()->ram_session()->used());
|
||||
}
|
||||
|
||||
PINF("-- exiting noux ---");
|
||||
return 0;
|
||||
PINF("--- exiting noux ---");
|
||||
return exit_value;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user