summaryrefslogtreecommitdiff
path: root/src/user/knob/ipc.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-02-16 20:38:53 -0500
committerBenji Dial <benji6283@gmail.com>2021-02-16 20:38:53 -0500
commit47513bd32c256c4f35e3a8ced7d9fd7e15903530 (patch)
treecafdf75d52a954814726e07445063c41bb6599f9 /src/user/knob/ipc.c
parentbd7facc4b5f53481dc85a15ba123361b2758655b (diff)
downloadportland-os-47513bd32c256c4f35e3a8ced7d9fd7e15903530.tar.gz
terminal application with ipc, shift+pause state dumper, hello world for terminal, meminfo popup program
Diffstat (limited to 'src/user/knob/ipc.c')
-rw-r--r--src/user/knob/ipc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/user/knob/ipc.c b/src/user/knob/ipc.c
index dbf1a22..5ca4bb4 100644
--- a/src/user/knob/ipc.c
+++ b/src/user/knob/ipc.c
@@ -2,10 +2,12 @@
//blocking, returns early if other process is dead.
//return value is number of bytes written.
-uint32_t try_send_ipc(_task_handle_t to, void *buffer, uint32_t size) {
+uint32_t try_send_ipc(_task_handle_t to, const void *buffer, uint32_t size) {
const uint32_t size_backup = size;
while (size) {
+ //syslogf("_ipc_send(0x%2h, 0x%h, %u)", to, buffer, size);
uint32_t res = _ipc_send(to, size, buffer);
+ //syslogf("=> %u", res);
if (!res) {
_wait_ipc_read(to);
_yield_task();
@@ -17,16 +19,19 @@ uint32_t try_send_ipc(_task_handle_t to, void *buffer, uint32_t size) {
buffer += res;
}
}
+ return size_backup;
}
//blocking, returns early if other process is dead.
//return value is number of bytes read.
-uint32_t read_ipc(_task_handle_t from, void *buffer, uint32_t size) {
+uint32_t try_read_ipc(_task_handle_t from, void *buffer, uint32_t size) {
const uint32_t size_backup = size;
while (size) {
+ //syslogf("_ipc_read(0x%2h, 0x%h, %u)", from, buffer, size);
uint32_t res = _ipc_read(from, size, buffer);
+ //syslogf("=> %u", res);
if (!res) {
- _wait_ipc_send(from);
+ _wait_ipc_sent(from);
_yield_task();
}
else if (res == -1)
@@ -36,6 +41,7 @@ uint32_t read_ipc(_task_handle_t from, void *buffer, uint32_t size) {
buffer += res;
}
}
+ return size_backup;
}
void flush_ipc(_task_handle_t from) {