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

    r36f0738 rb7fd2a0  
    7474 * @return Error code of the conversion or EOK on success.
    7575 */
    76 static int logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
     76static errno_t logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
    7777{
    7878        async_exch_t *exchange = async_exchange_begin(session);
     
    8888        aid_t reg_msg = async_send_2(exchange, LOGGER_WRITER_MESSAGE,
    8989            log, level, NULL);
    90         int rc = async_data_write_start(exchange, message, str_size(message));
    91         int reg_msg_rc;
     90        errno_t rc = async_data_write_start(exchange, message, str_size(message));
     91        errno_t reg_msg_rc;
    9292        async_wait_for(reg_msg, &reg_msg_rc);
    9393
     
    127127 * @return Error code of the conversion or EOK on success.
    128128 */
    129 int log_level_from_str(const char *name, log_level_t *level_out)
     129errno_t log_level_from_str(const char *name, log_level_t *level_out)
    130130{
    131131        log_level_t level = LVL_FATAL;
     
    160160 * @param prog_name Program name, will be printed as part of message
    161161 */
    162 int log_init(const char *prog_name)
     162errno_t log_init(const char *prog_name)
    163163{
    164164        log_prog_name = str_dup(prog_name);
     
    198198        aid_t reg_msg = async_send_1(exchange, LOGGER_WRITER_CREATE_LOG,
    199199            parent, &answer);
    200         int rc = async_data_write_start(exchange, name, str_size(name));
    201         int reg_msg_rc;
     200        errno_t rc = async_data_write_start(exchange, name, str_size(name));
     201        errno_t reg_msg_rc;
    202202        async_wait_for(reg_msg, &reg_msg_rc);
    203203
Note: See TracChangeset for help on using the changeset viewer.