Started implementing namespaces
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <mio/object.h>
|
||||
#include <mio/fd.h>
|
||||
#include <mio/fs.h>
|
||||
#include <mio/namespace.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -265,6 +266,29 @@ int __crt_init(mx_handle_t bootstrap)
|
||||
|
||||
init_stdio(handle_info, nr_handles);
|
||||
|
||||
mio_namespace *ns = mio_namespace_create();
|
||||
|
||||
if (msg->names_num > 0) {
|
||||
for (size_t i = 0; i < nr_handles; i++) {
|
||||
int type = MX_B_HND_TYPE(handle_info[i].info);
|
||||
int arg = MX_B_HND_ARG(handle_info[i].info);
|
||||
|
||||
if (type != MX_B_NS_DIR && type != MX_B_TUNNEL_CWD) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *path = namep[arg];
|
||||
|
||||
if (type == MX_B_TUNNEL_CWD) {
|
||||
mio_set_cwd(handle_info[i].handle, path);
|
||||
} else {
|
||||
mio_namespace_add_entry(ns, path, handle_info[i].handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mio_set_global_namespace(ns);
|
||||
|
||||
dbg_log("calling main\n");
|
||||
int ret = main(msg->args_num, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user