Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/envstat Use <paths.h>. Remove trailing white space.
details: https://anonhg.NetBSD.org/src/rev/81d641e4a7c4
branches: trunk
changeset: 757343:81d641e4a7c4
user: jruoho <jruoho%NetBSD.org@localhost>
date: Thu Aug 26 05:25:57 2010 +0000
description:
Use <paths.h>. Remove trailing white space.
diffstat:
usr.sbin/envstat/envstat.c | 35 +++++++++++++++++------------------
1 files changed, 17 insertions(+), 18 deletions(-)
diffs (133 lines):
diff -r bf7c4054f96f -r 81d641e4a7c4 usr.sbin/envstat/envstat.c
--- a/usr.sbin/envstat/envstat.c Wed Aug 25 21:36:02 2010 +0000
+++ b/usr.sbin/envstat/envstat.c Thu Aug 26 05:25:57 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: envstat.c,v 1.78 2010/08/01 15:39:52 mlelstv Exp $ */
+/* $NetBSD: envstat.c,v 1.79 2010/08/26 05:25:57 jruoho Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: envstat.c,v 1.78 2010/08/01 15:39:52 mlelstv Exp $");
+__RCSID("$NetBSD: envstat.c,v 1.79 2010/08/26 05:25:57 jruoho Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -38,6 +38,7 @@
#include <fcntl.h>
#include <err.h>
#include <errno.h>
+#include <paths.h>
#include <syslog.h>
#include <sys/envsys.h>
#include <sys/types.h>
@@ -46,8 +47,6 @@
#include "envstat.h"
-#define _PATH_DEV_SYSMON "/dev/sysmon"
-
#define ENVSYS_DFLAG 0x00000001 /* list registered devices */
#define ENVSYS_FFLAG 0x00000002 /* show temp in farenheit */
#define ENVSYS_LFLAG 0x00000004 /* list sensors */
@@ -94,7 +93,7 @@
} *dvprops_t;
/* A simple queue to manage all sensors */
-static SIMPLEQ_HEAD(, envsys_sensor) sensors_list =
+static SIMPLEQ_HEAD(, envsys_sensor) sensors_list =
SIMPLEQ_HEAD_INITIALIZER(sensors_list);
/* A simple queue to manage statistics for all sensors */
@@ -156,7 +155,7 @@
flags |= ENVSYS_LFLAG;
break;
case 'r':
- /*
+ /*
* This flag is noop.. it's only here for
* compatibility with the old implementation.
*/
@@ -208,8 +207,8 @@
errx(EXIT_FAILURE, "-d flag cannot be used with -s");
/* Open the device in ro mode */
- if ((fd = open(_PATH_DEV_SYSMON, O_RDONLY)) == -1)
- err(EXIT_FAILURE, "%s", _PATH_DEV_SYSMON);
+ if ((fd = open(_PATH_SYSMON, O_RDONLY)) == -1)
+ err(EXIT_FAILURE, "%s", _PATH_SYSMON);
/* Print dictionary in raw mode */
if (flags & ENVSYS_XFLAG) {
@@ -227,13 +226,13 @@
(void)close(fd);
/* open the fd in rw mode */
- if ((fd = open(_PATH_DEV_SYSMON, O_RDWR)) == -1)
- err(EXIT_FAILURE, "%s", _PATH_DEV_SYSMON);
+ if ((fd = open(_PATH_SYSMON, O_RDWR)) == -1)
+ err(EXIT_FAILURE, "%s", _PATH_SYSMON);
dict = prop_dictionary_create();
if (!dict)
err(EXIT_FAILURE, "prop_dictionary_create");
-
+
rval = prop_dictionary_set_bool(dict,
"envsys-remove-props",
true);
@@ -304,13 +303,13 @@
* Close the read only descriptor and open a new one read write.
*/
(void)close(fd);
- if ((fd = open(_PATH_DEV_SYSMON, O_RDWR)) == -1) {
+ if ((fd = open(_PATH_SYSMON, O_RDWR)) == -1) {
error = errno;
- warn("%s", _PATH_DEV_SYSMON);
+ warn("%s", _PATH_SYSMON);
return error;
}
- /*
+ /*
* Send our sensor properties dictionary to the kernel then.
*/
error = prop_dictionary_send_ioctl(udict, fd, ENVSYS_SETDICTIONARY);
@@ -326,7 +325,7 @@
{
sensor_stats_t stats;
- /*
+ /*
* If we matched a sensor by its description return it, otherwise
* allocate a new one.
*/
@@ -418,7 +417,7 @@
(void)printf("%d seconds)\n",
(int)edp->refresh_timo);
}
-
+
free(edp);
edp = NULL;
}
@@ -732,14 +731,14 @@
if (width)
maxlen = width;
- /*
+ /*
* Print a header at the bottom only once showing different
* members if the statistics flag is set or not.
*
* As bonus if -s is set, only print this header every 10 iterations
* to avoid redundancy... like vmstat(1).
*/
-
+
a = "Current";
units = "Unit";
if (statistics) {
Home |
Main Index |
Thread Index |
Old Index