diff options
| author | Michael Bebenita <mbebenita@mozilla.com> | 2010-08-27 18:26:36 -0700 |
|---|---|---|
| committer | Michael Bebenita <mbebenita@mozilla.com> | 2010-09-07 18:41:07 -0700 |
| commit | f8ff013e3cc737b92b5a140dfd0ddcc5ab6773d9 (patch) | |
| tree | 84daaf59d1eb899021e681927e1103cf08b91dd5 /src/rt/rust_kernel.cpp | |
| parent | ffdb5fc8582c77eef7b3a30859eaa216872525a4 (diff) | |
| download | rust-f8ff013e3cc737b92b5a140dfd0ddcc5ab6773d9.tar.gz rust-f8ff013e3cc737b92b5a140dfd0ddcc5ab6773d9.zip | |
Added a few utility classes, cleaned up the include order of .h files, and started to make the Rust kernel own domain message queues rather than the Rust domains themselves.
Diffstat (limited to 'src/rt/rust_kernel.cpp')
| -rw-r--r-- | src/rt/rust_kernel.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp new file mode 100644 index 00000000000..b82e46152fa --- /dev/null +++ b/src/rt/rust_kernel.cpp @@ -0,0 +1,43 @@ +#include "rust_internal.h" + +rust_kernel::rust_kernel(rust_srv *srv) : + _region(srv->local_region), + _log(srv, NULL), + domains(srv->local_region), + message_queues(srv->local_region) { + // Nop. +} + +rust_kernel::~rust_kernel() { + // Nop. +} + +void +rust_kernel::register_domain(rust_dom *dom) { + domains.append(dom); +} + +void +rust_kernel::deregister_domain(rust_dom *dom) { + domains.remove(dom); +} + +void +rust_kernel::log_all_domain_state() { + log(rust_log::KERN, "log_all_domain_state: %d domains", domains.length()); + for (uint32_t i = 0; i < domains.length(); i++) { + domains[i]->log_state(); + } +} + +void +rust_kernel::log(uint32_t type_bits, char const *fmt, ...) { + char buf[256]; + if (_log.is_tracing(type_bits)) { + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + _log.trace_ln(NULL, type_bits, buf); + va_end(args); + } +} |
