[srv.init] Serve a service locator protocol from init
The init process now serves as a service locator for its children, passing all children a mailbox handle on which it is serving the service locator protocol.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "loader.h"
|
||||
#include "modules.h"
|
||||
#include "service_locator.h"
|
||||
|
||||
using bootproto::module;
|
||||
using bootproto::module_type;
|
||||
@@ -28,6 +29,9 @@ main(int argc, const char **argv)
|
||||
{
|
||||
j6_status_t s;
|
||||
|
||||
j6_handle_t slp_mb = j6_handle_invalid;
|
||||
j6_handle_t slp_mb_child = j6_handle_invalid;
|
||||
|
||||
j6_handle_t sys = j6_handle_invalid;
|
||||
j6_handle_t sys_child = j6_handle_invalid;
|
||||
|
||||
@@ -45,6 +49,13 @@ main(int argc, const char **argv)
|
||||
if (s != j6_status_ok)
|
||||
return s;
|
||||
|
||||
s = j6_mailbox_create(&slp_mb);
|
||||
if (s != j6_status_ok)
|
||||
return s;
|
||||
|
||||
s = j6_handle_clone(slp_mb, &slp_mb_child,
|
||||
j6_cap_mailbox_send |
|
||||
j6_cap_object_clone);
|
||||
if (s != j6_status_ok)
|
||||
return s;
|
||||
|
||||
@@ -57,11 +68,12 @@ main(int argc, const char **argv)
|
||||
sprintf(message, " loading program module '%s' at %lx", prog.filename, prog.base_address);
|
||||
j6_log(message);
|
||||
|
||||
if (!load_program(prog, sys_child, message)) {
|
||||
if (!load_program(prog, sys_child, slp_mb_child, message)) {
|
||||
j6_log(message);
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
service_locator_start(slp_mb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user