summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/apm/apm.819
-rw-r--r--usr.sbin/apm/apm.c8
-rw-r--r--usr.sbin/apmd/apm-proto.h13
-rw-r--r--usr.sbin/apmd/apmd.816
-rw-r--r--usr.sbin/apmd/apmd.c15
-rw-r--r--usr.sbin/apmd/apmsubr.c16
6 files changed, 42 insertions, 45 deletions
diff --git a/usr.sbin/apm/apm.8 b/usr.sbin/apm/apm.8
index 6f17c9db32e..5f907ef0032 100644
--- a/usr.sbin/apm/apm.8
+++ b/usr.sbin/apm/apm.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: apm.8,v 1.28 2006/03/07 05:24:36 deraadt Exp $
+.\" $OpenBSD: apm.8,v 1.29 2006/03/15 20:30:27 sturm Exp $
.\"
.\" Copyright (c) 1996 John T. Kohl
.\" All rights reserved.
@@ -99,13 +99,13 @@ to
.It Fl H
Set
.Xr apmd 8
-to high performance mode and
+to manual performance adjustment mode and
.Va hw.setperf
to 100.
.It Fl L
Set
.Xr apmd 8
-to low performance mode and
+to manual performance adjustment mode and
.Va hw.setperf
to 0.
.It Fl l
@@ -114,28 +114,27 @@ Display the estimated battery lifetime (in percent).
Display the estimated battery lifetime (in minutes).
.It Fl P
Display the performance adjustment mode.
-0 means uninitialized, 1 means low performance mode, 2 means high performance
-mode, 3 means automatic mode, and 4 means cool running mode.
+0 means manual mode, 1 means automatic mode, and 2 means cool running mode.
.It Fl S
-Put the system into stand-by (light sleep) mode.
+Put the system into stand-by (light sleep) state.
.It Fl v
Request more verbose description of the displayed states.
.It Fl z
-Put the system into suspend (deep sleep) mode.
+Put the system into suspend (deep sleep) state.
.El
.Pp
The
.Nm zzz
-variant on this command is an alternative for suspending the system.
+variant of this command is an alternative for suspending the system.
With no arguments,
.Nm zzz
-places the system into suspend mode.
+places the system into suspend state.
The command line flags serve the same purpose as for the
.Nm
variant of this command.
.Pp
This command does not wait for positive confirmation that the requested
-mode has been entered; to do so would mean the command does not return
+state has been entered; to do so would mean the command does not return
until the system resumes from its sleep state.
.Sh FILES
.Bl -tag -width /var/run/apmdev -compact
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index a9e46f8879d..c27af0328f1 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.19 2006/03/06 15:21:05 mickey Exp $ */
+/* $OpenBSD: apm.c,v 1.20 2006/03/15 20:30:27 sturm Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
@@ -277,7 +277,7 @@ main(int argc, char *argv[])
printf("%d\n",
reply.batterystate.ac_state);
if (doperf)
- printf("%d\n", reply.perfstate);
+ printf("%d\n", reply.perfmode);
break;
}
@@ -346,8 +346,8 @@ main(int argc, char *argv[])
ac_state(reply.batterystate.ac_state));
if (doperf)
- printf("Performance state: %s (%d MHz)\n",
- perf_state(reply.perfstate), reply.cpuspeed);
+ printf("Performance adjustment mode: %s (%d MHz)\n",
+ perf_mode(reply.perfmode), reply.cpuspeed);
break;
default:
break;
diff --git a/usr.sbin/apmd/apm-proto.h b/usr.sbin/apmd/apm-proto.h
index ce63843bc34..fee1405b72c 100644
--- a/usr.sbin/apmd/apm-proto.h
+++ b/usr.sbin/apmd/apm-proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm-proto.h,v 1.7 2006/01/19 19:17:10 sturm Exp $ */
+/* $OpenBSD: apm-proto.h,v 1.8 2006/03/15 20:30:28 sturm Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
@@ -46,10 +46,9 @@ enum apm_state {
STANDING_BY
};
-enum apm_perfstate {
- PERF_NONE,
- PERF_LOW,
- PERF_HIGH,
+enum apm_perfmode {
+ PERF_NONE = -1,
+ PERF_MANUAL,
PERF_AUTO,
PERF_COOL
};
@@ -62,7 +61,7 @@ struct apm_command {
struct apm_reply {
int vno;
enum apm_state newstate;
- enum apm_perfstate perfstate;
+ enum apm_perfmode perfmode;
int cpuspeed;
struct apm_power_info batterystate;
};
@@ -71,4 +70,4 @@ struct apm_reply {
extern const char *battstate(int state);
extern const char *ac_state(int state);
-extern const char *perf_state(int state);
+extern const char *perf_mode(int mode);
diff --git a/usr.sbin/apmd/apmd.8 b/usr.sbin/apmd/apmd.8
index 5ed555c7d5a..397cec5d29e 100644
--- a/usr.sbin/apmd/apmd.8
+++ b/usr.sbin/apmd/apmd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: apmd.8,v 1.33 2006/01/19 19:17:10 sturm Exp $
+.\" $OpenBSD: apmd.8,v 1.34 2006/03/15 20:30:28 sturm Exp $
.\"
.\" Copyright (c) 1995 John T. Kohl
.\" All rights reserved.
@@ -48,7 +48,7 @@ For suspend and standby request events delivered by the BIOS, or via
.Xr apm 8 ,
.Nm
runs the appropriate configuration program (if one exists),
-syncs the buffer cache to disk and initiates the requested mode.
+syncs the buffer cache to disk and initiates the requested state.
When resuming after suspend or standby,
.Nm
runs the appropriate configuration program (if one exists).
@@ -112,13 +112,13 @@ Specify an alternate device file name,
.It Fl H
Start
.Nm
-in high performance mode, initialising
+in manual performance adjustment mode, initialising
.Va hw.setperf
to 100.
.It Fl L
Start
.Nm
-in low performance mode, initialising
+in manual performance adjustment mode, initialising
.Va hw.setperf
to 0.
.It Fl m
@@ -166,15 +166,15 @@ once per 10 minutes, but may be specified using the
command-line flag.
.El
.Pp
-When a client requests a suspend or stand-by mode,
+When a client requests a suspend or stand-by state,
.Nm
does not wait for positive confirmation that the requested
-mode has been entered before replying to the client; to do so would mean
+state has been entered before replying to the client; to do so would mean
the client does not get a reply until the system resumes from its sleep state.
Rather,
.Nm
replies with the intended state to the client and then places the system
-in the requested mode after running the configuration script and
+in the requested state after running the configuration script and
flushing the buffer cache.
.Pp
Actions can be configured for the following five transitions:
@@ -187,7 +187,7 @@ and
The suspend and standby actions are run prior to
.Nm
performing any other actions (such as disk syncs) and entering the new
-mode.
+state.
The resume program is run after resuming from a stand-by or
suspended state.
The powerup and powerdown programs are run after the power status (AC
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 4d8f5b79ec0..d36191cc382 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.42 2006/03/14 22:30:53 sturm Exp $ */
+/* $OpenBSD: apmd.c,v 1.43 2006/03/15 20:30:28 sturm Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -338,13 +338,13 @@ handle_client(int sock_fd, int ctl_fd)
reply.newstate = STANDING_BY;
break;
case SETPERF_LOW:
- doperf = PERF_LOW;
+ doperf = PERF_MANUAL;
reply.newstate = NORMAL;
syslog(LOG_NOTICE, "setting hw.setperf to %d", PERFMIN);
setperf(PERFMIN);
break;
case SETPERF_HIGH:
- doperf = PERF_HIGH;
+ doperf = PERF_MANUAL;
reply.newstate = NORMAL;
syslog(LOG_NOTICE, "setting hw.setperf to %d", PERFMAX);
setperf(PERFMAX);
@@ -368,7 +368,7 @@ handle_client(int sock_fd, int ctl_fd)
syslog(LOG_INFO, "cannot read hw.cpuspeed");
reply.cpuspeed = cpuspeed;
- reply.perfstate = doperf;
+ reply.perfmode = doperf;
reply.vno = APMD_VNO;
if (send(cli_fd, &reply, sizeof(reply), 0) != sizeof(reply))
syslog(LOG_INFO, "client reply botch");
@@ -460,13 +460,13 @@ main(int argc, char *argv[])
case 'L':
if (doperf != PERF_NONE)
usage();
- doperf = PERF_LOW;
+ doperf = PERF_MANUAL;
setperf(PERFMIN);
break;
case 'H':
if (doperf != PERF_NONE)
usage();
- doperf = PERF_HIGH;
+ doperf = PERF_MANUAL;
setperf(PERFMAX);
break;
case 'm':
@@ -480,6 +480,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (doperf == PERF_NONE)
+ doperf = PERF_MANUAL;
+
if (debug)
openlog(__progname, LOG_CONS, LOG_LOCAL1);
else {
diff --git a/usr.sbin/apmd/apmsubr.c b/usr.sbin/apmd/apmsubr.c
index fc0d3eb557f..5af4ab98546 100644
--- a/usr.sbin/apmd/apmsubr.c
+++ b/usr.sbin/apmd/apmsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmsubr.c,v 1.7 2006/01/28 17:08:14 sturm Exp $ */
+/* $OpenBSD: apmsubr.c,v 1.8 2006/03/15 20:30:28 sturm Exp $ */
/*
* Copyright (c) 1995,1996 John T. Kohl
@@ -72,20 +72,16 @@ ac_state(int state)
}
const char *
-perf_state(int state)
+perf_mode(int mode)
{
- switch (state) {
- case PERF_NONE:
- return "uninitialized";
- case PERF_LOW:
- return "low";
- case PERF_HIGH:
- return "high";
+ switch (mode) {
+ case PERF_MANUAL:
+ return "manual";
case PERF_AUTO:
return "auto";
case PERF_COOL:
return "cool running";
default:
- return "invalid performance status";
+ return "invalid";
}
}