| 278 | sizeof(ktr_alq_file), "KTR logging file"); |
| 279 | |
| 280 | static int |
| 281 | sysctl_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 | } |
| 313 | SYSCTL_PROC(_debug_ktr, OID_AUTO, alq_enable, |
| 314 | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, 0, |
| 315 | sysctl_debug_ktr_alq_enable, "I", |
nothing calls this directly
no test coverage detected