xref: /openbsd/usr.sbin/apmd/apmd.8 (revision f2dfb0a4)
1.\" Copyright (c) 1995 John T. Kohl
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. The name of the author may not be used to endorse or promote products
13.\"    derived from this software without specific prior written permission.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25.\" POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\"	$Id: apmd.8,v 1.3 1998/03/10 04:51:05 millert Exp $
28.\"
29.Dd March 24, 1996
30.Dt APMD 8
31.Os OpenBSD
32.Sh NAME
33.Nm apmd
34.Nd Advanced Power Management monitor daemon
35.Sh SYNOPSIS
36.Nm
37.Op Fl d
38.Op Fl s
39.Op Fl a
40.Op Fl q
41.Op Fl t Ar seconds
42.Op Fl S Ar sockname
43.Op Fl f Ar devname
44.Sh DESCRIPTION
45.Nm
46monitors the advanced power management (APM) pseudo-device, acting on
47signaled events and upon user requests as sent by the
48.Xr apm 8
49program.
50For suspend and standby request events delivered by the BIOS, or via
51.Xr apm 8 ,
52.Nm
53runs the appropriate configuration program (if one exists),
54syncs the buffer cache to disk and initiates the requested mode.
55When resuming after suspend or standby,
56.Nm
57runs the appropriate configuration program (if one exists).
58For power status change events,
59.Nm
60fetches the current status and reports it via
61.Xr syslog 3
62with logging facility
63.Dv LOG_DAEMON .
64.Pp
65.Nm
66announces the transition to standby mode with a single high tone on the
67speaker (using the
68.Pa /dev/speaker
69device).
70Suspends are announced with two high tones.
71.Pp
72.Nm
73periodically polls the APM driver for the current power state.
74If the battery charge level changes substantially or the external power
75status changes, the new status is logged.  The polling rate defaults to
76once per 10 minutes, but may be specified using the
77.Fl t
78command-line flag.
79.Pp
80If the
81.Fl s
82flag is specified, the current battery statistics are reported via
83.Xr syslog 3
84and
85.Nm
86exits without monitoring the APM status.
87.Pp
88If the
89.Fl a
90flag is specified, any BIOS-initiated suspend or standby requests are
91ignored if the system is connected to line current and not running from
92batteries (user requests are still honored).
93.Pp
94If the
95.Fl d
96flag is specified,
97.Nm
98enters debug mode, logging to facility
99.Dv LOG_LOCAL1
100and staying in the foreground on the controlling terminal.
101.Pp
102If the
103.Fl q
104flag is specified,
105.Nm
106does not announce suspend and standby requests on the speaker.
107.Pp
108When a client requests a suspend or stand-by mode,
109.Nm
110does not wait for positive confirmation that the requested
111mode has been entered before replying to the client; to do so would mean
112the client does not get a reply until the system resumes from its sleep state.
113Rather,
114.Nm
115replies with the intended state to the client and then places the system
116in the requested mode after running the configuration script and
117flushing the buffer cache.
118.Pp
119Actions can be configured for the three transitions:
120.Cm suspend ,
121.Cm standby
122and
123.Cm resume .
124The suspend and standby actions are run prior to
125.Nm
126performing any other actions (such as disk syncs) and entering the new
127mode.  The resume program is run after resuming from a stand-by or
128suspended state.
129.Sh FILES
130.Pa /etc/apm/suspend ,
131.Pa /etc/apm/standby
132and
133.Pa /etc/apm/resume
134are the files that contain the host's customized actions.
135Each file must be an executable binary or shell script suitable
136for execution by the
137.Xr execve 2
138function.
139If you wish to have the same program or script control all transitions, it
140may determine which transition is in progress by examining its
141.Va argv[0]
142which is set to one of
143.Ar suspend ,
144.Ar standby ,
145or
146.Ar resume .
147.Pp
148.Pa /var/run/apmdev
149is the default UNIX-domain socket used for communication with
150.Xr apm 8 .
151The
152.Fl S
153flag may be used to specify an alternate socket name.
154The socket is protected to mode 0660, UID 0, GID 0; this protects access
155to suspend requests to authorized users only.
156.Pp
157.Pa /dev/apmctl
158is the default device used to control the APM kernel driver.
159The
160.Fl f
161flag may be used to specify an alternate device file name.
162.Sh SEE ALSO
163.Xr apm 4 ,
164.Xr apm 8 ,
165.Xr execve 2 ,
166.Xr speaker 4 ,
167.Xr syslog 3 ,
168.Xr syslogd 8 .
169.Sh REFERENCES
170Advanced Power Management (APM) BIOS Interface Specification (revision
1711.1), Intel Corporation and Microsoft Corporation.
172.Sh HISTORY
173The
174.Nm apmd
175command appeared in
176.Ox 1.2 .
177