Changeset b7fd2a0 in mainline for uspace/lib/c/generic/io


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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.

Location:
uspace/lib/c/generic/io
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/chardev.c

    r36f0738 rb7fd2a0  
    5050 * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
    5151 */
    52 int chardev_open(async_sess_t *sess, chardev_t **rchardev)
     52errno_t chardev_open(async_sess_t *sess, chardev_t **rchardev)
    5353{
    5454        chardev_t *chardev;
     
    9494 * @return EOK on success or non-zero error code
    9595 */
    96 int chardev_read(chardev_t *chardev, void *buf, size_t size, size_t *nread)
     96errno_t chardev_read(chardev_t *chardev, void *buf, size_t size, size_t *nread)
    9797{
    9898        async_exch_t *exch = async_exchange_begin(chardev->sess);
     
    105105        ipc_call_t answer;
    106106        aid_t req = async_send_0(exch, CHARDEV_READ, &answer);
    107         int rc = async_data_read_start(exch, buf, size);
     107        errno_t rc = async_data_read_start(exch, buf, size);
    108108        async_exchange_end(exch);
    109109
     
    114114        }
    115115
    116         int retval;
     116        errno_t retval;
    117117        async_wait_for(req, &retval);
    118118
     
    124124        *nread = IPC_GET_ARG2(answer);
    125125        /* In case of partial success, ARG1 contains the error code */
    126         return (int) IPC_GET_ARG1(answer);
     126        return (errno_t) IPC_GET_ARG1(answer);
    127127
    128128}
     
    144144 * @return EOK on success or non-zero error code
    145145 */
    146 static int chardev_write_once(chardev_t *chardev, const void *data,
     146static errno_t chardev_write_once(chardev_t *chardev, const void *data,
    147147    size_t size, size_t *nwritten)
    148148{
     
    150150        ipc_call_t answer;
    151151        aid_t req;
    152         int rc;
     152        errno_t rc;
    153153
    154154        /* Break down large transfers */
     
    166166        }
    167167
    168         int retval;
     168        errno_t retval;
    169169        async_wait_for(req, &retval);
    170170        if (retval != EOK) {
     
    175175        *nwritten = IPC_GET_ARG2(answer);
    176176        /* In case of partial success, ARG1 contains the error code */
    177         return (int) IPC_GET_ARG1(answer);
     177        return (errno_t) IPC_GET_ARG1(answer);
    178178}
    179179
     
    193193 * @return EOK on success or non-zero error code
    194194 */
    195 int chardev_write(chardev_t *chardev, const void *data, size_t size,
     195errno_t chardev_write(chardev_t *chardev, const void *data, size_t size,
    196196    size_t *nwritten)
    197197{
    198198        size_t nw;
    199199        size_t p;
    200         int rc;
     200        errno_t rc;
    201201
    202202        p = 0;
  • uspace/lib/c/generic/io/chardev_srv.c

    r36f0738 rb7fd2a0  
    4949        size_t size;
    5050        size_t nread;
    51         int rc;
     51        errno_t rc;
    5252        ipc_callid_t rcallid;
    5353
     
    9191        size_t size;
    9292        size_t nwr;
    93         int rc;
     93        errno_t rc;
    9494
    9595        rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
     
    132132}
    133133
    134 int chardev_conn(ipc_callid_t iid, ipc_call_t *icall, chardev_srvs_t *srvs)
     134errno_t chardev_conn(ipc_callid_t iid, ipc_call_t *icall, chardev_srvs_t *srvs)
    135135{
    136136        chardev_srv_t *srv;
    137         int rc;
     137        errno_t rc;
    138138
    139139        /* Accept the connection */
  • uspace/lib/c/generic/io/con_srv.c

    r36f0738 rb7fd2a0  
    4242#include <io/con_srv.h>
    4343
    44 static int console_ev_encode(cons_event_t *event, ipc_call_t *call)
     44static errno_t console_ev_encode(cons_event_t *event, ipc_call_t *call)
    4545{
    4646        IPC_SET_ARG1(*call, event->type);
     
    7171        void *buf;
    7272        size_t size;
    73         int rc;
     73        errno_t rc;
    7474        ipc_callid_t rcallid;
    7575
     
    113113        void *data;
    114114        size_t size;
    115         int rc;
     115        errno_t rc;
    116116
    117117        rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
     
    178178    ipc_call_t *call)
    179179{
    180         int rc;
     180        errno_t rc;
    181181        sysarg_t col;
    182182        sysarg_t row;
     
    194194    ipc_call_t *call)
    195195{
    196         int rc;
     196        errno_t rc;
    197197        sysarg_t cols;
    198198        sysarg_t rows;
     
    210210    ipc_call_t *call)
    211211{
    212         int rc;
     212        errno_t rc;
    213213        console_caps_t ccap;
    214214
     
    295295    ipc_call_t *call)
    296296{
    297         int rc;
     297        errno_t rc;
    298298        cons_event_t event;
    299299        ipc_call_t result;
     
    340340}
    341341
    342 int con_conn(ipc_callid_t iid, ipc_call_t *icall, con_srvs_t *srvs)
     342errno_t con_conn(ipc_callid_t iid, ipc_call_t *icall, con_srvs_t *srvs)
    343343{
    344344        con_srv_t *srv;
    345         int rc;
     345        errno_t rc;
    346346
    347347        /* Accept the connection */
  • uspace/lib/c/generic/io/console.c

    r36f0738 rb7fd2a0  
    9090}
    9191
    92 int console_get_size(console_ctrl_t *ctrl, sysarg_t *cols, sysarg_t *rows)
    93 {
    94         async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    95         int rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows);
     92errno_t console_get_size(console_ctrl_t *ctrl, sysarg_t *cols, sysarg_t *rows)
     93{
     94        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     95        errno_t rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows);
    9696        async_exchange_end(exch);
    9797       
     
    129129}
    130130
    131 int console_get_color_cap(console_ctrl_t *ctrl, sysarg_t *ccap)
    132 {
    133         async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    134         int rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap);
     131errno_t console_get_color_cap(console_ctrl_t *ctrl, sysarg_t *ccap)
     132{
     133        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     134        errno_t rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap);
    135135        async_exchange_end(exch);
    136136       
     
    138138}
    139139
    140 int console_get_pos(console_ctrl_t *ctrl, sysarg_t *col, sysarg_t *row)
    141 {
    142         async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
    143         int rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row);
     140errno_t console_get_pos(console_ctrl_t *ctrl, sysarg_t *col, sysarg_t *row)
     141{
     142        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     143        errno_t rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row);
    144144        async_exchange_end(exch);
    145145       
     
    154154}
    155155
    156 static int console_ev_decode(ipc_call_t *call, cons_event_t *event)
     156static errno_t console_ev_decode(ipc_call_t *call, cons_event_t *event)
    157157{
    158158        event->type = IPC_GET_ARG1(*call);
     
    188188                async_exchange_end(exch);
    189189               
    190                 int rc;
     190                errno_t rc;
    191191                async_wait_for(aid, &rc);
    192192               
     
    202202                }
    203203        } else {
    204                 int retval;
     204                errno_t retval;
    205205                async_wait_for(ctrl->input_aid, &retval);
    206206               
     
    212212                }
    213213               
    214                 int rc = console_ev_decode(&ctrl->input_call, event);
     214                errno_t rc = console_ev_decode(&ctrl->input_call, event);
    215215                if (rc != EOK) {
    216216                        errno = rc;
     
    235235        }
    236236       
    237         int retval;
    238         int rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout);
     237        errno_t retval;
     238        errno_t rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout);
    239239        if (rc != EOK) {
    240240                *timeout = 0;
  • uspace/lib/c/generic/io/input.c

    r36f0738 rb7fd2a0  
    4545static void input_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    4646
    47 int input_open(async_sess_t *sess, input_ev_ops_t *ev_ops,
     47errno_t input_open(async_sess_t *sess, input_ev_ops_t *ev_ops,
    4848    void *arg, input_t **rinput)
    4949{
     
    5959
    6060        port_id_t port;
    61         int rc = async_create_callback_port(exch, INTERFACE_INPUT_CB, 0, 0,
     61        errno_t rc = async_create_callback_port(exch, INTERFACE_INPUT_CB, 0, 0,
    6262            input_cb_conn, input, &port);
    6363       
     
    8383}
    8484
    85 int input_activate(input_t *input)
     85errno_t input_activate(input_t *input)
    8686{
    8787        async_exch_t *exch = async_exchange_begin(input->sess);
    88         int rc = async_req_0_0(exch, INPUT_ACTIVATE);
     88        errno_t rc = async_req_0_0(exch, INPUT_ACTIVATE);
    8989        async_exchange_end(exch);
    9090       
     
    9595    ipc_call_t *call)
    9696{
    97         int rc = input->ev_ops->active(input);
     97        errno_t rc = input->ev_ops->active(input);
    9898        async_answer_0(callid, rc);
    9999}
     
    102102    ipc_call_t *call)
    103103{
    104         int rc = input->ev_ops->deactive(input);
     104        errno_t rc = input->ev_ops->deactive(input);
    105105        async_answer_0(callid, rc);
    106106}
     
    113113        keymod_t mods;
    114114        wchar_t c;
    115         int rc;
     115        errno_t rc;
    116116
    117117        type = IPC_GET_ARG1(*call);
     
    129129        int dx;
    130130        int dy;
    131         int rc;
     131        errno_t rc;
    132132
    133133        dx = IPC_GET_ARG1(*call);
     
    145145        unsigned max_x;
    146146        unsigned max_y;
    147         int rc;
     147        errno_t rc;
    148148
    149149        x = IPC_GET_ARG1(*call);
     
    161161        int bnum;
    162162        int press;
    163         int rc;
     163        errno_t rc;
    164164
    165165        bnum = IPC_GET_ARG1(*call);
  • uspace/lib/c/generic/io/io.c

    r36f0738 rb7fd2a0  
    297297                flags |= WALK_MAY_CREATE;
    298298        int file;
    299         int rc = vfs_lookup(path, flags, &file);
     299        errno_t rc = vfs_lookup(path, flags, &file);
    300300        if (rc != EOK) {
    301301                errno = rc;
     
    364364static int _fclose_nofree(FILE *stream)
    365365{
    366         int rc = 0;
     366        errno_t rc = 0;
    367367       
    368368        fflush(stream);
     
    433433static size_t _fread(void *buf, size_t size, size_t nmemb, FILE *stream)
    434434{
    435         int rc;
     435        errno_t rc;
    436436        size_t nread;
    437437
     
    462462static size_t _fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream)
    463463{
    464         int rc;
     464        errno_t rc;
    465465        size_t nwritten;
    466466
     
    495495static void _ffillbuf(FILE *stream)
    496496{
    497         int rc;
     497        errno_t rc;
    498498        size_t nread;
    499499
     
    801801int fseek(FILE *stream, long offset, int whence)
    802802{
    803         int rc;
     803        errno_t rc;
    804804
    805805        if (stream->error)
     
    877877       
    878878        if ((stream->fd >= 0) && (stream->need_sync)) {
    879                 int rc;
     879                errno_t rc;
    880880
    881881                /**
     
    934934}
    935935
    936 int vfs_fhandle(FILE *stream, int *handle)
     936errno_t vfs_fhandle(FILE *stream, int *handle)
    937937{
    938938        if (stream->fd >= 0) {
  • uspace/lib/c/generic/io/kio.c

    r36f0738 rb7fd2a0  
    4343#include <io/printf_core.h>
    4444
    45 int kio_write(const void *buf, size_t size, size_t *nwritten)
     45errno_t kio_write(const void *buf, size_t size, size_t *nwritten)
    4646{
    47         int rc = (int) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size);
     47        errno_t rc = (errno_t) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size);
    4848       
    4949        if (rc == EOK)
  • uspace/lib/c/generic/io/klog.c

    r36f0738 rb7fd2a0  
    4242#include <abi/log.h>
    4343
    44 int klog_write(log_level_t lvl, const void *buf, size_t size)
     44errno_t klog_write(log_level_t lvl, const void *buf, size_t size)
    4545{
    46         return (int) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
     46        return (errno_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
    4747            size, lvl);
    4848}
    4949
    50 int klog_read(void *data, size_t size, size_t *nread)
     50errno_t klog_read(void *data, size_t size, size_t *nread)
    5151{
    52         return (int) __SYSCALL5(SYS_KLOG, KLOG_READ, (uintptr_t) data,
     52        return (errno_t) __SYSCALL5(SYS_KLOG, KLOG_READ, (uintptr_t) data,
    5353            size, 0, (sysarg_t) nread);
    5454}
  • 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
  • uspace/lib/c/generic/io/logctl.c

    r36f0738 rb7fd2a0  
    4343static async_sess_t *logger_session = NULL;
    4444
    45 static int start_logger_exchange(async_exch_t **exchange_out)
     45static errno_t start_logger_exchange(async_exch_t **exchange_out)
    4646{
    4747        assert(exchange_out != NULL);
     
    7878 * @return Error code of the conversion or EOK on success.
    7979 */
    80 int logctl_set_default_level(log_level_t new_level)
     80errno_t logctl_set_default_level(log_level_t new_level)
    8181{
    8282        async_exch_t *exchange = NULL;
    83         int rc = start_logger_exchange(&exchange);
     83        errno_t rc = start_logger_exchange(&exchange);
    8484        if (rc != EOK)
    8585                return rc;
    8686
    87         rc = (int) async_req_1_0(exchange,
     87        rc = (errno_t) async_req_1_0(exchange,
    8888            LOGGER_CONTROL_SET_DEFAULT_LEVEL, new_level);
    8989
     
    101101 * @return Error code of the conversion or EOK on success.
    102102 */
    103 int logctl_set_log_level(const char *logname, log_level_t new_level)
     103errno_t logctl_set_log_level(const char *logname, log_level_t new_level)
    104104{
    105105        async_exch_t *exchange = NULL;
    106         int rc = start_logger_exchange(&exchange);
     106        errno_t rc = start_logger_exchange(&exchange);
    107107        if (rc != EOK)
    108108                return rc;
     
    111111            new_level, NULL);
    112112        rc = async_data_write_start(exchange, logname, str_size(logname));
    113         int reg_msg_rc;
     113        errno_t reg_msg_rc;
    114114        async_wait_for(reg_msg, &reg_msg_rc);
    115115
     
    119119                return rc;
    120120
    121         return (int) reg_msg_rc;
     121        return (errno_t) reg_msg_rc;
    122122}
    123123
     
    126126 * @return Error code or EOK on success.
    127127 */
    128 int logctl_set_root(void)
     128errno_t logctl_set_root(void)
    129129{
    130130        async_exch_t *exchange = NULL;
    131         int rc = start_logger_exchange(&exchange);
     131        errno_t rc = start_logger_exchange(&exchange);
    132132        if (rc != EOK)
    133133                return rc;
     
    137137        rc = vfs_pass_handle(vfs_exch, vfs_root(), exchange);
    138138        vfs_exchange_end(vfs_exch);
    139         int reg_msg_rc;
     139        errno_t reg_msg_rc;
    140140        async_wait_for(reg_msg, &reg_msg_rc);
    141141
     
    145145                return rc;
    146146
    147         return (int) reg_msg_rc;
     147        return (errno_t) reg_msg_rc;
    148148}
    149149
  • uspace/lib/c/generic/io/output.c

    r36f0738 rb7fd2a0  
    4040#include <io/output.h>
    4141
    42 int output_yield(async_sess_t *sess)
     42errno_t output_yield(async_sess_t *sess)
    4343{
    4444        async_exch_t *exch = async_exchange_begin(sess);
    45         int ret = async_req_0_0(exch, OUTPUT_YIELD);
     45        errno_t ret = async_req_0_0(exch, OUTPUT_YIELD);
    4646        async_exchange_end(exch);
    4747       
     
    4949}
    5050
    51 int output_claim(async_sess_t *sess)
     51errno_t output_claim(async_sess_t *sess)
    5252{
    5353        async_exch_t *exch = async_exchange_begin(sess);
    54         int ret = async_req_0_0(exch, OUTPUT_CLAIM);
     54        errno_t ret = async_req_0_0(exch, OUTPUT_CLAIM);
    5555        async_exchange_end(exch);
    5656       
     
    5858}
    5959
    60 int output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
     60errno_t output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
    6161{
    6262        async_exch_t *exch = async_exchange_begin(sess);
    63         int ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
     63        errno_t ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
    6464        async_exchange_end(exch);
    6565       
     
    6767}
    6868
    69 int output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
     69errno_t output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
    7070{
    7171        async_exch_t *exch = async_exchange_begin(sess);
    7272       
    7373        sysarg_t rv;
    74         int ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
     74        errno_t ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
    7575       
    7676        async_exchange_end(exch);
     
    8989        ipc_call_t answer;
    9090        aid_t req = async_send_0(exch, OUTPUT_FRONTBUF_CREATE, &answer);
    91         int rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
     91        errno_t rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
    9292            | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    9393       
    9494        async_exchange_end(exch);
    9595       
    96         int ret;
     96        errno_t ret;
    9797        async_wait_for(req, &ret);
    9898       
     
    103103}
    104104
    105 int output_set_style(async_sess_t *sess, console_style_t style)
     105errno_t output_set_style(async_sess_t *sess, console_style_t style)
    106106{
    107107        async_exch_t *exch = async_exchange_begin(sess);
    108         int ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
     108        errno_t ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
    109109        async_exchange_end(exch);
    110110       
     
    112112}
    113113
    114 int output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
     114errno_t output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
    115115{
    116116        async_exch_t *exch = async_exchange_begin(sess);
    117         int ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
     117        errno_t ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
    118118        async_exchange_end(exch);
    119119       
     
    121121}
    122122
    123 int output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
     123errno_t output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
    124124{
    125125        async_exch_t *exch = async_exchange_begin(sess);
    126         int ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
     126        errno_t ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
    127127        async_exchange_end(exch);
    128128       
     
    130130}
    131131
    132 int output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
     132errno_t output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
    133133    sysarg_t row, sysarg_t cols, sysarg_t rows)
    134134{
    135135        async_exch_t *exch = async_exchange_begin(sess);
    136         int ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
     136        errno_t ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
    137137            cols, rows);
    138138        async_exchange_end(exch);
  • uspace/lib/c/generic/io/serial.c

    r36f0738 rb7fd2a0  
    4141 * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
    4242 */
    43 int serial_open(async_sess_t *sess, serial_t **rserial)
     43errno_t serial_open(async_sess_t *sess, serial_t **rserial)
    4444{
    4545        serial_t *serial;
     
    6868
    6969/** Set serial port communication properties. */
    70 int serial_set_comm_props(serial_t *serial, unsigned rate,
     70errno_t serial_set_comm_props(serial_t *serial, unsigned rate,
    7171    serial_parity_t parity, unsigned datab, unsigned stopb)
    7272{
    7373        async_exch_t *exch = async_exchange_begin(serial->sess);
    7474
    75         int rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
     75        errno_t rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
    7676            datab, stopb);
    7777
     
    8181
    8282/** Get serial port communication properties. */
    83 int serial_get_comm_props(serial_t *serial, unsigned *rrate,
     83errno_t serial_get_comm_props(serial_t *serial, unsigned *rrate,
    8484    serial_parity_t *rparity, unsigned *rdatab, unsigned *rstopb)
    8585{
     
    8787        sysarg_t rate, parity, datab, stopb;
    8888
    89         int rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
     89        errno_t rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
    9090            &datab, &stopb);
    9191
  • uspace/lib/c/generic/io/table.c

    r36f0738 rb7fd2a0  
    5151 * @return EOK on success, ENOMEM if out of memory
    5252 */
    53 static int table_add_row(table_t *table, table_row_t **rrow)
     53static errno_t table_add_row(table_t *table, table_row_t **rrow)
    5454{
    5555        table_row_t *row;
     
    7474 * @return EOK on success, ENOMEM if out of memory
    7575 */
    76 static int table_row_add_cell(table_row_t *row, table_cell_t **rcell)
     76static errno_t table_row_add_cell(table_row_t *row, table_cell_t **rcell)
    7777{
    7878        table_cell_t *cell;
     
    9999 * @return EOK on success, ENOMEM if out of memory
    100100 */
    101 static int table_add_column(table_t *table, table_column_t **rcolumn)
     101static errno_t table_add_column(table_t *table, table_column_t **rcolumn)
    102102{
    103103        table_column_t *column;
     
    121121 * @return EOK on success, ENOMEM if out of memory
    122122 */
    123 static int table_write_next_cell(table_t *table)
    124 {
    125         int rc;
     123static errno_t table_write_next_cell(table_t *table)
     124{
     125        errno_t rc;
    126126
    127127        rc = table_row_add_cell(table->wrow, &table->wcell);
     
    155155 * @return EOK on success, ENOMEM if out of memory
    156156 */
    157 static int table_write_next_row(table_t *table)
    158 {
    159         int rc;
     157static errno_t table_write_next_row(table_t *table)
     158{
     159        errno_t rc;
    160160
    161161        rc = table_add_row(table, &table->wrow);
     
    272272 * @return EOK on success, ENOMEM if out of memory
    273273 */
    274 static int table_cell_extend(table_cell_t *cell, const char *str, size_t len)
     274static errno_t table_cell_extend(table_cell_t *cell, const char *str, size_t len)
    275275{
    276276        char *cstr;
     
    298298 * @return EOK on success, ENOMEM if out of memory
    299299 */
    300 int table_create(table_t **rtable)
     300errno_t table_create(table_t **rtable)
    301301{
    302302        table_t *table;
    303         int rc;
     303        errno_t rc;
    304304
    305305        table = calloc(1, sizeof(table_t));
     
    377377 * @return EOK on success, EIO on I/O error
    378378 */
    379 int table_print_out(table_t *table, FILE *f)
     379errno_t table_print_out(table_t *table, FILE *f)
    380380{
    381381        table_row_t *row;
     
    474474 * @return EOK on success, ENOMEM if out of memory
    475475 */
    476 int table_printf(table_t *table, const char *fmt, ...)
     476errno_t table_printf(table_t *table, const char *fmt, ...)
    477477{
    478478        va_list args;
    479         int rc;
     479        errno_t rc;
    480480        int ret;
    481481        char *str;
     
    548548 * @return EOK if no error indicated, non-zero error code otherwise
    549549 */
    550 int table_get_error(table_t *table)
     550errno_t table_get_error(table_t *table)
    551551{
    552552        return table->error;
  • uspace/lib/c/generic/io/visualizer.c

    r36f0738 rb7fd2a0  
    3939#include <io/visualizer.h>
    4040
    41 int visualizer_claim(async_sess_t *sess, sysarg_t notif_callback_id)
    42 {
    43         async_exch_t *exch = async_exchange_begin(sess);
    44         int ret = async_req_1_0(exch, VISUALIZER_CLAIM, notif_callback_id);
    45         async_exchange_end(exch);
    46 
    47         return ret;
    48 }
    49 
    50 int visualizer_yield(async_sess_t *sess)
    51 {
    52         async_exch_t *exch = async_exchange_begin(sess);
    53         int ret = async_req_0_0(exch, VISUALIZER_YIELD);
    54         async_exchange_end(exch);
    55 
    56         return ret;
    57 }
    58 
    59 int visualizer_enumerate_modes(async_sess_t *sess, vslmode_t *mode, sysarg_t nth)
     41errno_t visualizer_claim(async_sess_t *sess, sysarg_t notif_callback_id)
     42{
     43        async_exch_t *exch = async_exchange_begin(sess);
     44        errno_t ret = async_req_1_0(exch, VISUALIZER_CLAIM, notif_callback_id);
     45        async_exchange_end(exch);
     46
     47        return ret;
     48}
     49
     50errno_t visualizer_yield(async_sess_t *sess)
     51{
     52        async_exch_t *exch = async_exchange_begin(sess);
     53        errno_t ret = async_req_0_0(exch, VISUALIZER_YIELD);
     54        async_exchange_end(exch);
     55
     56        return ret;
     57}
     58
     59errno_t visualizer_enumerate_modes(async_sess_t *sess, vslmode_t *mode, sysarg_t nth)
    6060{
    6161        async_exch_t *exch = async_exchange_begin(sess);
     
    6464        aid_t req = async_send_1(exch, VISUALIZER_ENUMERATE_MODES, nth, &answer);
    6565
    66         int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
    67 
    68         async_exchange_end(exch);
    69 
    70         int ret;
    71         async_wait_for(req, &ret);
    72 
    73         if (rc != EOK) {
    74                 return rc;
    75         } else if (ret != EOK) {
    76                 return ret;
    77         } else {
    78                 return EOK;
    79         }
    80 }
    81 
    82 int visualizer_get_default_mode(async_sess_t *sess, vslmode_t *mode)
     66        errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
     67
     68        async_exchange_end(exch);
     69
     70        errno_t ret;
     71        async_wait_for(req, &ret);
     72
     73        if (rc != EOK) {
     74                return rc;
     75        } else if (ret != EOK) {
     76                return ret;
     77        } else {
     78                return EOK;
     79        }
     80}
     81
     82errno_t visualizer_get_default_mode(async_sess_t *sess, vslmode_t *mode)
    8383{
    8484        async_exch_t *exch = async_exchange_begin(sess);
     
    8787        aid_t req = async_send_0(exch, VISUALIZER_GET_DEFAULT_MODE, &answer);
    8888
    89         int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
    90 
    91         async_exchange_end(exch);
    92 
    93         int ret;
    94         async_wait_for(req, &ret);
    95 
    96         if (rc != EOK) {
    97                 return rc;
    98         } else if (ret != EOK) {
    99                 return ret;
    100         } else {
    101                 return EOK;
    102         }
    103 }
    104 
    105 int visualizer_get_current_mode(async_sess_t *sess, vslmode_t *mode)
     89        errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
     90
     91        async_exchange_end(exch);
     92
     93        errno_t ret;
     94        async_wait_for(req, &ret);
     95
     96        if (rc != EOK) {
     97                return rc;
     98        } else if (ret != EOK) {
     99                return ret;
     100        } else {
     101                return EOK;
     102        }
     103}
     104
     105errno_t visualizer_get_current_mode(async_sess_t *sess, vslmode_t *mode)
    106106{
    107107        async_exch_t *exch = async_exchange_begin(sess);
     
    110110        aid_t req = async_send_0(exch, VISUALIZER_GET_CURRENT_MODE, &answer);
    111111
    112         int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
    113 
    114         async_exchange_end(exch);
    115 
    116         int ret;
    117         async_wait_for(req, &ret);
    118 
    119         if (rc != EOK) {
    120                 return rc;
    121         } else if (ret != EOK) {
    122                 return ret;
    123         } else {
    124                 return EOK;
    125         }
    126 }
    127 
    128 int visualizer_get_mode(async_sess_t *sess, vslmode_t *mode, sysarg_t index)
     112        errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
     113
     114        async_exchange_end(exch);
     115
     116        errno_t ret;
     117        async_wait_for(req, &ret);
     118
     119        if (rc != EOK) {
     120                return rc;
     121        } else if (ret != EOK) {
     122                return ret;
     123        } else {
     124                return EOK;
     125        }
     126}
     127
     128errno_t visualizer_get_mode(async_sess_t *sess, vslmode_t *mode, sysarg_t index)
    129129{
    130130        async_exch_t *exch = async_exchange_begin(sess);
     
    133133        aid_t req = async_send_1(exch, VISUALIZER_GET_MODE, index, &answer);
    134134
    135         int rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
    136 
    137         async_exchange_end(exch);
    138 
    139         int ret;
    140         async_wait_for(req, &ret);
    141 
    142         if (rc != EOK) {
    143                 return rc;
    144         } else if (ret != EOK) {
    145                 return ret;
    146         } else {
    147                 return EOK;
    148         }
    149 }
    150 
    151 int visualizer_set_mode(async_sess_t *sess, sysarg_t index, sysarg_t version, void *cells)
     135        errno_t rc = async_data_read_start(exch, mode, sizeof(vslmode_t));
     136
     137        async_exchange_end(exch);
     138
     139        errno_t ret;
     140        async_wait_for(req, &ret);
     141
     142        if (rc != EOK) {
     143                return rc;
     144        } else if (ret != EOK) {
     145                return ret;
     146        } else {
     147                return EOK;
     148        }
     149}
     150
     151errno_t visualizer_set_mode(async_sess_t *sess, sysarg_t index, sysarg_t version, void *cells)
    152152{
    153153        async_exch_t *exch = async_exchange_begin(sess);
     
    156156        aid_t req = async_send_2(exch, VISUALIZER_SET_MODE, index, version, &answer);
    157157
    158         int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
    159 
    160         async_exchange_end(exch);
    161 
    162         int ret;
    163         async_wait_for(req, &ret);
    164 
    165         if (rc != EOK) {
    166                 return rc;
    167         } else if (ret != EOK) {
    168                 return ret;
    169         } else {
    170                 return EOK;
    171         }
    172 }
    173 
    174 int visualizer_update_damaged_region(async_sess_t *sess,
     158        errno_t rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
     159
     160        async_exchange_end(exch);
     161
     162        errno_t ret;
     163        async_wait_for(req, &ret);
     164
     165        if (rc != EOK) {
     166                return rc;
     167        } else if (ret != EOK) {
     168                return ret;
     169        } else {
     170                return EOK;
     171        }
     172}
     173
     174errno_t visualizer_update_damaged_region(async_sess_t *sess,
    175175    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height,
    176176        sysarg_t x_offset, sysarg_t y_offset)
     
    182182
    183183        async_exch_t *exch = async_exchange_begin(sess);
    184         int ret = async_req_5_0(exch, VISUALIZER_UPDATE_DAMAGED_REGION,
     184        errno_t ret = async_req_5_0(exch, VISUALIZER_UPDATE_DAMAGED_REGION,
    185185            x, y, width, height, offsets);
    186186        async_exchange_end(exch);
     
    189189}
    190190
    191 int visualizer_suspend(async_sess_t *sess)
    192 {
    193         async_exch_t *exch = async_exchange_begin(sess);
    194         int ret = async_req_0_0(exch, VISUALIZER_SUSPEND);
    195         async_exchange_end(exch);
    196 
    197         return ret;
    198 }
    199 
    200 int visualizer_wakeup(async_sess_t *sess)
    201 {
    202         async_exch_t *exch = async_exchange_begin(sess);
    203         int ret = async_req_0_0(exch, VISUALIZER_WAKE_UP);
     191errno_t visualizer_suspend(async_sess_t *sess)
     192{
     193        async_exch_t *exch = async_exchange_begin(sess);
     194        errno_t ret = async_req_0_0(exch, VISUALIZER_SUSPEND);
     195        async_exchange_end(exch);
     196
     197        return ret;
     198}
     199
     200errno_t visualizer_wakeup(async_sess_t *sess)
     201{
     202        async_exch_t *exch = async_exchange_begin(sess);
     203        errno_t ret = async_req_0_0(exch, VISUALIZER_WAKE_UP);
    204204        async_exchange_end(exch);
    205205
  • uspace/lib/c/generic/io/window.c

    r36f0738 rb7fd2a0  
    4040#include <stdio.h>
    4141
    42 int win_register(async_sess_t *sess, window_flags_t flags, service_id_t *in,
     42errno_t win_register(async_sess_t *sess, window_flags_t flags, service_id_t *in,
    4343    service_id_t *out)
    4444{
    4545        async_exch_t *exch = async_exchange_begin(sess);
    46         int ret = async_req_1_2(exch, WINDOW_REGISTER, flags, in, out);
     46        errno_t ret = async_req_1_2(exch, WINDOW_REGISTER, flags, in, out);
    4747        async_exchange_end(exch);
    4848       
     
    5050}
    5151
    52 int win_get_event(async_sess_t *sess, window_event_t *event)
     52errno_t win_get_event(async_sess_t *sess, window_event_t *event)
    5353{
    5454        async_exch_t *exch = async_exchange_begin(sess);
     
    5757        aid_t req = async_send_0(exch, WINDOW_GET_EVENT, &answer);
    5858
    59         int rc = async_data_read_start(exch, event, sizeof(window_event_t));
     59        errno_t rc = async_data_read_start(exch, event, sizeof(window_event_t));
    6060
    6161        async_exchange_end(exch);
    6262
    63         int ret;
     63        errno_t ret;
    6464        async_wait_for(req, &ret);
    6565
     
    7373}
    7474
    75 int win_damage(async_sess_t *sess,
     75errno_t win_damage(async_sess_t *sess,
    7676    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
    7777{
    7878        async_exch_t *exch = async_exchange_begin(sess);
    79         int ret = async_req_4_0(exch, WINDOW_DAMAGE, x, y, width, height);
     79        errno_t ret = async_req_4_0(exch, WINDOW_DAMAGE, x, y, width, height);
    8080        async_exchange_end(exch);
    8181
     
    8383}
    8484
    85 int win_grab(async_sess_t *sess, sysarg_t pos_id, sysarg_t grab_flags)
     85errno_t win_grab(async_sess_t *sess, sysarg_t pos_id, sysarg_t grab_flags)
    8686{
    8787        async_exch_t *exch = async_exchange_begin(sess);
    88         int ret = async_req_2_0(exch, WINDOW_GRAB, pos_id, grab_flags);
     88        errno_t ret = async_req_2_0(exch, WINDOW_GRAB, pos_id, grab_flags);
    8989        async_exchange_end(exch);
    9090
     
    9292}
    9393
    94 int win_resize(async_sess_t *sess, sysarg_t x, sysarg_t y, sysarg_t width,
     94errno_t win_resize(async_sess_t *sess, sysarg_t x, sysarg_t y, sysarg_t width,
    9595    sysarg_t height, window_placement_flags_t placement_flags, void *cells)
    9696{
     
    101101            (sysarg_t) placement_flags, &answer);
    102102       
    103         int rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
     103        errno_t rc = async_share_out_start(exch, cells, AS_AREA_READ | AS_AREA_CACHEABLE);
    104104       
    105105        async_exchange_end(exch);
    106106       
    107         int ret;
     107        errno_t ret;
    108108        async_wait_for(req, &ret);
    109109       
     
    116116}
    117117
    118 int win_close(async_sess_t *sess)
     118errno_t win_close(async_sess_t *sess)
    119119{
    120120        async_exch_t *exch = async_exchange_begin(sess);
    121         int ret = async_req_0_0(exch, WINDOW_CLOSE);
     121        errno_t ret = async_req_0_0(exch, WINDOW_CLOSE);
    122122        async_exchange_end(exch);
    123123
     
    125125}
    126126
    127 int win_close_request(async_sess_t *sess)
     127errno_t win_close_request(async_sess_t *sess)
    128128{
    129129        async_exch_t *exch = async_exchange_begin(sess);
    130         int ret = async_req_0_0(exch, WINDOW_CLOSE_REQUEST);
     130        errno_t ret = async_req_0_0(exch, WINDOW_CLOSE_REQUEST);
    131131        async_exchange_end(exch);
    132132
Note: See TracChangeset for help on using the changeset viewer.