609,12 → 609,23 |
#include <ipc/ipcrsc.h> |
#include <console/klog.h> |
|
static void kbox_thread_proc(void *arg) |
{ |
(void)arg; |
klog_printf("kbox_thread_proc()"); |
while (1) { |
klog_printf("kbox: wait for call"); |
ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT, |
SYNCH_FLAGS_NONE); |
} |
} |
|
/** |
* Connect phone to a task specified by id. |
* Connect phone to a task kernel-box specified by id. |
* |
* @return Phone id on success, or negative error code. |
*/ |
int ipc_connect_task(task_id_t taskid) |
int ipc_connect_kbox(task_id_t taskid) |
{ |
int newphid; |
task_t *ta; |
633,9 → 644,17 |
spinlock_lock(&ta->lock); |
spinlock_unlock(&tasks_lock); |
|
ipc_phone_connect(&TASK->phones[newphid], &ta->answerbox); |
ipc_phone_connect(&TASK->phones[newphid], &ta->kernel_box); |
spinlock_unlock(&ta->lock); |
|
/* FIXME: locking! */ |
ta->kb_thread = thread_create(kbox_thread_proc, |
NULL, ta, 0, "kbox", false); |
if (!ta->kb_thread) |
return ENOMEM; |
|
thread_ready(ta->kb_thread); |
|
return newphid; |
} |
|