Changeset b7fd2a0 in mainline for uspace/app/trace/trace.c


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
  • uspace/app/trace/trace.c

    r36f0738 rb7fd2a0  
    9393display_mask_t display_mask;
    9494
    95 static int program_run_fibril(void *arg);
    96 static int cev_fibril(void *arg);
     95static errno_t program_run_fibril(void *arg);
     96static errno_t cev_fibril(void *arg);
    9797
    9898static void program_run(void)
     
    122122}
    123123
    124 static int program_run_fibril(void *arg)
    125 {
    126         int rc;
     124static errno_t program_run_fibril(void *arg)
     125{
     126        errno_t rc;
    127127
    128128        /*
     
    143143
    144144
    145 static int connect_task(task_id_t task_id)
     145static errno_t connect_task(task_id_t task_id)
    146146{
    147147        async_sess_t *ksess = async_connect_kbox(task_id);
     
    161161        }
    162162       
    163         int rc = udebug_begin(ksess);
     163        errno_t rc = udebug_begin(ksess);
    164164        if (rc != EOK) {
    165165                printf("udebug_begin() -> %s\n", str_error_name(rc));
     
    177177}
    178178
    179 static int get_thread_list(void)
    180 {
    181         int rc;
     179static errno_t get_thread_list(void)
     180{
     181        errno_t rc;
    182182        size_t tb_copied;
    183183        size_t tb_needed;
     
    225225                if (sval >= -15 && sval <= 0) {
    226226                        printf("%ld %s (%s)", sval,
    227                             str_error_name((int) sval),
    228                             str_error((int) sval));
     227                            str_error_name((errno_t) sval),
     228                            str_error((errno_t) sval));
    229229                } else {
    230230                        printf("%ld", sval);
     
    234234                if (sval >= -15 && sval < 0) {
    235235                        printf("%ld %s (%s)", sval,
    236                             str_error_name((int) sval),
    237                             str_error((int) sval));
     236                            str_error_name((errno_t) sval),
     237                            str_error((errno_t) sval));
    238238                } else {
    239239                        printf("%ld", sval);
     
    279279}
    280280
    281 static void sc_ipc_call_async_fast(sysarg_t *sc_args, int sc_rc)
     281static void sc_ipc_call_async_fast(sysarg_t *sc_args, errno_t sc_rc)
    282282{
    283283        ipc_call_t call;
     
    299299}
    300300
    301 static void sc_ipc_call_async_slow(sysarg_t *sc_args, int sc_rc)
     301static void sc_ipc_call_async_slow(sysarg_t *sc_args, errno_t sc_rc)
    302302{
    303303        ipc_call_t call;
    304         int rc;
     304        errno_t rc;
    305305
    306306        if (sc_rc != EOK)
     
    318318{
    319319        ipc_call_t call;
    320         int rc;
     320        errno_t rc;
    321321
    322322        if (sc_rc == 0) return;
     
    333333{
    334334        sysarg_t sc_args[6];
    335         int rc;
     335        errno_t rc;
    336336
    337337        /* Read syscall arguments */
     
    361361        sysarg_t sc_args[6];
    362362        int rv_type;
    363         int rc;
     363        errno_t rc;
    364364
    365365        /* Read syscall arguments */
     
    384384        switch (sc_id) {
    385385        case SYS_IPC_CALL_ASYNC_FAST:
    386                 sc_ipc_call_async_fast(sc_args, sc_rc);
     386                sc_ipc_call_async_fast(sc_args, (errno_t) sc_rc);
    387387                break;
    388388        case SYS_IPC_CALL_ASYNC_SLOW:
    389                 sc_ipc_call_async_slow(sc_args, sc_rc);
     389                sc_ipc_call_async_slow(sc_args, (errno_t) sc_rc);
    390390                break;
    391391        case SYS_IPC_WAIT:
     
    403403}
    404404
    405 static int trace_loop(void *thread_hash_arg)
    406 {
    407         int rc;
     405static errno_t trace_loop(void *thread_hash_arg)
     406{
     407        errno_t rc;
    408408        unsigned ev_type;
    409409        uintptr_t thread_hash;
     
    498498{
    499499        loader_t *ldr;
    500         int rc;
     500        errno_t rc;
    501501
    502502        /* Spawn a program loader */
     
    566566}
    567567
    568 static int cev_fibril(void *arg)
     568static errno_t cev_fibril(void *arg)
    569569{
    570570        cons_event_t event;
     
    598598        bool done;
    599599        int i;
    600         int rc;
     600        errno_t rc;
    601601
    602602        ipcp_init();
     
    844844int main(int argc, char *argv[])
    845845{
    846         int rc;
     846        errno_t rc;
    847847        task_exit_t texit;
    848848        int retval;
Note: See TracChangeset for help on using the changeset viewer.