Subversion Repositories HelenOS-historic

Rev

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

Rev 1196 Rev 1210
Line 451... Line 451...
451
/** Process syscall to create new thread.
451
/** Process syscall to create new thread.
452
 *
452
 *
453
 */
453
 */
454
__native sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name)
454
__native sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name)
455
{
455
{
456
        thread_t *t;
456
    thread_t *t;
457
        char namebuf[THREAD_NAME_BUFLEN];
457
    char namebuf[THREAD_NAME_BUFLEN];
458
    uspace_arg_t *kernel_uarg;
458
    uspace_arg_t *kernel_uarg;
459
    __u32 tid;
459
    __u32 tid;
460
 
460
 
461
        copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN);
461
    copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN);
462
 
462
 
463
    kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
463
    kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
464
    copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
464
    copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t));
465
 
465
 
466
        if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) {
466
    if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) {
467
        tid = t->tid;
467
        tid = t->tid;
468
                thread_ready(t);
468
        thread_ready(t);
469
        return (__native) tid;
469
        return (__native) tid;
470
        } else {
470
    } else {
471
        free(kernel_uarg);
471
        free(kernel_uarg);
472
        }
472
    }
473
 
473
 
474
        return (__native) -1;
474
    return (__native) -1;
475
}
475
}
476
 
476
 
477
/** Process syscall to terminate thread.
477
/** Process syscall to terminate thread.
478
 *
478
 *
479
 */
479
 */
480
__native sys_thread_exit(int uspace_status)
480
__native sys_thread_exit(int uspace_status)
481
{
481
{
482
        thread_exit();
482
    thread_exit();
483
        /* Unreachable */
483
    /* Unreachable */
484
        return 0;
484
    return 0;
485
}
485
}