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

Function accept_filt_add

freebsd/kern/uipc_accf.c:75–98  ·  view source on GitHub ↗

* Must be passed a malloc'd structure so we don't explode if the kld is * unloaded, we leak the struct on deallocation to deal with this, but if a * filter is loaded with the same name as a leaked one we re-use the entry. */

Source from the content-addressed store, hash-verified

73 * filter is loaded with the same name as a leaked one we re-use the entry.
74 */
75int
76accept_filt_add(struct accept_filter *filt)
77{
78 struct accept_filter *p;
79
80 ACCEPT_FILTER_LOCK();
81 SLIST_FOREACH(p, &accept_filtlsthd, accf_next)
82 if (strcmp(p->accf_name, filt->accf_name) == 0) {
83 if (p->accf_callback != NULL) {
84 ACCEPT_FILTER_UNLOCK();
85 return (EEXIST);
86 } else {
87 p->accf_callback = filt->accf_callback;
88 ACCEPT_FILTER_UNLOCK();
89 free(filt, M_ACCF);
90 return (0);
91 }
92 }
93
94 if (p == NULL)
95 SLIST_INSERT_HEAD(&accept_filtlsthd, filt, accf_next);
96 ACCEPT_FILTER_UNLOCK();
97 return (0);
98}
99
100int
101accept_filt_del(char *name)

Callers 1

Calls 2

strcmpFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected