MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ngt_rcvdata

Function ngt_rcvdata

freebsd/netgraph/ng_tty.c:310–346  ·  view source on GitHub ↗

* Receive incoming data from netgraph system. Put it on our * output queue and start output if necessary. */

Source from the content-addressed store, hash-verified

308 * output queue and start output if necessary.
309 */
310static int
311ngt_rcvdata(hook_p hook, item_p item)
312{
313 const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
314 struct tty *tp = sc->tp;
315 struct mbuf *m;
316
317 if (hook != sc->hook)
318 panic("%s", __func__);
319
320 NGI_GET_M(item, m);
321 NG_FREE_ITEM(item);
322
323 if (tp == NULL) {
324 NG_FREE_M(m);
325 return (ENXIO);
326 }
327
328 IF_LOCK(&sc->outq);
329 if (_IF_QFULL(&sc->outq)) {
330 IF_UNLOCK(&sc->outq);
331 NG_FREE_M(m);
332 return (ENOBUFS);
333 }
334
335 _IF_ENQUEUE(&sc->outq, m);
336 sc->outqlen += m->m_pkthdr.len;
337 IF_UNLOCK(&sc->outq);
338
339 /* notify the TTY that data is ready */
340 tty_lock(tp);
341 if (!tty_gone(tp))
342 ttydevsw_outwakeup(tp);
343 tty_unlock(tp);
344
345 return (0);
346}
347
348static size_t
349ngt_getc_inject(struct tty *tp, void *buf, size_t len)

Callers

nothing calls this directly

Calls 2

ttydevsw_outwakeupFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected