Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_tty.c
Show First 20 Lines • Show All 330 Lines • ▼ Show 20 Lines | ngt_rcvdata(hook_p hook, item_p item) | ||||
} | } | ||||
_IF_ENQUEUE(&sc->outq, m); | _IF_ENQUEUE(&sc->outq, m); | ||||
sc->outqlen += m->m_pkthdr.len; | sc->outqlen += m->m_pkthdr.len; | ||||
IF_UNLOCK(&sc->outq); | IF_UNLOCK(&sc->outq); | ||||
/* notify the TTY that data is ready */ | /* notify the TTY that data is ready */ | ||||
tty_lock(tp); | tty_lock(tp); | ||||
ttydisc_lock(tp); | |||||
if (!tty_gone(tp)) | if (!tty_gone(tp)) | ||||
ttydevsw_outwakeup(tp); | ttydevsw_outwakeup(tp); | ||||
ttydisc_unlock(tp); | |||||
tty_unlock(tp); | tty_unlock(tp); | ||||
return (0); | return (0); | ||||
} | } | ||||
static size_t | static size_t | ||||
ngt_getc_inject(struct tty *tp, void *buf, size_t len) | ngt_getc_inject(struct tty *tp, void *buf, size_t len) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
ngt_rint_bypass(struct tty *tp, const void *buf, size_t len) | ngt_rint_bypass(struct tty *tp, const void *buf, size_t len) | ||||
{ | { | ||||
sc_p sc = ttyhook_softc(tp); | sc_p sc = ttyhook_softc(tp); | ||||
node_p node = sc->node; | node_p node = sc->node; | ||||
struct mbuf *m, *mb; | struct mbuf *m, *mb; | ||||
size_t total = 0; | size_t total = 0; | ||||
int error = 0, length; | int error = 0, length; | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
if (sc->hook == NULL) | if (sc->hook == NULL) | ||||
return (0); | return (0); | ||||
m = m_getm2(NULL, len, M_NOWAIT, MT_DATA, M_PKTHDR); | m = m_getm2(NULL, len, M_NOWAIT, MT_DATA, M_PKTHDR); | ||||
if (m == NULL) { | if (m == NULL) { | ||||
if (sc->flags & FLG_DEBUG) | if (sc->flags & FLG_DEBUG) | ||||
log(LOG_ERR, | log(LOG_ERR, | ||||
Show All 30 Lines | |||||
static int | static int | ||||
ngt_rint(struct tty *tp, char c, int flags) | ngt_rint(struct tty *tp, char c, int flags) | ||||
{ | { | ||||
sc_p sc = ttyhook_softc(tp); | sc_p sc = ttyhook_softc(tp); | ||||
node_p node = sc->node; | node_p node = sc->node; | ||||
struct mbuf *m; | struct mbuf *m; | ||||
int error = 0; | int error = 0; | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
if (sc->hook == NULL) | if (sc->hook == NULL) | ||||
return (0); | return (0); | ||||
if (flags != 0) { | if (flags != 0) { | ||||
/* framing error or overrun on this char */ | /* framing error or overrun on this char */ | ||||
if (sc->flags & FLG_DEBUG) | if (sc->flags & FLG_DEBUG) | ||||
log(LOG_DEBUG, "%s: line error %x\n", | log(LOG_DEBUG, "%s: line error %x\n", | ||||
Show All 39 Lines |