diff options
author | glebius <glebius@FreeBSD.org> | 2005-07-05 17:35:20 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-07-05 17:35:20 +0000 |
commit | fcbdfd0eb4f509af7f2a382daaf2c52ce49704c8 (patch) | |
tree | 7c65a2a332dab7cec59b3eb4bdcbf403ceaac133 /sys/netgraph/ng_socketvar.h | |
parent | 9c552f7c01059c885fb0604e8fc082ce51f3228a (diff) | |
download | FreeBSD-src-fcbdfd0eb4f509af7f2a382daaf2c52ce49704c8.zip FreeBSD-src-fcbdfd0eb4f509af7f2a382daaf2c52ce49704c8.tar.gz |
In the splnet times, netgraph was functional and synchronous. Nowadays,
an item may be queued and processed later. While this is OK for mbufs,
this is a problem for control messages.
In the framework:
- Add optional callback function pointer to an item. When item gets
applied the callback is executed from ng_apply_item().
- Add new flag NG_PROGRESS. If this flag is supplied, then return
EINPROGRESS instead of 0 in case if item failed to deliver
synchronously and was queued.
- Honor NG_PROGRESS in ng_snd_item().
In ng_socket:
- When userland sends control message add callback to the item.
- If ng_snd_item() returns EINPROGRESS, then sleep.
This change fixes possible races in ngctl(8) scripts.
Reviewed by: julian
Approved by: re (scottl)
Diffstat (limited to 'sys/netgraph/ng_socketvar.h')
-rw-r--r-- | sys/netgraph/ng_socketvar.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netgraph/ng_socketvar.h b/sys/netgraph/ng_socketvar.h index a539bb5..3cf8103 100644 --- a/sys/netgraph/ng_socketvar.h +++ b/sys/netgraph/ng_socketvar.h @@ -59,6 +59,8 @@ struct ngsock { struct ngpcb *ctlsock; /* optional control socket */ int flags; int refs; + struct mtx mtx; /* mtx to wait on */ + int error; /* place to store error */ }; #define NGS_FLAG_NOLINGER 1 /* close with last hook */ |