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

Function sysctl_debug_ktr_alq_enable

freebsd/kern/kern_ktr.c:280–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278 sizeof(ktr_alq_file), "KTR logging file");
279
280static int
281sysctl_debug_ktr_alq_enable(SYSCTL_HANDLER_ARGS)
282{
283 int error;
284 int enable;
285
286 enable = ktr_alq_enabled;
287
288 error = sysctl_handle_int(oidp, &enable, 0, req);
289 if (error || !req->newptr)
290 return (error);
291
292 if (enable) {
293 if (ktr_alq_enabled)
294 return (0);
295 error = alq_open(&ktr_alq, (const char *)ktr_alq_file,
296 req->td->td_ucred, ALQ_DEFAULT_CMODE,
297 sizeof(struct ktr_entry), ktr_alq_depth);
298 if (error == 0) {
299 ktr_alq_cnt = 0;
300 ktr_alq_failed = 0;
301 ktr_alq_enabled = 1;
302 }
303 } else {
304 if (ktr_alq_enabled == 0)
305 return (0);
306 ktr_alq_enabled = 0;
307 alq_close(ktr_alq);
308 ktr_alq = NULL;
309 }
310
311 return (error);
312}
313SYSCTL_PROC(_debug_ktr, OID_AUTO, alq_enable,
314 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, 0,
315 sysctl_debug_ktr_alq_enable, "I",

Callers

nothing calls this directly

Calls 3

sysctl_handle_intFunction · 0.85
alq_openFunction · 0.85
alq_closeFunction · 0.85

Tested by

no test coverage detected