[mxio][ns] wire up mxio_ns_install()
Currently it only supports installation in processes without an active namespace, but that's the only place we need to do this right now. Change-Id: If6cdc2a14cd6a654d491019afd92016655022287
Esse commit está contido em:
@@ -661,12 +661,6 @@ mx_status_t mxio_ns_chdir(mxio_ns_t* ns) {
|
||||
return MX_OK;
|
||||
}
|
||||
|
||||
mx_status_t mxio_ns_install(mxio_ns_t* ns) {
|
||||
//TODO
|
||||
return MX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
static mx_status_t ns_enum_callback(mxvn_t* vn, void* cookie,
|
||||
mx_status_t (*func)(void* cookie, const char* path,
|
||||
size_t len, mx_handle_t h)) {
|
||||
|
||||
@@ -595,6 +595,37 @@ void __libc_extensions_init(uint32_t handle_count,
|
||||
atexit(mxio_exit);
|
||||
}
|
||||
|
||||
|
||||
mx_status_t mxio_ns_install(mxio_ns_t* ns) {
|
||||
mxio_t* io = mxio_ns_open_root(ns);
|
||||
if (io == NULL) {
|
||||
return MX_ERR_IO;
|
||||
}
|
||||
|
||||
mxio_t* old_root = NULL;
|
||||
mx_status_t status;
|
||||
|
||||
mtx_lock(&mxio_lock);
|
||||
if (mxio_root_ns != NULL) {
|
||||
//TODO: support replacing an active namespace
|
||||
status = MX_ERR_ALREADY_EXISTS;
|
||||
} else {
|
||||
if (mxio_root_handle) {
|
||||
old_root = mxio_root_handle;
|
||||
}
|
||||
mxio_root_handle = io;
|
||||
status = MX_OK;
|
||||
}
|
||||
mtx_unlock(&mxio_lock);
|
||||
|
||||
if (old_root) {
|
||||
mxio_close(old_root);
|
||||
mxio_release(old_root);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
mx_status_t mxio_clone_root(mx_handle_t* handles, uint32_t* types) {
|
||||
// The root handle is established in the init hook called from
|
||||
// libc startup (or, in the special case of devmgr, installed
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário