summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cpucontrol
diff options
context:
space:
mode:
authorstas <stas@FreeBSD.org>2011-01-06 07:13:23 +0000
committerstas <stas@FreeBSD.org>2011-01-06 07:13:23 +0000
commit906db277079898da10beb167e263916433c3d37a (patch)
treeaa7956db4db69f413f1a1f24544bf3db85ff3244 /usr.sbin/cpucontrol
parentc2aa4fc0ebb33e3eeb047f84ad49d946887a72f2 (diff)
downloadFreeBSD-src-906db277079898da10beb167e263916433c3d37a.zip
FreeBSD-src-906db277079898da10beb167e263916433c3d37a.tar.gz
- Show textual representation of ioctl command in warning message
if ioctl(4) is failed besides the command number. Suggested by: delphij MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/cpucontrol')
-rw-r--r--usr.sbin/cpucontrol/cpucontrol.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/cpucontrol/cpucontrol.c b/usr.sbin/cpucontrol/cpucontrol.c
index 7193080..eaf0741 100644
--- a/usr.sbin/cpucontrol/cpucontrol.c
+++ b/usr.sbin/cpucontrol/cpucontrol.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>.
+ * Copyright (c) 2008-2011 Stanislav Sedov <stas@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -177,6 +177,7 @@ do_msr(const char *cmdarg, const char *dev)
unsigned long command;
int do_invert = 0, op;
int fd, error;
+ const char *command_name;
char *endptr;
char *p;
@@ -245,15 +246,19 @@ do_msr(const char *cmdarg, const char *dev)
switch (op) {
case OP_READ:
command = CPUCTL_RDMSR;
+ command_name = "CPUCTL_RDMSR";
break;
case OP_WRITE:
command = CPUCTL_WRMSR;
+ command_name = "CPUCTL_WRMSR";
break;
case OP_OR:
command = CPUCTL_MSRSBIT;
+ command_name = "CPUCTL_MSRSBIT";
break;
case OP_AND:
command = CPUCTL_MSRCBIT;
+ command_name = "CPUCTL_MSRCBIT";
break;
default:
abort();
@@ -266,7 +271,7 @@ do_msr(const char *cmdarg, const char *dev)
}
error = ioctl(fd, command, &args);
if (error < 0) {
- WARN(0, "ioctl(%s, %lu)", dev, command);
+ WARN(0, "ioctl(%s, %s (%lu))", dev, command_name, command);
close(fd);
return (1);
}
OpenPOWER on IntegriCloud