Ignore:
Timestamp:
2018-01-04T20:50:52Z (8 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/console/kconsole.c

    rfacacc71 r46577995  
    563563               
    564564                uintptr_t symaddr;
    565                 int rc = symtab_addr_lookup(symname, &symaddr);
    566                 switch (rc) {
    567                 case ENOENT:
     565                errno_t rc = symtab_addr_lookup(symname, &symaddr);
     566                switch ((case_errno_t) rc) {
     567                case (case_errno_t) ENOENT:
    568568                        printf("Symbol %s not found.\n", symname);
    569569                        return false;
    570                 case EOVERFLOW:
     570                case (case_errno_t) EOVERFLOW:
    571571                        printf("Duplicate symbol %s.\n", symname);
    572572                        symtab_print_search(symname);
    573573                        return false;
    574                 case ENOTSUP:
     574                case (case_errno_t) ENOTSUP:
    575575                        printf("No symbol information available.\n");
    576576                        return false;
    577                 case EOK:
     577                case (case_errno_t) EOK:
    578578                        if (isaddr)
    579579                                *result = (sysarg_t) symaddr;
     
    591591                uint64_t value;
    592592                char *end;
    593                 int rc = str_uint64_t(text, &end, 0, false, &value);
     593                errno_t rc = str_uint64_t(text, &end, 0, false, &value);
    594594                if (end != text + len)
    595595                        rc = EINVAL;
    596                 switch (rc) {
    597                 case EINVAL:
     596                switch ((case_errno_t) rc) {
     597                case (case_errno_t) EINVAL:
    598598                        printf("Invalid number '%s'.\n", text);
    599599                        return false;
    600                 case EOVERFLOW:
     600                case (case_errno_t) EOVERFLOW:
    601601                        printf("Integer overflow in '%s'.\n", text);
    602602                        return false;
    603                 case EOK:
     603                case (case_errno_t) EOK:
    604604                        *result = (sysarg_t) value;
    605605                        if (isptr)
Note: See TracChangeset for help on using the changeset viewer.