Subversion Repositories HelenOS

Rev

Rev 2800 | Rev 2808 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2800 Rev 2801
Line 604... Line 604...
604
 
604
 
605
    spinlock_unlock(&task->answerbox.lock);
605
    spinlock_unlock(&task->answerbox.lock);
606
    spinlock_unlock(&task->lock);
606
    spinlock_unlock(&task->lock);
607
}
607
}
608
 
608
 
-
 
609
#include <ipc/ipcrsc.h>
-
 
610
#include <console/klog.h>
-
 
611
 
-
 
612
/**
-
 
613
 * Connect phone to a task specified by id.
-
 
614
 *
-
 
615
 * @return      Phone id on success, or negative error code.
-
 
616
 */
-
 
617
int ipc_connect_task(task_id_t taskid)
-
 
618
{
-
 
619
    int newphid;
-
 
620
    task_t *ta;
-
 
621
 
-
 
622
    newphid = phone_alloc();
-
 
623
    if (newphid < 0)
-
 
624
        return ELIMIT;
-
 
625
 
-
 
626
    spinlock_lock(&tasks_lock);
-
 
627
    ta = task_find_by_id(taskid);
-
 
628
    if (ta == NULL) {
-
 
629
        spinlock_unlock(&tasks_lock);
-
 
630
        return ENOENT;
-
 
631
    }
-
 
632
   
-
 
633
    spinlock_lock(&ta->lock);
-
 
634
    spinlock_unlock(&tasks_lock);
-
 
635
 
-
 
636
    ipc_phone_connect(&TASK->phones[newphid], &ta->answerbox);
-
 
637
    spinlock_unlock(&ta->lock);
-
 
638
 
-
 
639
    return newphid;
-
 
640
}
-
 
641
 
609
/** @}
642
/** @}
610
 */
643
 */