mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user