summaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-07-29 11:27:22 -0400
committerBenji Dial <benji@benjidial.net>2024-07-29 11:27:22 -0400
commitbe691582ee12613278af24cb5a824eeb357f6324 (patch)
tree5982ca3aad5257f515c93f62735ff3d630aa3ab3 /kernel/include
parent3636fd21e079c47bd8d62e773e178f68fe9c2052 (diff)
downloadhilbert-os-be691582ee12613278af24cb5a824eeb357f6324.tar.gz
some work on compositor
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/hilbert/kernel/application.hpp9
-rw-r--r--kernel/include/hilbert/kernel/serial.hpp6
-rw-r--r--kernel/include/hilbert/kernel/utility.hpp15
3 files changed, 27 insertions, 3 deletions
diff --git a/kernel/include/hilbert/kernel/application.hpp b/kernel/include/hilbert/kernel/application.hpp
index a4b59ff..e7c7d2e 100644
--- a/kernel/include/hilbert/kernel/application.hpp
+++ b/kernel/include/hilbert/kernel/application.hpp
@@ -112,6 +112,8 @@ namespace hilbert::kernel::application {
utility::list<string_pair> environment_variables;
public:
+ utility::string name;
+
app_memory *memory;
//set in get_framebuffer syscall
@@ -121,13 +123,16 @@ namespace hilbert::kernel::application {
uint64_t id;
//this class takes ownership of memory
- process(app_memory *memory);
+ process(app_memory *memory, const utility::string &name);
~process();
//arguments are utility::move'd
void add_environment_variable(
utility::string &&name, utility::string &&value);
+ //null if unset
+ utility::string *get_environment_variable(const utility::string &name);
+
void add_thread(thread *t);
void notify_thread_ended(thread *t, int exit_code);
void on_end_process(int exit_code);
@@ -180,6 +185,8 @@ namespace hilbert::kernel::application {
utility::maybe<unsigned> new_socket_stream_id;
public:
+ utility::string name;
+
process *owner;
//the cpu state is saved here when the thread is not running.
diff --git a/kernel/include/hilbert/kernel/serial.hpp b/kernel/include/hilbert/kernel/serial.hpp
index e7a44f2..7751fa0 100644
--- a/kernel/include/hilbert/kernel/serial.hpp
+++ b/kernel/include/hilbert/kernel/serial.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <hilbert/kernel/utility.hpp>
#include <stdint.h>
namespace hilbert::kernel {
@@ -15,6 +16,11 @@ namespace hilbert::kernel {
}
}
+ static inline void serial_putstr(const utility::string &str) {
+ for (unsigned i = 0; i < str.count; ++i)
+ serial_putchar(str.buffer[i]);
+ }
+
template <int digits, int dot_every = 4>
static inline void serial_puthex(uint64_t n) {
for (int d = digits - 1; d >= 0; --d) {
diff --git a/kernel/include/hilbert/kernel/utility.hpp b/kernel/include/hilbert/kernel/utility.hpp
index b7f1a1b..a21d3fe 100644
--- a/kernel/include/hilbert/kernel/utility.hpp
+++ b/kernel/include/hilbert/kernel/utility.hpp
@@ -107,6 +107,10 @@ namespace hilbert::kernel::utility {
n->value = value;
n->next = 0;
n->prev = last;
+ if (last)
+ last->next = n;
+ else
+ first = n;
last = n;
}
@@ -115,12 +119,19 @@ namespace hilbert::kernel::utility {
n->value = value;
n->next = 0;
n->prev = last;
+ if (last)
+ last->next = n;
+ else
+ first = n;
last = n;
}
void clear() {
- for (node *n = first; n; n = n->next)
- delete n;
+ if (first) {
+ for (node *n = first->next; n; n = n->next)
+ delete n->prev;
+ delete last;
+ }
first = 0;
last = 0;
}