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>
<start name="noux"> <start name="noux">
<resource name="RAM" quantum="1G"/> <resource name="RAM" quantum="1G"/>
<config> <config verbose="yes">
<fstab> <tar name="coreutils.tar" /> </fstab> <fstab> <tar name="coreutils.tar" /> </fstab>
<start name="/bin/ls"> <arg value="-Rla"/> </start> <start name="/bin/ls"> <arg value="-Rla"/> </start>
</config> </config>

View File

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

View File

@ -183,10 +183,19 @@ append config {
<policy label="noux -> usr" root="/usr" writeable="yes" /> <policy label="noux -> usr" root="/usr" writeable="yes" />
</config> </config>
</start> </start>
}
append config {
<start name="noux"> <start name="noux">
<resource name="RAM" quantum="1G" /> <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 { foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" } append config " <tar name=\"$pkg.tar\" />" }

View File

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

View File

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

View File

@ -45,6 +45,7 @@ namespace Noux {
File_descriptor_registry &_file_descriptor_registry; File_descriptor_registry &_file_descriptor_registry;
Signal_context_capability _destruct_context_cap; Signal_context_capability _destruct_context_cap;
Ram_session &_ref_ram_session; Ram_session &_ref_ram_session;
bool _verbose;
public: public:
@ -60,7 +61,8 @@ namespace Noux {
Family_member &family_member, Family_member &family_member,
File_descriptor_registry &file_descriptor_registry, File_descriptor_registry &file_descriptor_registry,
Signal_context_capability destruct_context_cap, 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))), _name(strncpy(_name_buf, name, sizeof(_name_buf))),
_labeling_policy(_name), _labeling_policy(_name),
@ -74,7 +76,8 @@ namespace Noux {
_family_member(family_member), _family_member(family_member),
_file_descriptor_registry(file_descriptor_registry), _file_descriptor_registry(file_descriptor_registry),
_destruct_context_cap(destruct_context_cap), _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; } const char *name() const { return _name; }
@ -119,7 +122,8 @@ namespace Noux {
void exit(int exit_value) 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 * 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); _main_thread = _cpu.create_thread(name, utcb);
PINF("created main thread");
return _main_thread; return _main_thread;
} }

View File

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