606,5 → 606,38 |
spinlock_unlock(&task->lock); |
} |
|
#include <ipc/ipcrsc.h> |
#include <console/klog.h> |
|
/** |
* Connect phone to a task specified by id. |
* |
* @return Phone id on success, or negative error code. |
*/ |
int ipc_connect_task(task_id_t taskid) |
{ |
int newphid; |
task_t *ta; |
|
newphid = phone_alloc(); |
if (newphid < 0) |
return ELIMIT; |
|
spinlock_lock(&tasks_lock); |
ta = task_find_by_id(taskid); |
if (ta == NULL) { |
spinlock_unlock(&tasks_lock); |
return ENOENT; |
} |
|
spinlock_lock(&ta->lock); |
spinlock_unlock(&tasks_lock); |
|
ipc_phone_connect(&TASK->phones[newphid], &ta->answerbox); |
spinlock_unlock(&ta->lock); |
|
return newphid; |
} |
|
/** @} |
*/ |