Changeset bc18d63 in mainline for kernel/generic/src/proc/task.c


Ignore:
Timestamp:
2009-03-01T15:00:24Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4b241f3
Parents:
4c7257b
Message:

task_set_name() syscall so that we can have names (for userspace-loaded) tasks again.

File:
1 edited

Legend:

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

    r4c7257b rbc18d63  
    250250}
    251251
     252/** Syscall for setting the task name.
     253 *
     254 * The name simplifies identifying the task in the task list.
     255 *
     256 * @param name  The new name for the task. (typically the same
     257 *              as the command used to execute it).
     258 *
     259 * @return 0 on success or an error code from @ref errno.h.
     260 */
     261unative_t sys_task_set_name(const char *uspace_name, size_t name_len)
     262{
     263        int rc;
     264        char namebuf[TASK_NAME_BUFLEN];
     265
     266        /* Cap length of name and copy it from userspace. */
     267
     268        if (name_len > TASK_NAME_BUFLEN - 1)
     269                name_len = TASK_NAME_BUFLEN - 1;
     270
     271        rc = copy_from_uspace(namebuf, uspace_name, name_len);
     272        if (rc != 0)
     273                return (unative_t) rc;
     274
     275        namebuf[name_len] = '\0';
     276        strcpy(TASK->name, namebuf);
     277
     278        return EOK;
     279}
     280
    252281/** Find task structure corresponding to task ID.
    253282 *
Note: See TracChangeset for help on using the changeset viewer.