Add a basic IPC setup with Channel Object.

Pass a process a channel endpoint on startup that it will use to
get it's initial capabilities.
This commit is contained in:
Drew Galbraith 2023-06-07 08:24:10 -07:00
parent b79ec07636
commit 81b925eea0
15 changed files with 341 additions and 20 deletions

View file

@ -1,5 +1,6 @@
#include <mammoth/debug.h>
#include <mammoth/thread.h>
#include <zcall.h>
#define CHECK(expr) \
{ \
@ -15,7 +16,7 @@ void thread_entry(void* a) {
dbgln(static_cast<const char*>(a));
}
int main() {
int main(uint64_t bootstrap_cap) {
dbgln("Main thread");
const char* a = "a";
@ -24,5 +25,13 @@ int main() {
const char* d = "dee";
Thread t1(thread_entry, a);
Thread t2(thread_entry, b);
uint64_t num_bytes = 10;
uint64_t num_caps;
uint8_t bytes[10];
uint64_t type;
check(ZChannelRecv(bootstrap_cap, num_bytes, bytes, 0, 0, &type, &num_bytes,
&num_caps));
dbgln(reinterpret_cast<char*>(bytes));
return 0;
}