Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2011 07:13:23 +0000 (UTC)
From:      Stanislav Sedov <stas@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217046 - head/usr.sbin/cpucontrol
Message-ID:  <201101060713.p067DNfw006348@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: stas
Date: Thu Jan  6 07:13:23 2011
New Revision: 217046
URL: http://svn.freebsd.org/changeset/base/217046

Log:
  - 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

Modified:
  head/usr.sbin/cpucontrol/cpucontrol.c

Modified: head/usr.sbin/cpucontrol/cpucontrol.c
==============================================================================
--- head/usr.sbin/cpucontrol/cpucontrol.c	Thu Jan  6 04:38:10 2011	(r217045)
+++ head/usr.sbin/cpucontrol/cpucontrol.c	Thu Jan  6 07:13:23 2011	(r217046)
@@ -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 *d
 	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 *d
 	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 *d
 	}
 	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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101060713.p067DNfw006348>