summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/netgraph.h
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-03-10 16:31:00 +0000
committerjulian <julian@FreeBSD.org>2001-03-10 16:31:00 +0000
commit2b70619e177bb5a012baa26cc4f520766d037a52 (patch)
tree5b02cb5e154f1094a992496af0e4581afaeeb639 /sys/netgraph/netgraph.h
parentca954435e84ede78ec241e0d4e8b5576369ced9e (diff)
downloadFreeBSD-src-2b70619e177bb5a012baa26cc4f520766d037a52.zip
FreeBSD-src-2b70619e177bb5a012baa26cc4f520766d037a52.tar.gz
netgraph.h:
Change a prototype. Add a function version of ng_ref_node() when debugging so a breakpoint can be set on it. ng_base.c: add 'node' as an argument to ng_apply_item so that it is up to the caller to take over and release the item's reference on the node. If the release reports back that the node went away due to the reference going to 0, the caller should cease referencing the now defunct node. (e.g. the item was a 'kill node' message). Alter ng_unref_node to report back the residual references as a result. ng_pptpgre.c: Don't reference a node after we dropped a reference to it. (What if it was the last?) Fixes a node leak reported by Harti Brandt <brandt@fokus.gmd.de> which was due to an incorrect earlier attempt to fix the "accessing node after dropping the last reference" problem.
Diffstat (limited to 'sys/netgraph/netgraph.h')
-rw-r--r--sys/netgraph/netgraph.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
index e6b997e..27278b3 100644
--- a/sys/netgraph/netgraph.h
+++ b/sys/netgraph/netgraph.h
@@ -357,7 +357,7 @@ struct ng_node {
* Public methods for nodes.
* If you can't do it with these you probably shouldn't be doing it.
*/
-void ng_unref_node(node_p node); /* don't move this */
+int ng_unref_node(node_p node); /* don't move this */
#define _NG_NODE_NAME(node) ((node)->nd_name + 0)
#define _NG_NODE_HAS_NAME(node) ((node)->nd_name[0] + 0)
#define _NG_NODE_ID(node) ((node)->nd_ID + 0)
@@ -396,8 +396,9 @@ static void __inline _chknode(node_p node, char *file, int line);
static __inline char * _ng_node_name(node_p node, char *file, int line);
static __inline int _ng_node_has_name(node_p node, char *file, int line);
static __inline ng_ID_t _ng_node_id(node_p node, char *file, int line);
+void ng_ref_node(node_p node);
static __inline void _ng_node_ref(node_p node, char *file, int line);
-static __inline void _ng_node_unref(node_p node, char *file, int line);
+static __inline int _ng_node_unref(node_p node, char *file, int line);
static __inline void _ng_node_set_private(node_p node, void * val,
char *file, int line);
static __inline void * _ng_node_private(node_p node, char *file, int line);
@@ -444,14 +445,15 @@ static __inline void
_ng_node_ref(node_p node, char *file, int line)
{
_chknode(node, file, line);
- _NG_NODE_REF(node);
+ /*_NG_NODE_REF(node);*/
+ ng_ref_node(node);
}
-static __inline void
+static __inline int
_ng_node_unref(node_p node, char *file, int line)
{
_chknode(node, file, line);
- _NG_NODE_UNREF(node);
+ return (_NG_NODE_UNREF(node));
}
static __inline void
OpenPOWER on IntegriCloud