Changeset b7fd2a0 in mainline for uspace/lib/c/generic/inetping.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/lib/c/generic/inetping.c

    r36f0738 rb7fd2a0  
    4444static inetping_ev_ops_t *inetping_ev_ops;
    4545
    46 int inetping_init(inetping_ev_ops_t *ev_ops)
     46errno_t inetping_init(inetping_ev_ops_t *ev_ops)
    4747{
    4848        service_id_t inetping_svc;
    49         int rc;
     49        errno_t rc;
    5050
    5151        assert(inetping_sess == NULL);
     
    8080}
    8181
    82 int inetping_send(inetping_sdu_t *sdu)
     82errno_t inetping_send(inetping_sdu_t *sdu)
    8383{
    8484        async_exch_t *exch = async_exchange_begin(inetping_sess);
     
    8787        aid_t req = async_send_1(exch, INETPING_SEND, sdu->seq_no, &answer);
    8888
    89         int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
     89        errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
    9090        if (rc != EOK) {
    9191                async_exchange_end(exch);
     
    110110        }
    111111
    112         int retval;
     112        errno_t retval;
    113113        async_wait_for(req, &retval);
    114114
     
    116116}
    117117
    118 int inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local)
     118errno_t inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local)
    119119{
    120120        async_exch_t *exch = async_exchange_begin(inetping_sess);
     
    123123        aid_t req = async_send_0(exch, INETPING_GET_SRCADDR, &answer);
    124124
    125         int rc = async_data_write_start(exch, remote, sizeof(*remote));
     125        errno_t rc = async_data_write_start(exch, remote, sizeof(*remote));
    126126        if (rc != EOK) {
    127127                async_exchange_end(exch);
     
    136136        async_exchange_end(exch);
    137137
    138         int retval_local;
     138        errno_t retval_local;
    139139        async_wait_for(req_local, &retval_local);
    140140
     
    144144        }
    145145
    146         int retval;
     146        errno_t retval;
    147147        async_wait_for(req, &retval);
    148148
     
    170170        }
    171171
    172         int rc = async_data_write_finalize(callid, &sdu.src, size);
     172        errno_t rc = async_data_write_finalize(callid, &sdu.src, size);
    173173        if (rc != EOK) {
    174174                async_answer_0(callid, rc);
Note: See TracChangeset for help on using the changeset viewer.