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

Function sysctl_handle_bool

freebsd/kern/kern_sysctl.c:1468–1494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1466 */
1467
1468int
1469sysctl_handle_bool(SYSCTL_HANDLER_ARGS)
1470{
1471 uint8_t temp;
1472 int error;
1473
1474 /*
1475 * Attempt to get a coherent snapshot by making a copy of the data.
1476 */
1477 if (arg1)
1478 temp = *(bool *)arg1 ? 1 : 0;
1479 else
1480 temp = arg2 ? 1 : 0;
1481
1482 error = SYSCTL_OUT(req, &temp, sizeof(temp));
1483 if (error || !req->newptr)
1484 return (error);
1485
1486 if (!arg1)
1487 error = EPERM;
1488 else {
1489 error = SYSCTL_IN(req, &temp, sizeof(temp));
1490 if (!error)
1491 *(bool *)arg1 = temp ? 1 : 0;
1492 }
1493 return (error);
1494}
1495
1496/*
1497 * Handle an int8_t, signed or unsigned.

Calls

no outgoing calls

Tested by

no test coverage detected