int error = EINVAL;
uint32_t request = arg2;
+ if (!IOStatistics::isEnabled()) {
+ return ENOENT;
+ }
+
switch (request) {
case kIOStatisticsGeneral:
error = IOStatistics::getStatistics(req);
SYSCTL_NODE(_debug, OID_AUTO, iokit_statistics, CTLFLAG_RW | CTLFLAG_LOCKED, NULL, "IOStatistics");
static SYSCTL_PROC(_debug_iokit_statistics, OID_AUTO, general,
- CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN | CTLFLAG_LOCKED,
+ CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED,
NULL, kIOStatisticsGeneral, oid_sysctl, "S", "");
static SYSCTL_PROC(_debug_iokit_statistics, OID_AUTO, workloop,
- CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN | CTLFLAG_LOCKED,
+ CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED,
NULL, kIOStatisticsWorkLoop, oid_sysctl, "S", "");
static SYSCTL_PROC(_debug_iokit_statistics, OID_AUTO, userclient,
- CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_NOAUTO | CTLFLAG_KERN | CTLFLAG_LOCKED,
+ CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_KERN | CTLFLAG_LOCKED,
NULL, kIOStatisticsUserClient, oid_sysctl, "S", "");
+
void
IOStatistics::initialize()
{
return;
}
- sysctl_register_oid(&sysctl__debug_iokit_statistics_general);
- sysctl_register_oid(&sysctl__debug_iokit_statistics_workloop);
- sysctl_register_oid(&sysctl__debug_iokit_statistics_userclient);
-
lock = IORWLockAlloc();
if (!lock) {
return;