Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 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
  • kernel/generic/src/udebug/udebug_ops.c

    r36f0738 rb7fd2a0  
    7979 *
    8080 */
    81 static int _thread_op_begin(thread_t *thread, bool being_go)
     81static errno_t _thread_op_begin(thread_t *thread, bool being_go)
    8282{
    8383        mutex_lock(&TASK->udebug.lock);
     
    174174 *         debugging session.
    175175 */
    176 int udebug_begin(call_t *call, bool *active)
     176errno_t udebug_begin(call_t *call, bool *active)
    177177{
    178178        LOG("Debugging task %" PRIu64, TASK->taskid);
     
    219219 *
    220220 */
    221 int udebug_end(void)
     221errno_t udebug_end(void)
    222222{
    223223        LOG("Task %" PRIu64, TASK->taskid);
    224224       
    225225        mutex_lock(&TASK->udebug.lock);
    226         int rc = udebug_task_cleanup(TASK);
     226        errno_t rc = udebug_task_cleanup(TASK);
    227227        mutex_unlock(&TASK->udebug.lock);
    228228       
     
    239239 *
    240240 */
    241 int udebug_set_evmask(udebug_evmask_t mask)
     241errno_t udebug_set_evmask(udebug_evmask_t mask)
    242242{
    243243        LOG("mask = 0x%x", mask);
     
    266266 *
    267267 */
    268 int udebug_go(thread_t *thread, call_t *call)
     268errno_t udebug_go(thread_t *thread, call_t *call)
    269269{
    270270        /* On success, this will lock thread->udebug.lock. */
    271         int rc = _thread_op_begin(thread, false);
     271        errno_t rc = _thread_op_begin(thread, false);
    272272        if (rc != EOK)
    273273                return rc;
     
    297297 *
    298298 */
    299 int udebug_stop(thread_t *thread, call_t *call)
     299errno_t udebug_stop(thread_t *thread, call_t *call)
    300300{
    301301        LOG("udebug_stop()");
     
    306306         *
    307307         */
    308         int rc = _thread_op_begin(thread, true);
     308        errno_t rc = _thread_op_begin(thread, true);
    309309        if (rc != EOK)
    310310                return rc;
     
    364364 *
    365365 */
    366 int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
     366errno_t udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
    367367    size_t *needed)
    368368{
     
    428428 *
    429429 */
    430 int udebug_name_read(char **data, size_t *data_size)
     430errno_t udebug_name_read(char **data, size_t *data_size)
    431431{
    432432        size_t name_size = str_size(TASK->name) + 1;
     
    457457 *
    458458 */
    459 int udebug_args_read(thread_t *thread, void **buffer)
     459errno_t udebug_args_read(thread_t *thread, void **buffer)
    460460{
    461461        /* On success, this will lock t->udebug.lock. */
    462         int rc = _thread_op_begin(thread, false);
     462        errno_t rc = _thread_op_begin(thread, false);
    463463        if (rc != EOK)
    464464                return rc;
     
    500500 *
    501501 */
    502 int udebug_regs_read(thread_t *thread, void **buffer)
     502errno_t udebug_regs_read(thread_t *thread, void **buffer)
    503503{
    504504        /* On success, this will lock t->udebug.lock */
    505         int rc = _thread_op_begin(thread, false);
     505        errno_t rc = _thread_op_begin(thread, false);
    506506        if (rc != EOK)
    507507                return rc;
     
    536536 *
    537537 */
    538 int udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
     538errno_t udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
    539539{
    540540        /* Verify task state */
     
    553553         *
    554554         */
    555         int rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
     555        errno_t rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
    556556        mutex_unlock(&TASK->udebug.lock);
    557557       
Note: See TracChangeset for help on using the changeset viewer.