Changeset 201abde in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2007-04-07T20:06:52Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7e58979
Parents:
6adbe3c2
Message:

make thread ID 64 bit (task ID is 64 bit already)
cleanup thread syscalls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r6adbe3c2 r201abde  
    9595
    9696SPINLOCK_INITIALIZE(tidlock);
    97 uint32_t last_tid = 0;
     97thread_id_t last_tid = 0;
    9898
    9999static slab_cache_t *thread_slab;
     
    581581                        order(t->cycles, &cycles, &suffix);
    582582                       
    583                         printf("%-6zd %-10s %#10zx %-8s %#10zx %-3ld %#10zx "
     583                        printf("%-6llu %-10s %#10zx %-8s %#10zx %-3ld %#10zx "
    584584                            "%#10zx %9llu%c ", t->tid, t->name, t,
    585585                            thread_states[t->state], t->task, t->task->context,
     
    637637 *
    638638 */
    639 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name)
     639unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id)
    640640{
    641641        thread_t *t;
    642642        char namebuf[THREAD_NAME_BUFLEN];
    643643        uspace_arg_t *kernel_uarg;
    644         uint32_t tid;
    645644        int rc;
    646645
     
    659658            false);
    660659        if (t) {
    661                 tid = t->tid;
    662660                thread_ready(t);
    663                 return (unative_t) tid;
    664         } else {
     661                if (uspace_thread_id != NULL)
     662                        return (unative_t) copy_to_uspace(uspace_thread_id, &t->tid,
     663                        sizeof(t->tid));
     664                else
     665                        return 0;
     666        } else
    665667                free(kernel_uarg);
    666         }
    667668
    668669        return (unative_t) ENOMEM;
     
    681682/** Syscall for getting TID.
    682683 *
    683  * @return Thread ID.
    684  */
    685 unative_t sys_thread_get_id(void)
     684 * @param uspace_thread_id Userspace address of 8-byte buffer where to store
     685 * current thread ID.
     686 *
     687 * @return 0 on success or an error code from @ref errno.h.
     688 */
     689unative_t sys_thread_get_id(thread_id_t *uspace_thread_id)
    686690{
    687691        /*
     
    689693         * remains constant for the lifespan of the thread.
    690694         */
    691         return THREAD->tid;
     695        return (unative_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
     696            sizeof(THREAD->tid));
    692697}
    693698
Note: See TracChangeset for help on using the changeset viewer.