c4d9468ea0
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
297 lines
7.8 KiB
Groff
297 lines
7.8 KiB
Groff
.\" Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
|
|
.\" Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp>
|
|
.\" Copyright (c) 1999 Yoshihiko SARUMARU Aq <mistral@imasy.or.jp>
|
|
.\" Copyright (c) 1999 Norihiro Kumagai <kuma@nk.rim.or.jp>
|
|
.\" 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.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
|
.\"
|
|
.\" @(#)apmd.8 1.1 (FreeBSD) 6/28/99
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd June 28, 1999
|
|
.Dt APMD 8
|
|
.Os
|
|
.Sh NAME
|
|
.Nm apmd
|
|
.Nd Advanced Power Management monitor daemon
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl d
|
|
.Op Fl f file
|
|
.Op Fl v
|
|
.Sh DESCRIPTION
|
|
.Nm Apmd
|
|
monitors the occurrence of the specified Advanced Power Management
|
|
.Pq Tn APM
|
|
events and, if one of the events occurs, it executes the sequence of
|
|
commands corresponding to the event. Only the events specified in the
|
|
configuration file are notified to
|
|
.Nm ;
|
|
all other events are ignored. For each event posted by the APM BIOS,
|
|
.Nm
|
|
invokes the sequence of commands specified in the configuration file.
|
|
When
|
|
.Nm
|
|
is running with monitoring suspend/standby requests,
|
|
the kernel will not process those requests.
|
|
Therefore, if you wish action to be taken when these events
|
|
occur, you need to explicitly configure the appropriate commands or
|
|
built-in functions in the configuration file.
|
|
.Pp
|
|
.Nm Apmd
|
|
recognizes the following runtime options:
|
|
.Bl -tag -width -f_file
|
|
.It Fl d
|
|
Starts in debug mode. This causes
|
|
.Nm
|
|
to execute in the foreground instead of in daemon mode.
|
|
.It Fl f Ar file
|
|
Specifies a different configuration file
|
|
.Ar file
|
|
to be used in place of the default
|
|
.Pa /etc/apmd.conf .
|
|
.It Fl v
|
|
Verbose mode.
|
|
.El
|
|
.Pp
|
|
When
|
|
.Nm
|
|
starts, it reads the configuration file
|
|
.Pa ( /etc/apmd.conf
|
|
as default)
|
|
and notifies the set of events to be monitored to the APM device driver.
|
|
When it terminates, the APM device driver automatically cancels
|
|
monitored events.
|
|
.Pp
|
|
If the
|
|
.Nm
|
|
process receives a SIGHUP, it will reread its configuration file and
|
|
notify the APM device driver of any changes to its configuration.
|
|
.Pp
|
|
.Nm Apmd
|
|
uses the device
|
|
.Pa /dev/apmctl
|
|
to issue
|
|
.Xr ioctl 2
|
|
requests for monitoring events and for controlling the APM system.
|
|
This device file is opened exclusively, so only a single
|
|
.Nm
|
|
process can be running at any time.
|
|
.Pp
|
|
When
|
|
.Nm
|
|
receives an APM event, it forks a child process to execute the
|
|
commands specified in the configuration file and then continues
|
|
listening for more events. The child process executes the commands
|
|
specified, one at a time and in the order that they are listed.
|
|
.Pp
|
|
While
|
|
.Nm
|
|
is processing the command list for SUSPEND/STANDBY requests, the APM kernel
|
|
device driver issues notifications to APM BIOS once per second so that the
|
|
BIOS knows that there are still some commands pending, and that it should not
|
|
complete the request just yet.
|
|
.Pp
|
|
The
|
|
.Nm
|
|
daemon creates the file
|
|
.Pa /var/run/apmd.pid ,
|
|
and stores its process
|
|
id there.
|
|
This can be used to kill or reconfigure
|
|
.Nm .
|
|
.Sh CONFIGURATION FILE
|
|
The structure of the
|
|
.Nm
|
|
configuration file is quite simple. For example:
|
|
.Pp
|
|
.Bd -literal
|
|
apm_event SUSPENDREQ {
|
|
exec "sync && sync && sync";
|
|
exec "sleep 1";
|
|
exec "zzz";
|
|
}
|
|
.Ed
|
|
.Pp
|
|
will cause
|
|
.Nm
|
|
to receive the APM event
|
|
.Ql SUSPENDREQ
|
|
(which may be posted by an LCD close), run the
|
|
.Ql sync
|
|
command 3 times and wait for a while, then execute
|
|
.Nm zzz ( Ns Nm apm Fl z )
|
|
to put the system in the suspend state.
|
|
.Pp
|
|
.Bl -bullet
|
|
.It
|
|
The apm_event keyword
|
|
.Bd -ragged -offset indent
|
|
.Ql apm_event
|
|
is the keyword which indicates the start of configuration for
|
|
each events.
|
|
.Ed
|
|
.It
|
|
APM events
|
|
.Bd -ragged -offset indent
|
|
If you wish to execute the same commands for different events, the
|
|
event names should be delimited by a comma. The following are
|
|
valid event names:
|
|
.Bl -item
|
|
.It
|
|
- Events ignored by the kernel if
|
|
.Nm
|
|
is running:
|
|
.Pp
|
|
.Bl -tag -width USERSUSPENDREQ -compact -offset indent
|
|
.It STANDBYREQ
|
|
.It USERSTANDBYREQ
|
|
.It SUSPENDREQ
|
|
should include sync in the command list,
|
|
.It USERSUSPENDREQ
|
|
should include sync in the command list,
|
|
.It BATTERYLOW
|
|
only zzz should be specified in the command list.
|
|
.El
|
|
.It
|
|
- Events passed to
|
|
.Nm
|
|
after kernel handling:
|
|
.Pp
|
|
.Bl -tag -width USERSUSPENDREQ -compact -offset indent
|
|
.It NORMRESUME
|
|
.It CRITRESUME
|
|
.It STANDBYRESUME
|
|
.It POWERSTATECHANGE
|
|
.It UPDATETIME
|
|
.It CAPABILITIESCHANGE
|
|
.El
|
|
.Pp
|
|
Other events will not be sent to
|
|
.Nm .
|
|
.El
|
|
.Ed
|
|
.It
|
|
command line syntax
|
|
.Bd -ragged -offset indent
|
|
In the example above, the three lines begining with
|
|
.Ql exec
|
|
are commands for the event.
|
|
Each line should be terminated with a semicolon.
|
|
The command list for the event should be enclosed by
|
|
.Ql {
|
|
and
|
|
.Ql } .
|
|
.Nm
|
|
uses
|
|
.Pa /bin/sh
|
|
for double-quotation enclosed command execution, just as with
|
|
.Xr system 3 .
|
|
Each command is executed in order until the end of
|
|
the list is reached or a command finishes with a non-zero status code.
|
|
.Nm
|
|
will report any failed command's status code via
|
|
.Xr syslog 3
|
|
and will then reject the request event posted by the APM BIOS.
|
|
.Ed
|
|
.It
|
|
Built-in functions
|
|
.Bd -ragged -offset indent
|
|
You can also specify
|
|
.Nm
|
|
built-in functions instead of command lines.
|
|
A built-in function name should be terminated with a semicolon,
|
|
just as with a command line.
|
|
The following built-in functions are currently supported:
|
|
.Bl -item
|
|
.It
|
|
- reject:
|
|
.Bd -ragged -offset indent
|
|
Reject last request posted by APM BIOS. This can be used to reject
|
|
a SUSPEND request when the LCD is closed and put the system in a
|
|
STANDBY state instead.
|
|
.Ed
|
|
.El
|
|
.Ed
|
|
.El
|
|
.Sh EXAMPLES
|
|
Sample configuration commands include:
|
|
.Bd -literal
|
|
apm_event SUSPENDREQ {
|
|
exec "/etc/rc.suspend";
|
|
}
|
|
|
|
apm_event USERSUSPENDREQ {
|
|
exec "sync && sync && sync";
|
|
exec "sleep 1";
|
|
exec "apm -z";
|
|
}
|
|
|
|
apm_event NORMRESUME, STANDBYRESUME {
|
|
exec "/etc/rc.resume";
|
|
}
|
|
|
|
# resume event configuration for serial mouse users by
|
|
# reinitializing a moused(8) connected to a serial port.
|
|
#
|
|
#apm_event NORMRESUME {
|
|
# exec "kill -HUP `cat /var/run/moused.pid`";
|
|
#}
|
|
#
|
|
# suspend request event configuration for ATA HDD users:
|
|
# execute standby instead of suspend.
|
|
#
|
|
#apm_event SUSPENDREQ {
|
|
# reject;
|
|
# exec "sync && sync && sync";
|
|
# exec "sleep 1";
|
|
# exec "apm -Z";
|
|
#}
|
|
.Ed
|
|
.Sh FILES
|
|
.Bl -tag -width /etc/apmd.conf -compact
|
|
.It Pa /etc/apmd.conf
|
|
.It Pa /dev/apmctl
|
|
.It Pa /var/run/apmd.pid
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr apm 4 ,
|
|
.Xr apm 8
|
|
.Sh AUTHORS
|
|
.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org
|
|
.An KOIE Hidetaka Aq koie@suri.co.jp
|
|
.Pp
|
|
Some contributions made by
|
|
.An Warner Losh Aq imp@FreeBSD.org ,
|
|
.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp ,
|
|
.An Yoshihiko SARUMARU Aq mistral@imasy.or.jp ,
|
|
.An Norihiro Kumagai Aq kuma@nk.rim.or.jp ,
|
|
.An NAKAGAWA Yoshihisa Aq nakagawa@jp.FreeBSD.org ,
|
|
and
|
|
.An Nick Hilliard Aq nick@foobar.org .
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
command appeared in
|
|
.Fx 3.3 .
|