1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
.\" $OpenBSD: apmd.8,v 1.21 2001/07/18 16:03:06 mickey Exp $
.\"
.\" Copyright (c) 1995 John T. Kohl
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 24, 1996
.Dt APMD 8
.Os
.Sh NAME
.Nm apmd
.Nd Advanced Power Management monitor daemon
.Sh SYNOPSIS
.Nm apmd
.Op Fl adempqs
.Op Fl f Ar devname
.Op Fl S Ar sockname
.Op Fl t Ar seconds
.Sh DESCRIPTION
.Nm
monitors the advanced power management (APM) pseudo-device, acting on
signaled events and upon user requests as sent by the
.Xr apm 8
program.
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.
When resuming after suspend or standby,
.Nm
runs the appropriate configuration program (if one exists).
For power status change events,
.Nm
fetches the current status and reports it via
.Xr syslog 3
with logging facility
.Dv LOG_DAEMON .
.Pp
.Nm
announces the transition to standby mode with a single high tone on the
speaker (using the
.Pa /dev/speaker
device).
Suspends are announced with two high tones.
.Pp
.Nm
periodically polls the APM driver for the current power state.
If the battery charge level changes substantially or the external power
status changes, the new status is logged.
The polling rate defaults to
once per 10 minutes, but may be specified using the
.Fl t
command-line flag.
.Pp
If the
.Fl s
flag is specified, the current battery statistics are reported via
.Xr syslog 3
and
.Nm
exits without monitoring the APM status.
.Pp
If the
.Fl a
flag is specified, any BIOS-initiated suspend or standby requests are
ignored if the system is connected to line current and not running from
batteries (user requests are still honored).
.Pp
If the
.Fl d
flag is specified,
.Nm
enters debug mode, logging to facility
.Dv LOG_LOCAL1
and staying in the foreground on the controlling terminal.
.Pp
If the
.Fl q
flag is specified,
.Nm
does not announce suspend and standby requests on the speaker.
.Pp
If the
.Fl m
flag is specified,
.Nm
does not disable power status messages issued by the
.Tn APM
driver.
In normal operation these status messages are disabled as they are
the same as the information collected by this daemon and reported via syslog.
.Pp
The
.Fl e
and
.Fl p
flags are used to re-enable
.Tn APM
driver power status messages.
In both cases
.Nm
exits immediately after setting the desired option.
The
.Fl e
flag unconditionally enables power status messages.
The
.Fl p
flag causes power status messages to be displayed only when the
battery life expectancy changes.
This minimizes message output
for those devices that are constantly updating the estimated time
remaining based upon current processor load.
However, in no case
will power status messages be displayed until the battery life
goes below the percentage in the
.Xr sysctl 8
state variable
.Dv machdep.apmwarn .
Setting
.Dv machdep.apmwarn
to zero disables all warnings.
.Pp
When a client requests a suspend or stand-by mode,
.Nm
does not wait for positive confirmation that the requested
mode 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
flushing the buffer cache.
.Pp
Actions can be configured for the following five transitions:
.Cm suspend ,
.Cm standby ,
.Cm resume ,
.Cm powerup
and
.Cm powerdown .
The suspend and standby actions are run prior to
.Nm
performing any other actions (such as disk syncs) and entering the new
mode.
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
connected or not) changes, as well as after a resume (if the power
status changed in the mean time).
.Sh FILES
.Pa /etc/apm/suspend ,
.Pa /etc/apm/standby ,
.Pa /etc/apm/resume ,
.Pa /etc/apm/powerup
and
.Pa /etc/apm/powerdown
are the files that contain the host's customized actions.
Each file must be an executable binary or shell script suitable
for execution by the
.Xr execve 2
function.
If you wish to have the same program or script control all transitions, it
may determine which transition is in progress by examining its
.Va argv[0]
which is set to one of
.Ar suspend ,
.Ar standby ,
.Ar resume ,
.Ar powerup
and
.Ar powerdown .
.Pp
.Pa /var/run/apmdev
is the default UNIX-domain socket used for communication with
.Xr apm 8 .
The
.Fl S
flag may be used to specify an alternate socket name.
The socket is protected to mode 0660, UID 0, GID 0; this protects access
to suspend requests to authorized users only.
.Pp
.Pa /dev/apmctl
is the default device used to control the APM kernel driver.
The
.Fl f
flag may be used to specify an alternate device file name.
.Sh SEE ALSO
.Xr execve 2 ,
.Xr syslog 3 ,
.Xr apm 4 ,
.Xr speaker 4 ,
.Xr apm 8 ,
.Xr syslogd 8
.Sh REFERENCES
Advanced Power Management (APM) BIOS Interface Specification (revision
1.2), Intel Corporation and Microsoft Corporation.
.Sh HISTORY
The
.Nm
command appeared in
.Nx 1.3 ,
.Ox
support was added in
.Ox 1.2 .
|