summaryrefslogtreecommitdiff
path: root/kernel/ipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ipc.c')
-rw-r--r--kernel/ipc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/ipc.c b/kernel/ipc.c
index bce346a..eb7c1b7 100644
--- a/kernel/ipc.c
+++ b/kernel/ipc.c
@@ -2,7 +2,6 @@
#include <interrupts.h>
#include <ipc.h>
#include <math.h>
-#include <sched/scheduler.h>
#include <stdbool.h>
#include <string.h>
@@ -45,6 +44,16 @@ int ipc_get_mailbox(u32 id, struct IpcMailbox **out) {
return 1;
}
+int ipc_has_data(process_t *p) {
+ if (!p) {
+ p = get_current_task();
+ }
+ struct IpcMailbox *handler = &p->ipc_mailbox;
+ u32 read_ptr = handler->read_ptr;
+ struct IpcMessage *ipc_message = &handler->data[read_ptr];
+ return ipc_message->is_used;
+}
+
int ipc_read(u8 *buffer, u32 length, u32 *sender_pid) {
struct IpcMailbox *handler = &get_current_task()->ipc_mailbox;