Changeset b7fd2a0 in mainline for uspace/lib/c/generic/as.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
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.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/as.c

    r36f0738 rb7fd2a0  
    7474 *
    7575 */
    76 int as_area_resize(void *address, size_t size, unsigned int flags)
     76errno_t as_area_resize(void *address, size_t size, unsigned int flags)
    7777{
    78         return (int) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
     78        return (errno_t) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
    7979            (sysarg_t) size, (sysarg_t) flags);
    8080}
     
    8888 *
    8989 */
    90 int as_area_destroy(void *address)
     90errno_t as_area_destroy(void *address)
    9191{
    92         return (int) __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t) address);
     92        return (errno_t) __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t) address);
    9393}
    9494
     
    102102 *
    103103 */
    104 int as_area_change_flags(void *address, unsigned int flags)
     104errno_t as_area_change_flags(void *address, unsigned int flags)
    105105{
    106         return (int) __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
     106        return (errno_t) __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
    107107            (sysarg_t) flags);
    108108}
     
    117117 *
    118118 */
    119 int as_get_physical_mapping(const void *virt, uintptr_t *phys)
     119errno_t as_get_physical_mapping(const void *virt, uintptr_t *phys)
    120120{
    121         return (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
     121        return (errno_t) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
    122122            (sysarg_t) phys);
    123123}
Note: See TracChangeset for help on using the changeset viewer.