Subversion Repositories HelenOS

Rev

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

Rev 2801 Rev 2808
Line 607... Line 607...
607
}
607
}
608
 
608
 
609
#include <ipc/ipcrsc.h>
609
#include <ipc/ipcrsc.h>
610
#include <console/klog.h>
610
#include <console/klog.h>
611
 
611
 
-
 
612
static void kbox_thread_proc(void *arg)
-
 
613
{
-
 
614
    (void)arg;
-
 
615
    klog_printf("kbox_thread_proc()");
-
 
616
    while (1) {
-
 
617
        klog_printf("kbox: wait for call");
-
 
618
        ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT,
-
 
619
            SYNCH_FLAGS_NONE);
-
 
620
    }
-
 
621
}
-
 
622
 
612
/**
623
/**
613
 * Connect phone to a task specified by id.
624
 * Connect phone to a task kernel-box specified by id.
614
 *
625
 *
615
 * @return      Phone id on success, or negative error code.
626
 * @return      Phone id on success, or negative error code.
616
 */
627
 */
617
int ipc_connect_task(task_id_t taskid)
628
int ipc_connect_kbox(task_id_t taskid)
618
{
629
{
619
    int newphid;
630
    int newphid;
620
    task_t *ta;
631
    task_t *ta;
621
 
632
 
622
    newphid = phone_alloc();
633
    newphid = phone_alloc();
Line 631... Line 642...
631
    }
642
    }
632
   
643
   
633
    spinlock_lock(&ta->lock);
644
    spinlock_lock(&ta->lock);
634
    spinlock_unlock(&tasks_lock);
645
    spinlock_unlock(&tasks_lock);
635
 
646
 
636
    ipc_phone_connect(&TASK->phones[newphid], &ta->answerbox);
647
    ipc_phone_connect(&TASK->phones[newphid], &ta->kernel_box);
637
    spinlock_unlock(&ta->lock);
648
    spinlock_unlock(&ta->lock);
638
 
649
 
-
 
650
    /* FIXME: locking! */
-
 
651
    ta->kb_thread = thread_create(kbox_thread_proc,
-
 
652
        NULL, ta, 0, "kbox", false);
-
 
653
    if (!ta->kb_thread)
-
 
654
        return ENOMEM;
-
 
655
 
-
 
656
    thread_ready(ta->kb_thread);
-
 
657
 
639
    return newphid;
658
    return newphid;
640
}
659
}
641
 
660
 
642
/** @}
661
/** @}
643
 */
662
 */