Changeset ab936440 in mainline for uspace/drv/char/msim-con/msim-con.c


Ignore:
Timestamp:
2019-02-12T20:42:42Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f31ca47
Parents:
7f7817a9 (diff), 4805495 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
Message:

Merge branch 'master' into bdsh_alias

Conflicts:

uspace/app/bdsh/Makefile
uspace/app/bdsh/cmds/modules/modules.h

Ccheck correction and removing header which includes itself

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/msim-con/msim-con.c

    r7f7817a9 rab936440  
    4343static void msim_con_connection(ipc_call_t *, void *);
    4444
    45 static errno_t msim_con_read(chardev_srv_t *, void *, size_t, size_t *);
     45static errno_t msim_con_read(chardev_srv_t *, void *, size_t, size_t *,
     46    chardev_flags_t);
    4647static errno_t msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
    4748
     
    8586        irq_cmd_t *msim_cmds = NULL;
    8687        errno_t rc;
     88        bool bound = false;
    8789
    8890        circ_buf_init(&con->cbuf, con->buf, msim_con_buf_size, 1);
     
    143145        }
    144146
    145         ddf_fun_add_to_category(fun, "console");
     147        bound = true;
     148
     149        rc = ddf_fun_add_to_category(fun, "console");
     150        if (rc != EOK) {
     151                ddf_msg(LVL_ERROR, "Error adding function 'a' to category "
     152                    "'console'.");
     153                goto error;
     154        }
    146155
    147156        return EOK;
     
    149158        if (CAP_HANDLE_VALID(con->irq_handle))
    150159                async_irq_unsubscribe(con->irq_handle);
     160        if (bound)
     161                ddf_fun_unbind(fun);
    151162        if (fun != NULL)
    152163                ddf_fun_destroy(fun);
     
    175186/** Read from msim console device */
    176187static errno_t msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
    177     size_t *nread)
     188    size_t *nread, chardev_flags_t flags)
    178189{
    179190        msim_con_t *con = (msim_con_t *) srv->srvs->sarg;
     
    184195        fibril_mutex_lock(&con->buf_lock);
    185196
    186         while (circ_buf_nused(&con->cbuf) == 0)
     197        while ((flags & chardev_f_nonblock) == 0 &&
     198            circ_buf_nused(&con->cbuf) == 0)
    187199                fibril_condvar_wait(&con->buf_cv, &con->buf_lock);
    188200
Note: See TracChangeset for help on using the changeset viewer.