summaryrefslogtreecommitdiff
path: root/src/user/knob/ipc.c
diff options
context:
space:
mode:
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) {