Changeset View
Changeset View
Standalone View
Standalone View
sys/security/audit/audit_bsm_klib.c
Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | au_evnamemap_foreach(au_evnamemap_callback_t callback) | ||||
for (i = 0; i < EVNAMEMAP_HASH_TABLE_SIZE; i++) { | for (i = 0; i < EVNAMEMAP_HASH_TABLE_SIZE; i++) { | ||||
enl = &evnamemap_hash[i]; | enl = &evnamemap_hash[i]; | ||||
LIST_FOREACH(ene, &enl->enl_head, ene_entry) | LIST_FOREACH(ene, &enl->enl_head, ene_entry) | ||||
callback(ene); | callback(ene); | ||||
} | } | ||||
EVNAMEMAP_WUNLOCK(); | EVNAMEMAP_WUNLOCK(); | ||||
} | } | ||||
#ifdef KDTRACE_HOOKS | |||||
/* | |||||
* Look up an event-to-name mapping table entry by event number. As evname | |||||
* elements are stable in memory, we can return the pointer without the table | |||||
* lock held -- but the caller will need to lock the element mutex before | |||||
* accessing element fields. | |||||
* | |||||
* NB: the event identifier in elements is stable and can be read without | |||||
* holding the evname_elem lock. | |||||
*/ | |||||
struct evname_elem * | |||||
au_evnamemap_lookup(au_event_t event) | |||||
{ | |||||
struct evname_list *enl; | |||||
struct evname_elem *ene; | |||||
EVNAMEMAP_RLOCK(); | |||||
enl = &evnamemap_hash[event % EVNAMEMAP_HASH_TABLE_SIZE]; | |||||
LIST_FOREACH(ene, &enl->enl_head, ene_entry) { | |||||
if (ene->ene_event == event) | |||||
goto out; | |||||
} | |||||
ene = NULL; | |||||
out: | |||||
EVNAMEMAP_RUNLOCK(); | |||||
return (ene); | |||||
} | |||||
#endif /* !KDTRACE_HOOKS */ | |||||
/* | /* | ||||
* Convert sysctl names and present arguments to events. | * Convert sysctl names and present arguments to events. | ||||
*/ | */ | ||||
au_event_t | au_event_t | ||||
audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg) | audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg) | ||||
{ | { | ||||
/* can't parse it - so return the worst case */ | /* can't parse it - so return the worst case */ | ||||
▲ Show 20 Lines • Show All 340 Lines • Show Last 20 Lines |