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

Function ng_ksocket_incoming

freebsd/netgraph/ng_ksocket.c:998–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

996 */
997
998static int
999ng_ksocket_incoming(struct socket *so, void *arg, int waitflag)
1000{
1001 const node_p node = arg;
1002 const priv_p priv = NG_NODE_PRIVATE(node);
1003 int wait = ((waitflag & M_WAITOK) ? NG_WAITOK : 0) | NG_QUEUE;
1004
1005 /*
1006 * Even if node is not locked, as soon as we are called, we assume
1007 * it exist and it's private area is valid. With some care we can
1008 * access it. Mark node that incoming event for it was sent to
1009 * avoid unneded queue trashing.
1010 */
1011 if (atomic_cmpset_int(&priv->fn_sent, 0, 1) &&
1012 ng_send_fn1(node, NULL, &ng_ksocket_incoming2, so, 0, wait)) {
1013 atomic_store_rel_int(&priv->fn_sent, 0);
1014 }
1015 return (SU_OK);
1016}
1017
1018/*
1019 * When incoming data is appended to the socket, we get notified here.

Callers

nothing calls this directly

Calls 1

ng_send_fn1Function · 0.70

Tested by

no test coverage detected