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


Ignore:
Timestamp:
2018-01-04T20:50:52Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

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

    rfacacc71 r46577995  
    8383/* Forward declarations. */
    8484static void task_kill_internal(task_t *);
    85 static int tsk_constructor(void *, unsigned int);
     85static errno_t tsk_constructor(void *, unsigned int);
    8686static size_t tsk_destructor(void *obj);
    8787
     
    158158}
    159159
    160 int tsk_constructor(void *obj, unsigned int kmflags)
     160errno_t tsk_constructor(void *obj, unsigned int kmflags)
    161161{
    162162        task_t *task = (task_t *) obj;
    163163
    164         int rc = caps_task_alloc(task);
     164        errno_t rc = caps_task_alloc(task);
    165165        if (rc != EOK)
    166166                return rc;
     
    246246            (container_check(ipc_phone_0->task->container, task->container))) {
    247247                cap_handle_t phone_handle;
    248                 int rc = phone_alloc(task, &phone_handle);
     248                errno_t rc = phone_alloc(task, &phone_handle);
    249249                if (rc != EOK) {
    250250                        task->as = NULL;
     
    345345 *
    346346 */
    347 sysarg_t sys_task_get_id(sysarg64_t *uspace_taskid)
     347sys_errno_t sys_task_get_id(sysarg64_t *uspace_taskid)
    348348{
    349349        /*
     
    351351         * the lifespan of the task.
    352352         */
    353         return (sysarg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
     353        return (sys_errno_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
    354354            sizeof(TASK->taskid));
    355355}
     
    385385 *
    386386 */
    387 sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
     387sys_errno_t sys_task_set_name(const char *uspace_name, size_t name_len)
    388388{
    389389        char namebuf[TASK_NAME_BUFLEN];
     
    393393                name_len = TASK_NAME_BUFLEN - 1;
    394394       
    395         int rc = copy_from_uspace(namebuf, uspace_name, name_len);
     395        errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
    396396        if (rc != 0)
    397                 return (sysarg_t) rc;
     397                return (sys_errno_t) rc;
    398398       
    399399        namebuf[name_len] = '\0';
     
    426426 *
    427427 */
    428 sysarg_t sys_task_kill(task_id_t *uspace_taskid)
     428sys_errno_t sys_task_kill(task_id_t *uspace_taskid)
    429429{
    430430        task_id_t taskid;
    431         int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
     431        errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
    432432        if (rc != 0)
    433                 return (sysarg_t) rc;
    434        
    435         return (sysarg_t) task_kill(taskid);
     433                return (sys_errno_t) rc;
     434       
     435        return (sys_errno_t) task_kill(taskid);
    436436}
    437437
     
    539539 *
    540540 */
    541 int task_kill(task_id_t id)
     541errno_t task_kill(task_id_t id)
    542542{
    543543        if (id == 1)
     
    596596 *
    597597 */
    598 sysarg_t sys_task_exit(sysarg_t notify)
     598sys_errno_t sys_task_exit(sysarg_t notify)
    599599{
    600600        task_kill_self(notify);
Note: See TracChangeset for help on using the changeset viewer.