summaryrefslogtreecommitdiff
path: root/kernel/source/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/source/application.cpp')
-rw-r--r--kernel/source/application.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/source/application.cpp b/kernel/source/application.cpp
index 8070019..6df49cd 100644
--- a/kernel/source/application.cpp
+++ b/kernel/source/application.cpp
@@ -83,7 +83,8 @@ namespace hilbert::kernel::application {
resume_thread(t->saved_state);
}
- process::process(app_memory *memory) : memory(memory) {}
+ process::process(app_memory *memory, const utility::string &name)
+ : name(name), memory(memory) {}
process::~process() {
delete memory; //:p
@@ -94,6 +95,14 @@ namespace hilbert::kernel::application {
environment_variables.insert_end({.a = name, .b = value});
}
+ utility::string *process::get_environment_variable(
+ const utility::string &name) {
+ for (auto *i = environment_variables.first; i; i = i->next)
+ if (i->value.a == name)
+ return &i->value.b;
+ return 0;
+ }
+
void process::add_thread(thread *t) {
threads.insert_end(t);
}
@@ -197,8 +206,8 @@ namespace hilbert::kernel::application {
thread::thread(process *owner, uint64_t entry)
: stack_top(owner->memory->map_new_stack()), waiting_for_socket_stream(0),
- waiting_to_accept_from(0), waiting_to_connect_to(0),
- waiting_for_input(false), owner(owner) {
+ waiting_to_accept_from(0), waiting_to_connect_to(0), waiting_for_input(false),
+ name(utility::string("main", 4)), owner(owner) {
saved_state.rax = 0;
saved_state.rbx = 0;