Subversion Repositories HelenOS

Rev

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

Rev 3565 Rev 3566
Line 277... Line 277...
277
 * @param arg       Thread's implementing function argument.
277
 * @param arg       Thread's implementing function argument.
278
 * @param task      Task to which the thread belongs. The caller must
278
 * @param task      Task to which the thread belongs. The caller must
279
 *          guarantee that the task won't cease to exist during the
279
 *          guarantee that the task won't cease to exist during the
280
 *          call. The task's lock may not be held.
280
 *          call. The task's lock may not be held.
281
 * @param flags     Thread flags.
281
 * @param flags     Thread flags.
282
 * @param name      Symbolic name.
282
 * @param name      Symbolic name (a copy is made).
283
 * @param uncounted Thread's accounting doesn't affect accumulated task
283
 * @param uncounted Thread's accounting doesn't affect accumulated task
284
 *          accounting.
284
 *          accounting.
285
 *
285
 *
286
 * @return      New thread's structure on success, NULL on failure.
286
 * @return      New thread's structure on success, NULL on failure.
287
 *
287
 *
Line 314... Line 314...
314
    ipl = interrupts_disable();
314
    ipl = interrupts_disable();
315
    t->saved_context.ipl = interrupts_read();
315
    t->saved_context.ipl = interrupts_read();
316
    interrupts_restore(ipl);
316
    interrupts_restore(ipl);
317
   
317
   
318
    memcpy(t->name, name, THREAD_NAME_BUFLEN);
318
    memcpy(t->name, name, THREAD_NAME_BUFLEN);
-
 
319
    t->name[THREAD_NAME_BUFLEN - 1] = '\0';
319
   
320
   
320
    t->thread_code = func;
321
    t->thread_code = func;
321
    t->thread_arg = arg;
322
    t->thread_arg = arg;
322
    t->ticks = -1;
323
    t->ticks = -1;
323
    t->cycles = 0;
324
    t->cycles = 0;
Line 713... Line 714...
713
    thread_t *t;
714
    thread_t *t;
714
    char namebuf[THREAD_NAME_BUFLEN];
715
    char namebuf[THREAD_NAME_BUFLEN];
715
    uspace_arg_t *kernel_uarg;
716
    uspace_arg_t *kernel_uarg;
716
    int rc;
717
    int rc;
717
 
718
 
718
    if (name_len >= THREAD_NAME_BUFLEN)
719
    if (name_len > THREAD_NAME_BUFLEN - 1)
719
        name_len = THREAD_NAME_BUFLEN - 1;
720
        name_len = THREAD_NAME_BUFLEN - 1;
720
 
721
 
721
    rc = copy_from_uspace(namebuf, uspace_name, name_len);
722
    rc = copy_from_uspace(namebuf, uspace_name, name_len);
722
    if (rc != 0)
723
    if (rc != 0)
723
        return (unative_t) rc;
724
        return (unative_t) rc;