Changeset b7fd2a0 in mainline for kernel/generic/src/udebug


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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.

Location:
kernel/generic/src/udebug
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/udebug/udebug.c

    r36f0738 rb7fd2a0  
    397397 *
    398398 */
    399 int udebug_task_cleanup(struct task *task)
     399errno_t udebug_task_cleanup(struct task *task)
    400400{
    401401        assert(mutex_locked(&task->udebug.lock));
  • kernel/generic/src/udebug/udebug_ipc.c

    r36f0738 rb7fd2a0  
    5151#include <udebug/udebug_ipc.h>
    5252
    53 int udebug_request_preprocess(call_t *call, phone_t *phone)
     53errno_t udebug_request_preprocess(call_t *call, phone_t *phone)
    5454{
    5555        switch (IPC_GET_ARG1(call->data)) {
     
    7171static void udebug_receive_begin(call_t *call)
    7272{
    73         int rc;
     73        errno_t rc;
    7474        bool active;
    7575
     
    9898static void udebug_receive_end(call_t *call)
    9999{
    100         int rc;
     100        errno_t rc;
    101101
    102102        rc = udebug_end();
     
    113113static void udebug_receive_set_evmask(call_t *call)
    114114{
    115         int rc;
     115        errno_t rc;
    116116        udebug_evmask_t mask;
    117117
     
    132132{
    133133        thread_t *t;
    134         int rc;
     134        errno_t rc;
    135135
    136136        t = (thread_t *)IPC_GET_ARG2(call->data);
     
    152152{
    153153        thread_t *t;
    154         int rc;
     154        errno_t rc;
    155155
    156156        t = (thread_t *)IPC_GET_ARG2(call->data);
     
    172172        void *buffer;
    173173        size_t copied, needed;
    174         int rc;
     174        errno_t rc;
    175175
    176176        uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */
     
    307307        thread_t *t;
    308308        sysarg_t uspace_addr;
    309         int rc;
     309        errno_t rc;
    310310        void *buffer;
    311311
     
    346346        sysarg_t to_copy;
    347347        void *buffer = NULL;
    348         int rc;
     348        errno_t rc;
    349349
    350350        t = (thread_t *) IPC_GET_ARG2(call->data);
     
    390390        unsigned size;
    391391        void *buffer = NULL;
    392         int rc;
     392        errno_t rc;
    393393
    394394        uspace_dst = IPC_GET_ARG2(call->data);
  • 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.