Rev 1248 | Rev 1458 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1248 | Rev 1288 | ||
---|---|---|---|
Line 58... | Line 58... | ||
58 | #include <memstr.h> |
58 | #include <memstr.h> |
59 | #include <print.h> |
59 | #include <print.h> |
60 | #include <mm/slab.h> |
60 | #include <mm/slab.h> |
61 | #include <debug.h> |
61 | #include <debug.h> |
62 | #include <main/uinit.h> |
62 | #include <main/uinit.h> |
- | 63 | #include <syscall/copy.h> |
|
- | 64 | #include <errno.h> |
|
63 | 65 | ||
64 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
66 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
65 | 67 | ||
66 | /** Lock protecting threads_head list. For locking rules, see declaration thereof. */ |
68 | /** Lock protecting threads_head list. For locking rules, see declaration thereof. */ |
67 | SPINLOCK_INITIALIZE(threads_lock); |
69 | SPINLOCK_INITIALIZE(threads_lock); |
Line 301... | Line 303... | ||
301 | t->call_me_with = NULL; |
303 | t->call_me_with = NULL; |
302 | 304 | ||
303 | timeout_initialize(&t->sleep_timeout); |
305 | timeout_initialize(&t->sleep_timeout); |
304 | t->sleep_queue = NULL; |
306 | t->sleep_queue = NULL; |
305 | t->timeout_pending = 0; |
307 | t->timeout_pending = 0; |
- | 308 | ||
- | 309 | t->in_copy_from_uspace = false; |
|
- | 310 | t->in_copy_to_uspace = false; |
|
306 | 311 | ||
307 | t->rwlock_holder_type = RWLOCK_NONE; |
312 | t->rwlock_holder_type = RWLOCK_NONE; |
308 | 313 | ||
309 | t->task = task; |
314 | t->task = task; |
310 | 315 | ||
Line 460... | Line 465... | ||
460 | { |
465 | { |
461 | thread_t *t; |
466 | thread_t *t; |
462 | char namebuf[THREAD_NAME_BUFLEN]; |
467 | char namebuf[THREAD_NAME_BUFLEN]; |
463 | uspace_arg_t *kernel_uarg; |
468 | uspace_arg_t *kernel_uarg; |
464 | __u32 tid; |
469 | __u32 tid; |
- | 470 | int rc; |
|
465 | 471 | ||
466 | copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
472 | rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
- | 473 | if (rc != 0) |
|
- | 474 | return (__native) rc; |
|
467 | 475 | ||
468 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |
476 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |
469 | copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t)); |
477 | rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t)); |
- | 478 | if (rc != 0) { |
|
- | 479 | free(kernel_uarg); |
|
- | 480 | return (__native) rc; |
|
- | 481 | } |
|
470 | 482 | ||
471 | if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) { |
483 | if ((t = thread_create(uinit, kernel_uarg, TASK, 0, namebuf))) { |
472 | tid = t->tid; |
484 | tid = t->tid; |
473 | thread_ready(t); |
485 | thread_ready(t); |
474 | return (__native) tid; |
486 | return (__native) tid; |
475 | } else { |
487 | } else { |
476 | free(kernel_uarg); |
488 | free(kernel_uarg); |
477 | } |
489 | } |
478 | 490 | ||
479 | return (__native) -1; |
491 | return (__native) ENOMEM; |
480 | } |
492 | } |
481 | 493 | ||
482 | /** Process syscall to terminate thread. |
494 | /** Process syscall to terminate thread. |
483 | * |
495 | * |
484 | */ |
496 | */ |