diff --git a/repos/ports/src/noux/child.h b/repos/ports/src/noux/child.h index 4f701d068c..5753e19fa3 100644 --- a/repos/ports/src/noux/child.h +++ b/repos/ports/src/noux/child.h @@ -20,6 +20,7 @@ #include #include #include +#include /* Noux includes */ #include @@ -103,6 +104,28 @@ namespace Noux { bool init_process(Child *child); void init_process_exited(int); + struct Child_config : Attached_ram_dataspace + { + enum { CONFIG_DS_SIZE = 4096 }; + + Child_config(Genode::Ram_session &ram) + : Attached_ram_dataspace(&ram, CONFIG_DS_SIZE) + { + Genode::strncpy(local_addr(), + "", + CONFIG_DS_SIZE); + + try { + Attached_rom_dataspace noux_config("config"); + + if (noux_config.xml().attribute_value("ld_verbose", false)) + Genode::strncpy(local_addr(), + "", + CONFIG_DS_SIZE); + } catch (Genode::Rom_connection::Rom_connection_failed) { } + } + }; + class Child : public Rpc_object, public File_descriptor_registry, public Family_member, @@ -183,6 +206,11 @@ namespace Noux { */ Environment _env; + /* + * Child configuration + */ + Child_config _config; + /** * ELF binary handling */ @@ -230,6 +258,7 @@ namespace Noux { Static_dataspace_info _ldso_ds_info; Static_dataspace_info _args_ds_info; Static_dataspace_info _env_ds_info; + Static_dataspace_info _config_ds_info; Dataspace_capability _ldso_ds; @@ -367,6 +396,7 @@ namespace Noux { _initial_thread(_resources.cpu, _pd.cap(), binary_name), _args(ARGS_DS_SIZE, args), _env(env), + _config(*Genode::env()->ram_session()), _elf(binary_name, root_dir, root_dir->dataspace(binary_name)), _sysio_ds(Genode::env()->ram_session(), SYSIO_DS_SIZE), _sysio(_sysio_ds.local_addr()), @@ -382,8 +412,10 @@ namespace Noux { _ldso_ds_info(_ds_registry, ldso_ds_cap()), _args_ds_info(_ds_registry, _args.cap()), _env_ds_info(_ds_registry, _env.cap()), + _config_ds_info(_ds_registry, _config.cap()), _ldso_ds(ldso_ds), - _child_policy(_elf._name, _elf._binary_ds, _args.cap(), _env.cap(), + _child_policy(_elf._name, _elf._binary_ds, _args.cap(), + _env.cap(), _config.cap(), _entrypoint, _local_noux_service, _local_rom_service, _parent_services, *this, parent_exit, *this, _destruct_context_cap, diff --git a/repos/ports/src/noux/child_policy.h b/repos/ports/src/noux/child_policy.h index 5121390912..75769068cf 100644 --- a/repos/ports/src/noux/child_policy.h +++ b/repos/ports/src/noux/child_policy.h @@ -35,6 +35,7 @@ namespace Noux { Init::Child_policy_provide_rom_file _binary_policy; Init::Child_policy_provide_rom_file _args_policy; Init::Child_policy_provide_rom_file _env_policy; + Init::Child_policy_provide_rom_file _config_policy; Local_noux_service &_local_noux_service; Local_rom_service &_local_rom_service; Service_registry &_parent_services; @@ -52,6 +53,7 @@ namespace Noux { Dataspace_capability binary_ds, Dataspace_capability args_ds, Dataspace_capability env_ds, + Dataspace_capability config_ds, Rpc_entrypoint &entrypoint, Local_noux_service &local_noux_service, Local_rom_service &local_rom_service, @@ -68,6 +70,7 @@ namespace Noux { _binary_policy("binary", binary_ds, &entrypoint), _args_policy( "args", args_ds, &entrypoint), _env_policy( "env", env_ds, &entrypoint), + _config_policy("config", config_ds, &entrypoint), _local_noux_service(local_noux_service), _local_rom_service(local_rom_service), _parent_services(parent_services), @@ -94,8 +97,9 @@ namespace Noux { Service *service = 0; /* check for local ROM file requests */ - if ((service = _args_policy.resolve_session_request(service_name, args)) - || (service = _env_policy.resolve_session_request(service_name, args)) + if ((service = _args_policy.resolve_session_request(service_name, args)) + || (service = _env_policy.resolve_session_request(service_name, args)) + || (service = _config_policy.resolve_session_request(service_name, args)) || (service = _binary_policy.resolve_session_request(service_name, args))) return service;