Rev 3438 | Rev 3566 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3438 | Rev 3565 | ||
|---|---|---|---|
| Line 706... | Line 706... | ||
| 706 | 706 | ||
| 707 | /** Process syscall to create new thread. |
707 | /** Process syscall to create new thread. |
| 708 | * |
708 | * |
| 709 | */ |
709 | */ |
| 710 | unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, |
710 | unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, |
| 711 | thread_id_t *uspace_thread_id) |
711 | size_t name_len, thread_id_t *uspace_thread_id) |
| 712 | { |
712 | { |
| 713 | thread_t *t; |
713 | thread_t *t; |
| 714 | char namebuf[THREAD_NAME_BUFLEN]; |
714 | char namebuf[THREAD_NAME_BUFLEN]; |
| 715 | uspace_arg_t *kernel_uarg; |
715 | uspace_arg_t *kernel_uarg; |
| 716 | int rc; |
716 | int rc; |
| 717 | 717 | ||
| - | 718 | if (name_len >= THREAD_NAME_BUFLEN) |
|
| - | 719 | name_len = THREAD_NAME_BUFLEN - 1; |
|
| - | 720 | ||
| 718 | rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
721 | rc = copy_from_uspace(namebuf, uspace_name, name_len); |
| 719 | if (rc != 0) |
722 | if (rc != 0) |
| 720 | return (unative_t) rc; |
723 | return (unative_t) rc; |
| 721 | 724 | ||
| - | 725 | namebuf[name_len] = '\0'; |
|
| - | 726 | ||
| 722 | /* |
727 | /* |
| 723 | * In case of failure, kernel_uarg will be deallocated in this function. |
728 | * In case of failure, kernel_uarg will be deallocated in this function. |
| 724 | * In case of success, kernel_uarg will be freed in uinit(). |
729 | * In case of success, kernel_uarg will be freed in uinit(). |
| 725 | */ |
730 | */ |
| 726 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |
731 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |