Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/trace/trace.c

    r9af1c61 ra53ed3a  
    6363#include "syscalls.h"
    6464#include "ipcp.h"
    65 #include "errors.h"
    6665#include "trace.h"
    6766
     
    9493display_mask_t display_mask;
    9594
    96 static int program_run_fibril(void *arg);
    97 static int cev_fibril(void *arg);
     95static errno_t program_run_fibril(void *arg);
     96static errno_t cev_fibril(void *arg);
    9897
    9998static void program_run(void)
     
    123122}
    124123
    125 static int program_run_fibril(void *arg)
    126 {
    127         int rc;
     124static errno_t program_run_fibril(void *arg)
     125{
     126        errno_t rc;
    128127
    129128        /*
     
    132131         */
    133132        rc = loader_run(task_ldr);
    134         if (rc != 0) {
     133        if (rc != EOK) {
    135134                printf("Error running program\n");
    136135                exit(1);
     
    144143
    145144
    146 static int connect_task(task_id_t task_id)
     145static errno_t connect_task(task_id_t task_id)
    147146{
    148147        async_sess_t *ksess = async_connect_kbox(task_id);
     
    162161        }
    163162       
    164         int rc = udebug_begin(ksess);
    165         if (rc < 0) {
    166                 printf("udebug_begin() -> %d\n", rc);
     163        errno_t rc = udebug_begin(ksess);
     164        if (rc != EOK) {
     165                printf("udebug_begin() -> %s\n", str_error_name(rc));
    167166                return rc;
    168167        }
    169168       
    170169        rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL);
    171         if (rc < 0) {
    172                 printf("udebug_set_evmask(0x%x) -> %d\n ", UDEBUG_EM_ALL, rc);
     170        if (rc != EOK) {
     171                printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
    173172                return rc;
    174173        }
     
    178177}
    179178
    180 static int get_thread_list(void)
    181 {
    182         int rc;
     179static errno_t get_thread_list(void)
     180{
     181        errno_t rc;
    183182        size_t tb_copied;
    184183        size_t tb_needed;
     
    187186        rc = udebug_thread_read(sess, thread_hash_buf,
    188187                THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed);
    189         if (rc < 0) {
    190                 printf("udebug_thread_read() -> %d\n", rc);
     188        if (rc != EOK) {
     189                printf("udebug_thread_read() -> %s\n", str_error_name(rc));
    191190                return rc;
    192191        }
     
    226225                if (sval >= -15 && sval <= 0) {
    227226                        printf("%ld %s (%s)", sval,
    228                             err_desc[-sval].name,
    229                             err_desc[-sval].desc);
     227                            str_error_name((errno_t) sval),
     228                            str_error((errno_t) sval));
    230229                } else {
    231230                        printf("%ld", sval);
     
    235234                if (sval >= -15 && sval < 0) {
    236235                        printf("%ld %s (%s)", sval,
    237                             err_desc[-sval].name,
    238                             err_desc[-sval].desc);
     236                            str_error_name((errno_t) sval),
     237                            str_error((errno_t) sval));
    239238                } else {
    240239                        printf("%ld", sval);
     
    280279}
    281280
    282 static void sc_ipc_call_async_fast(sysarg_t *sc_args, sysarg_t sc_rc)
     281static void sc_ipc_call_async_fast(sysarg_t *sc_args, errno_t sc_rc)
    283282{
    284283        ipc_call_t call;
    285284        sysarg_t phoneid;
    286285       
    287         if (sc_rc != (sysarg_t) EOK)
     286        if (sc_rc != EOK)
    288287                return;
    289288
     
    297296        IPC_SET_ARG5(call, 0);
    298297
    299         ipcp_call_out(phoneid, &call, sc_rc);
    300 }
    301 
    302 static void sc_ipc_call_async_slow(sysarg_t *sc_args, sysarg_t sc_rc)
     298        ipcp_call_out(phoneid, &call, 0);
     299}
     300
     301static void sc_ipc_call_async_slow(sysarg_t *sc_args, errno_t sc_rc)
    303302{
    304303        ipc_call_t call;
    305         int rc;
    306 
    307         if (sc_rc != (sysarg_t) EOK)
     304        errno_t rc;
     305
     306        if (sc_rc != EOK)
    308307                return;
    309308
     
    311310        rc = udebug_mem_read(sess, &call.args, sc_args[1], sizeof(call.args));
    312311
    313         if (rc >= 0) {
    314                 ipcp_call_out(sc_args[0], &call, sc_rc);
     312        if (rc == EOK) {
     313                ipcp_call_out(sc_args[0], &call, 0);
    315314        }
    316315}
     
    319318{
    320319        ipc_call_t call;
    321         int rc;
     320        errno_t rc;
    322321
    323322        if (sc_rc == 0) return;
     
    326325        rc = udebug_mem_read(sess, &call, sc_args[0], sizeof(call));
    327326       
    328         if (rc >= 0)
     327        if (rc == EOK)
    329328                ipcp_call_in(&call, sc_rc);
    330329}
     
    334333{
    335334        sysarg_t sc_args[6];
    336         int rc;
     335        errno_t rc;
    337336
    338337        /* Read syscall arguments */
    339338        rc = udebug_args_read(sess, thread_hash, sc_args);
    340339
    341         if (rc < 0) {
     340        if (rc != EOK) {
    342341                printf("error\n");
    343342                return;
     
    362361        sysarg_t sc_args[6];
    363362        int rv_type;
    364         int rc;
     363        errno_t rc;
    365364
    366365        /* Read syscall arguments */
     
    369368//      printf("[%d] ", thread_id);
    370369
    371         if (rc < 0) {
     370        if (rc != EOK) {
    372371                printf("error\n");
    373372                return;
     
    385384        switch (sc_id) {
    386385        case SYS_IPC_CALL_ASYNC_FAST:
    387                 sc_ipc_call_async_fast(sc_args, sc_rc);
     386                sc_ipc_call_async_fast(sc_args, (errno_t) sc_rc);
    388387                break;
    389388        case SYS_IPC_CALL_ASYNC_SLOW:
    390                 sc_ipc_call_async_slow(sc_args, sc_rc);
     389                sc_ipc_call_async_slow(sc_args, (errno_t) sc_rc);
    391390                break;
    392391        case SYS_IPC_WAIT:
     
    404403}
    405404
    406 static int trace_loop(void *thread_hash_arg)
    407 {
    408         int rc;
     405static errno_t trace_loop(void *thread_hash_arg)
     406{
     407        errno_t rc;
    409408        unsigned ev_type;
    410409        uintptr_t thread_hash;
     
    446445                }
    447446
    448                 if (rc >= 0) {
     447                if (rc == EOK) {
    449448                        switch (ev_type) {
    450449                        case UDEBUG_EVENT_SYSCALL_B:
     
    499498{
    500499        loader_t *ldr;
    501         int rc;
     500        errno_t rc;
    502501
    503502        /* Spawn a program loader */
     
    567566}
    568567
    569 static int cev_fibril(void *arg)
     568static errno_t cev_fibril(void *arg)
    570569{
    571570        cons_event_t event;
     
    582581               
    583582                if (!console_get_event(console, &event))
    584                         return -1;
     583                        return EINVAL;
    585584               
    586585                if (event.type == CEV_KEY) {
     
    599598        bool done;
    600599        int i;
    601         int rc;
     600        errno_t rc;
    602601
    603602        ipcp_init();
    604603
    605604        rc = get_thread_list();
    606         if (rc < 0) {
    607                 printf("Failed to get thread list (error %d)\n", rc);
     605        if (rc != EOK) {
     606                printf("Failed to get thread list (%s)\n", str_error(rc));
    608607                return;
    609608        }
     
    644643                        rc = udebug_stop(sess, thash);
    645644                        if (rc != EOK)
    646                                 printf("Error: stop -> %d\n", rc);
     645                                printf("Error: stop -> %s\n", str_error_name(rc));
    647646                        break;
    648647                case KC_R:
     
    845844int main(int argc, char *argv[])
    846845{
    847         int rc;
     846        errno_t rc;
    848847        task_exit_t texit;
    849848        int retval;
     
    860859
    861860        rc = connect_task(task_id);
    862         if (rc < 0) {
     861        if (rc != EOK) {
    863862                printf("Failed connecting to task %" PRIu64 ".\n", task_id);
    864863                return 1;
Note: See TracChangeset for help on using the changeset viewer.