[Mammoth] Add Channel object for simple IPC messages

This commit is contained in:
Drew Galbraith 2023-06-07 09:37:16 -07:00
parent 65439c163a
commit 40b21d9c75
8 changed files with 116 additions and 30 deletions

View file

@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
#include <zerrors.h>
class Channel {
public:
Channel() {}
void adopt_cap(uint64_t id);
uint64_t release_cap();
z_err_t WriteStr(const char* msg);
z_err_t ReadStr(char* buffer, uint64_t* size);
// FIXME: Close channel here.
~Channel() {}
private:
uint64_t chan_cap_ = 0;
};
uint64_t CreateChannels(Channel& c1, Channel& c2);

View file

@ -1,9 +1,12 @@
#pragma once
#include <stdint.h>
#include <zerrors.h>
void dbgln(const char*);
// Checks that the code is ok.
// if not exits the process.
void check(uint64_t);
void crash(const char*, z_err_t);