noux: add verbose config parameter

Explicitly enable verbose output if required.
This commit is contained in:
Alexander Boettcher 2013-08-22 14:36:15 +02:00 committed by Christian Helmuth
parent c0c3b48357
commit 773b0ecc3d
8 changed files with 40 additions and 16 deletions

View File

@ -42,7 +42,7 @@ install_config {
</start>
<start name="noux">
<resource name="RAM" quantum="1G"/>
<config>
<config verbose="yes">
<fstab> <tar name="coreutils.tar" /> </fstab>
<start name="/bin/ls"> <arg value="-Rla"/> </start>
</config>

View File

@ -41,7 +41,7 @@ install_config {
</start>
<start name="noux">
<resource name="RAM" quantum="1G"/>
<config>
<config verbose="yes">
<fstab> <tar name="noux_fork.tar" /> </fstab>
<start name="test-noux_fork"> </start>
</config>

View File

@ -183,10 +183,19 @@ append config {
<policy label="noux -> usr" root="/usr" writeable="yes" />
</config>
</start>
}
append config {
<start name="noux">
<resource name="RAM" quantum="1G" />
<config>
<fstab> }
}
if {![info exists verbose_mode]} {set verbose_mode "yes"}
append config " <config verbose=\"$verbose_mode\">"
append config {
<fstab>
}
foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" }

View File

@ -23,6 +23,7 @@ set platform_cmds {
make core &&
exit 234
}
set verbose_mode "no"
source ${genode_dir}/ports/run/noux_tool_chain.inc

View File

@ -270,7 +270,8 @@ namespace Noux {
Rpc_entrypoint &resources_ep,
bool forked,
Allocator *destruct_alloc,
Destruct_queue &destruct_queue)
Destruct_queue &destruct_queue,
bool verbose)
:
Family_member(pid, parent),
Destruct_queue::Element<Child>(destruct_alloc),
@ -303,7 +304,8 @@ namespace Noux {
_entrypoint, _local_noux_service,
_local_rm_service, _local_rom_service,
_parent_services,
*this, *this, _destruct_context_cap, _resources.ram),
*this, *this, _destruct_context_cap,
_resources.ram, verbose),
_child(forked ? Dataspace_capability() : _binary_ds,
_resources.ram.cap(), _resources.cpu.cap(),
_resources.rm.cap(), &_entrypoint, &_child_policy,
@ -312,6 +314,7 @@ namespace Noux {
*/
_local_ram_service, _local_cpu_service, _local_rm_service)
{
if (verbose)
_args.dump();
if (!forked && !_binary_ds.valid()) {

View File

@ -45,6 +45,7 @@ namespace Noux {
File_descriptor_registry &_file_descriptor_registry;
Signal_context_capability _destruct_context_cap;
Ram_session &_ref_ram_session;
bool _verbose;
public:
@ -60,7 +61,8 @@ namespace Noux {
Family_member &family_member,
File_descriptor_registry &file_descriptor_registry,
Signal_context_capability destruct_context_cap,
Ram_session &ref_ram_session)
Ram_session &ref_ram_session,
bool verbose)
:
_name(strncpy(_name_buf, name, sizeof(_name_buf))),
_labeling_policy(_name),
@ -74,7 +76,8 @@ namespace Noux {
_family_member(family_member),
_file_descriptor_registry(file_descriptor_registry),
_destruct_context_cap(destruct_context_cap),
_ref_ram_session(ref_ram_session)
_ref_ram_session(ref_ram_session),
_verbose(verbose)
{ }
const char *name() const { return _name; }
@ -119,7 +122,8 @@ namespace Noux {
void exit(int exit_value)
{
PINF("child %s exited with exit value %d", _name, exit_value);
if (_verbose || (exit_value != 0))
PERR("child %s exited with exit value %d", _name, exit_value);
/*
* Close all open file descriptors. This is necessary to unblock

View File

@ -84,7 +84,6 @@ namespace Noux {
}
_main_thread = _cpu.create_thread(name, utcb);
PINF("created main thread");
return _main_thread;
}

View File

@ -31,8 +31,9 @@
#include <destruct_queue.h>
static const bool verbose_quota = false;
static bool trace_syscalls = false;
static bool verbose_quota = false;
static bool verbose = false;
namespace Noux {
@ -291,7 +292,8 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
_resources.ep,
false,
env()->heap(),
_destruct_queue);
_destruct_queue,
verbose);
/* replace ourself by the new child at the parent */
parent()->remove(this);
@ -507,7 +509,8 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
_resources.ep,
true,
env()->heap(),
_destruct_queue);
_destruct_queue,
verbose);
Family_member::insert(child);
@ -543,6 +546,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
_sysio->wait4_out.status = exited->exit_status();
Family_member::remove(exited);
if (verbose)
PINF("submit exit signal for PID %d", exited->pid());
static_cast<Child *>(exited)->submit_exit_signal();
@ -871,6 +875,9 @@ int main(int argc, char **argv)
try {
trace_syscalls = config()->xml_node().attribute("trace_syscalls").has_value("yes");
} catch (Xml_node::Nonexistent_attribute) { }
try {
verbose = config()->xml_node().attribute("verbose").has_value("yes");
} catch (Xml_node::Nonexistent_attribute) { }
/* initialize virtual file system */
static Dir_file_system
@ -907,7 +914,8 @@ int main(int argc, char **argv)
resources_ep,
false,
env()->heap(),
destruct_queue);
destruct_queue,
verbose);
/*
* I/O channels must be dynamically allocated to handle cases where the