Changeset 01900b6 in mainline for uspace/app/taskdump/taskdump.c


Ignore:
Timestamp:
2020-01-21T15:10:26Z (5 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
51da086
Parents:
f8fb03b
Message:

Use an optional output argument instead of errno to propagate the error

The use of errno is troublesome in all other than top-level library
functions since the value in errno might get overwritten by subsequent
inner calls on the error path (e.g. cleanup, deallocation, etc.). The
optional output argument makes it possible to explicitly ignore the
error code if it is not needed, but still to pass it reliably back to
the original caller.

This change affecs async_connect_me_to(),
async_connect_me_to_blocking(), async_connect_kbox(), service_connect(),
service_connect_blocking() and loader_connect().

File:
1 edited

Legend:

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

    rf8fb03b r01900b6  
    126126static errno_t connect_task(task_id_t task_id)
    127127{
    128         async_sess_t *ksess = async_connect_kbox(task_id);
     128        errno_t rc;
     129        async_sess_t *ksess = async_connect_kbox(task_id, &rc);
    129130
    130131        if (!ksess) {
    131                 if (errno == ENOTSUP) {
     132                if (rc == ENOTSUP) {
    132133                        printf("You do not have userspace debugging support "
    133134                            "compiled in the kernel.\n");
    134135                        printf("Compile kernel with 'Support for userspace debuggers' "
    135136                            "(CONFIG_UDEBUG) enabled.\n");
    136                         return errno;
     137                        return rc;
    137138                }
    138139
    139140                printf("Error connecting\n");
    140141                printf("async_connect_kbox(%" PRIu64 ") -> %s", task_id, str_error_name(errno));
    141                 return errno;
    142         }
    143 
    144         errno_t rc = udebug_begin(ksess);
     142                return rc;
     143        }
     144
     145        rc = udebug_begin(ksess);
    145146        if (rc != EOK) {
    146147                printf("udebug_begin() -> %s\n", str_error_name(rc));
Note: See TracChangeset for help on using the changeset viewer.