mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-25 08:13:17 +08:00
parent
327f4e1029
commit
8b3da1329b
@ -154,18 +154,13 @@ termios_receive_wakeup(void *arg)
|
|||||||
{
|
{
|
||||||
termios_selinfo *ts;
|
termios_selinfo *ts;
|
||||||
rtems_termios_tty *tty;
|
rtems_termios_tty *tty;
|
||||||
rtems_status_code sc;
|
|
||||||
|
|
||||||
ts = arg;
|
ts = arg;
|
||||||
tty = ts->tty;
|
tty = ts->tty;
|
||||||
|
|
||||||
sc = rtems_semaphore_obtain(tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
rtems_mutex_lock(&tty->isem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
selwakeup(&ts->sel);
|
selwakeup(&ts->sel);
|
||||||
|
rtems_mutex_unlock(&tty->isem);
|
||||||
sc = rtems_semaphore_release(tty->isem);
|
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -173,18 +168,13 @@ termios_transmit_wakeup(void *arg)
|
|||||||
{
|
{
|
||||||
termios_selinfo *ts;
|
termios_selinfo *ts;
|
||||||
rtems_termios_tty *tty;
|
rtems_termios_tty *tty;
|
||||||
rtems_status_code sc;
|
|
||||||
|
|
||||||
ts = arg;
|
ts = arg;
|
||||||
tty = ts->tty;
|
tty = ts->tty;
|
||||||
|
|
||||||
sc = rtems_semaphore_obtain(tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
rtems_mutex_lock(&tty->osem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
selwakeup(&ts->sel);
|
selwakeup(&ts->sel);
|
||||||
|
rtems_mutex_unlock(&tty->osem);
|
||||||
sc = rtems_semaphore_release(tty->osem);
|
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -229,7 +219,6 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
|
|||||||
struct thread *td = rtems_bsd_get_curthread_or_wait_forever();
|
struct thread *td = rtems_bsd_get_curthread_or_wait_forever();
|
||||||
struct selinfo *sel;
|
struct selinfo *sel;
|
||||||
rtems_termios_tty *tty;
|
rtems_termios_tty *tty;
|
||||||
rtems_status_code sc;
|
|
||||||
int revents;
|
int revents;
|
||||||
|
|
||||||
revents = 0;
|
revents = 0;
|
||||||
@ -239,8 +228,7 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
|
|||||||
sel = termios_get_selinfo(tty, &tty->tty_rcv,
|
sel = termios_get_selinfo(tty, &tty->tty_rcv,
|
||||||
termios_receive_wakeup);
|
termios_receive_wakeup);
|
||||||
|
|
||||||
sc = rtems_semaphore_obtain(tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
rtems_mutex_lock(&tty->isem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
if (termios_can_read(tty)) {
|
if (termios_can_read(tty)) {
|
||||||
revents |= events & (POLLIN | POLLRDNORM);
|
revents |= events & (POLLIN | POLLRDNORM);
|
||||||
@ -248,16 +236,14 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
|
|||||||
selrecord(td, sel);
|
selrecord(td, sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc = rtems_semaphore_release(tty->isem);
|
rtems_mutex_unlock(&tty->isem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & (POLLOUT | POLLWRNORM)) != 0) {
|
if ((events & (POLLOUT | POLLWRNORM)) != 0) {
|
||||||
sel = termios_get_selinfo(tty, &tty->tty_snd,
|
sel = termios_get_selinfo(tty, &tty->tty_snd,
|
||||||
termios_transmit_wakeup);
|
termios_transmit_wakeup);
|
||||||
|
|
||||||
sc = rtems_semaphore_obtain(tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
rtems_mutex_lock(&tty->osem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
if (termios_can_write(tty)) {
|
if (termios_can_write(tty)) {
|
||||||
revents |= events & (POLLOUT | POLLWRNORM);
|
revents |= events & (POLLOUT | POLLWRNORM);
|
||||||
@ -265,8 +251,7 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
|
|||||||
selrecord(td, sel);
|
selrecord(td, sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc = rtems_semaphore_release(tty->osem);
|
rtems_mutex_unlock(&tty->osem);
|
||||||
BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (revents);
|
return (revents);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user