diff options
Diffstat (limited to 'libgui/msg.c')
-rw-r--r-- | libgui/msg.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/libgui/msg.c b/libgui/msg.c deleted file mode 100644 index 5f4ae39..0000000 --- a/libgui/msg.c +++ /dev/null @@ -1,31 +0,0 @@ -// MIT License, Copyright (c) 2021 Marvin Borner - -#include <assert.h> -#include <errno.h> -#include <msg.h> -#include <print.h> -#include <sys.h> - -res msg_send(u32 pid, enum message_type type, void *data, u32 size) -{ - if (!data) - return -EFAULT; - assert((signed)pid != -1 && size >= sizeof(struct message_header)); - char path[32] = { 0 }; - sprintf(path, "/proc/%d/msg", pid); - struct message_header *header = data; - header->magic = MSG_MAGIC; - header->src = getpid(); - header->type = type; - return write(path, data, 0, size); -} - -res msg_receive(void *buf, u32 size) -{ - int ret = read("/proc/self/msg", buf, 0, size); - struct message_header *header = buf; - if (header->magic == MSG_MAGIC) - return ret; - else - return -1; -} |