git: 247503fedb19 - main - apmd: Retire the APM daemon
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Sep 2026 16:27:36 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=247503fedb192bb32d22a8606d471c654854517d
commit 247503fedb192bb32d22a8606d471c654854517d
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-09-30 16:20:02 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-09-30 16:20:02 +0000
apmd: Retire the APM daemon
The original purpose of this daemon was to route power management
requests to userspace, e.g. when the suspend button was pressed, the
APM driver posted an event read by apmd(8) that would invoke zzz(8) to
suspend. However, on ACPI systems this is handled by devd(8) events
instead and running apmd(8) in addition just adds extra complexity.
This probably should have been axed when the APM BIOS support was
retired in commit 8c576a279ed5.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D59937
---
ObsoleteFiles.inc | 7 +
libexec/rc/rc.conf | 2 -
libexec/rc/rc.d/Makefile | 3 +-
libexec/rc/rc.d/apmd | 41 --
libexec/rc/rc.resume | 4 +-
libexec/rc/rc.suspend | 13 +-
share/examples/etc/README.examples | 1 -
share/man/man5/rc.conf.5 | 17 +-
targets/pseudo/userland/Makefile.depend | 1 -
tools/build/mk/OptionalObsoleteFiles.inc | 4 -
tools/build/options/WITHOUT_APM | 4 +-
usr.sbin/Makefile | 3 +-
usr.sbin/Makefile.i386 | 1 -
usr.sbin/acpi/acpiconf/acpiconf.8 | 5 +-
usr.sbin/apmd/Makefile | 15 -
usr.sbin/apmd/Makefile.depend | 16 -
usr.sbin/apmd/README | 211 ----------
usr.sbin/apmd/apmd.8 | 319 --------------
usr.sbin/apmd/apmd.c | 702 -------------------------------
usr.sbin/apmd/apmd.conf | 54 ---
usr.sbin/apmd/apmd.h | 133 ------
usr.sbin/apmd/apmdlex.l | 118 ------
usr.sbin/apmd/apmdparse.y | 206 ---------
usr.sbin/apmd/contrib/pccardq.c | 285 -------------
24 files changed, 19 insertions(+), 2146 deletions(-)
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 2e548a709f58..39df19deb432 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,13 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20260930: apmd(8) removed
+OLD_FILES+=etc/apmd.conf
+OLD_FILES+=etc/rc.d/apmd
+OLD_FILES+=usr/share/examples/etc/apmd.conf
+OLD_FILES+=usr/share/man/man8/apmd.8.gz
+OLD_FILES+=usr/sbin/apmd
+
# 20260918: lesskey(1) removed, lesskey(5) man page added
OLD_FILES+=usr/bin/lesskey
OLD_FILES+=usr/share/man/man1/lesskey.1.gz
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index aaeb65e92264..b6b69629551c 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -40,8 +40,6 @@ always_force_depends="NO" # Set to check that indicated dependencies are
# running during boot (can increase boot time).
apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO).
-apmd_enable="NO" # Run apmd to handle APM event from userland.
-apmd_flags="" # Flags to apmd (if enabled).
backlight_enable="NO" # Save/restore backlight levels
ddb_enable="NO" # Set to YES to load ddb scripts at boot.
ddb_config="/etc/ddb.conf" # ddb(8) config file.
diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile
index a84f3e04381e..406b1b41d902 100644
--- a/libexec/rc/rc.d/Makefile
+++ b/libexec/rc/rc.d/Makefile
@@ -100,8 +100,7 @@ ACPI= power_profile
.if ${MACHINE} == "i386"
CONFGROUPS.${MK_APM}+= APM
APMPACKAGE= apm
-APM= apm \
- apmd
+APM= apm
.endif
CONFGROUPS.${MK_AUDIT}+= AUDIT
diff --git a/libexec/rc/rc.d/apmd b/libexec/rc/rc.d/apmd
deleted file mode 100755
index aeb5042342d6..000000000000
--- a/libexec/rc/rc.d/apmd
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-#
-#
-
-# PROVIDE: apmd
-# REQUIRE: DAEMON apm
-# BEFORE: LOGIN
-# KEYWORD: nojail shutdown
-
-. /etc/rc.subr
-
-name="apmd"
-desc="Advanced power management daemon"
-rcvar="apmd_enable"
-command="/usr/sbin/${name}"
-start_precmd="apmd_prestart"
-
-apmd_prestart()
-{
- case `${SYSCTL_N} hw.machine_arch` in
- i386)
- force_depend apm || return 1
-
- # Warn user about acpi apm compatibility support which
- # does not work with apmd.
- if [ ! -e /dev/apmctl ]; then
- warn "/dev/apmctl not found; kernel is missing apm(4)"
- fi
- ;;
- *)
- return 1
- ;;
- esac
-}
-
-load_rc_config $name
-
-# doesn't make sense to run in a svcj: nojail keyword
-apmd_svcj="NO"
-
-run_rc_command "$1"
diff --git a/libexec/rc/rc.resume b/libexec/rc/rc.resume
index 147bc2ba4f8d..10680e6fdc27 100755
--- a/libexec/rc/rc.resume
+++ b/libexec/rc/rc.resume
@@ -26,10 +26,10 @@
#
#
-# sample run command file for APM Resume Event
+# sample run command file for Power Management Resume Event
if [ $# -ne 2 ]; then
- echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
+ echo "Usage: $0 [acpi] [standby,suspend|1-4]"
exit 1
fi
diff --git a/libexec/rc/rc.suspend b/libexec/rc/rc.suspend
index 8990be81466c..bfb96fb8e4a9 100755
--- a/libexec/rc/rc.suspend
+++ b/libexec/rc/rc.suspend
@@ -26,10 +26,10 @@
#
#
-# sample run command file for APM Suspend Event
+# sample run command file for Power Management Suspend Event
if [ $# -ne 2 ]; then
- echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
+ echo "Usage: $0 [acpi] [standby,suspend|1-4]"
exit 1
fi
@@ -69,11 +69,8 @@ done
/bin/sleep 3
/bin/rm -f /var/run/rc.suspend.pid
-if [ $subsystem = "apm" ]; then
- /usr/sbin/zzz
-else
- # Notify the kernel to continue the suspend process
- /usr/sbin/acpiconf -k 0
-fi
+
+# Notify the kernel to continue the suspend process
+/usr/sbin/acpiconf -k 0
exit 0
diff --git a/share/examples/etc/README.examples b/share/examples/etc/README.examples
index 810e5e28cb5c..656a178eba74 100644
--- a/share/examples/etc/README.examples
+++ b/share/examples/etc/README.examples
@@ -7,7 +7,6 @@ accidentally deleted or broken beyond repair.
This directory contains the following files:
amd.map - filesystem automounter lookup resolution map (see amd(8))
-apmd.conf - configuration file for apmd(8)
bsd-style-copyright - copyright style for bsd system
crontab - system scheduled command table (see crontab(5))
csh.cshrc - sample .cshrc (see csh(1))
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 05c1ac1c47fa..02f75d775cee 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 11, 2026
+.Dd September 30, 2026
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -301,21 +301,6 @@ enable support for Automatic Power Management with
the
.Xr apm 8
command.
-.It Va apmd_enable
-.Pq Vt bool
-Run
-.Xr apmd 8
-to handle APM event from userland.
-This also enables support for APM.
-.It Va apmd_flags
-.Pq Vt str
-If
-.Va apmd_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr apmd 8
-daemon.
.It Va devd_enable
.Pq Vt bool
Run
diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend
index 25e91d8d92a8..a50cb7561c36 100644
--- a/targets/pseudo/userland/Makefile.depend
+++ b/targets/pseudo/userland/Makefile.depend
@@ -774,7 +774,6 @@ DIRDEPS.i386= \
sbin/fdisk \
sbin/nvmecontrol \
usr.sbin/apm \
- usr.sbin/apmd \
usr.sbin/btxld \
usr.sbin/cpucontrol \
usr.sbin/hyperv/tools \
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index bb98b3a73616..821761ddd15f 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -61,13 +61,9 @@ OLD_FILES+=etc/devd/power_profile.conf
.if ${MK_APM} == no
OLD_FILES+=etc/rc.d/apm
-OLD_FILES+=etc/rc.d/apmd
-OLD_FILES+=etc/apmd.conf
OLD_FILES+=usr/sbin/apm
-OLD_FILES+=usr/share/examples/etc/apmd.conf
.elif ${TARGET_ARCH} != "i386"
OLD_FILES+=etc/rc.d/apm
-OLD_FILES+=etc/rc.d/apmd
.endif
.if ${MK_AT} == no
diff --git a/tools/build/options/WITHOUT_APM b/tools/build/options/WITHOUT_APM
index b8658381964b..5f681cb63a5d 100644
--- a/tools/build/options/WITHOUT_APM
+++ b/tools/build/options/WITHOUT_APM
@@ -1,4 +1,2 @@
Do not build
-.Xr apm 8 ,
-.Xr apmd 8
-and related programs.
+.Xr apm 8 .
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 421aface4ac9..abd2967584fc 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -227,8 +227,7 @@ SUBDIR_PARALLEL=
# Add architecture-specific manpages
# to be included anyway
-MAN= apmd/apmd.8 \
- nvram/nvram.8
+MAN= nvram/nvram.8
.include <bsd.prog.mk>
diff --git a/usr.sbin/Makefile.i386 b/usr.sbin/Makefile.i386
index 4c1418eb2660..02226979e39e 100644
--- a/usr.sbin/Makefile.i386
+++ b/usr.sbin/Makefile.i386
@@ -3,7 +3,6 @@ SUBDIR+= acpi
.endif
.if ${MK_APM} != "no"
SUBDIR+= apm
-SUBDIR+= apmd
.endif
SUBDIR+= boot0cfg
.if ${MK_TOOLCHAIN} != "no"
diff --git a/usr.sbin/acpi/acpiconf/acpiconf.8 b/usr.sbin/acpi/acpiconf/acpiconf.8
index 24af8b5c8719..b762f07b5214 100644
--- a/usr.sbin/acpi/acpiconf/acpiconf.8
+++ b/usr.sbin/acpi/acpiconf/acpiconf.8
@@ -25,7 +25,7 @@
.\" (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 June 16, 2023
+.Dd September 30, 2026
.Dt ACPICONF 8
.Os
.Sh NAME
@@ -74,8 +74,6 @@ and
.Pa /etc/rc.resume
scripts are executable, they will be run by
.Xr devd 8
-or
-.Xr apmd 8
before and after entering the given sleep state.
.Pp
The
@@ -101,7 +99,6 @@ for more information about
.Xr rc.conf 5 ,
.Xr acpidump 8 ,
.Xr apm 8 ,
-.Xr apmd 8 ,
.Xr devd 8 ,
.Xr rcorder 8
.Sh HISTORY
diff --git a/usr.sbin/apmd/Makefile b/usr.sbin/apmd/Makefile
deleted file mode 100644
index 9e693c630308..000000000000
--- a/usr.sbin/apmd/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-CONFS= apmd.conf
-PROG= apmd
-MAN= apmd.8
-SRCS= apmd.c apmdlex.l apmdparse.y y.tab.h
-
-PACKAGE=apm
-
-WARNS?= 3
-
-CFLAGS+= -I${.CURDIR}
-
-test:
- ./apmd -d -f etc/apmd.conf -n
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/apmd/Makefile.depend b/usr.sbin/apmd/Makefile.depend
deleted file mode 100644
index c2fea3d32305..000000000000
--- a/usr.sbin/apmd/Makefile.depend
+++ /dev/null
@@ -1,16 +0,0 @@
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
- usr.bin/yacc.host \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/usr.sbin/apmd/README b/usr.sbin/apmd/README
deleted file mode 100644
index a8ceef164560..000000000000
--- a/usr.sbin/apmd/README
+++ /dev/null
@@ -1,211 +0,0 @@
-FreeBSD apmd Package Release Notes (19990711 version)
-
-1. What is "apmd"?
-==================
-
-The apmd package provides a means of handling various APM events from
-userland code. Using apmd.conf, the apmd(8) configuration file, you
-can select the APM events to be handled from userland and specify the
-commands for a given event, allowing APM behaviour to be configured
-flexibly.
-
-
-2. How to install the apmd package
-==================================
-
-2.1 Making the apmd control device file
----------------------------------------
-
-apmd(8) uses the new special device file /dev/apmctl. This should be
-created as follows:
-
-# cd /dev
-# mknod apmctl c 39 8
-
-2.2 Applying the kernel patch and building a new kernel
--------------------------------------------------------
-
-The next step is to apply the patch against the sys source tree.
-Go to the source directory (eg. /usr/src/ or /usr/PAO3/src/) and run
-the patch command as follows:
-
-# gzip -cd [somewhere]/apmd-sys-R320.diff | patch
-
-For PAO3 users, the patch file name would be apmd-sys-PAO3.diff
-instead of apmd-sys-R320.diff. After this step has completed
-successfully, build and install a new kernel and reboot your system.
-
-2.3 Making the apmd program
----------------------------
-
-Go to src/usr.sbin/ and extract the apmd tarball as follows:
-
-# tar xzpvf [somewhere]/apmd-usr.sbin.tar.gz
-
-Before doing a make all, you need to copy apm_bios.h in the sys source
-tree to /usr/include/machine/ first:
-
-# cp /sys/i386/include/apm_bios.h /usr/include/machine/
-
-Then do the build and install steps in the apmd directory:
-
-# cd src/usr.sbin/apmd
-# make depend all install
-
-2.4 Setting up the configuration file and userland script
----------------------------------------------------------
-
-In src/usr.sbin/apm/etc/ there are example configuration and userland
-script files which are invoked automatically when the APM BIOS informs
-apmd of an event, such as suspend request. Copy these files to
-/etc/ as follows:
-
-# cp src/usr.sbin/apm/etc/* /etc/
-
-
-3. Running the apmd daemon program
-==================================
-
-To run apmd(8) in background mode, simply type ``apmd''.
-
-# apmd
-
-To make a running apmd reload /etc/apmd.conf, send a SIGHUP signal to
-the apmd(8) process.
-
-# kill -HUP [apmd pid]
-or
-# killall -HUP apmd
-
-apmd has some command line options. For the details, please
-refer to the manpage of apmd.
-
-4. Configuration file
-=====================
-
-The structure of the apmd configuration file is quite simple. For
-example:
-
-apm_event SUSPENDREQ {
- exec "sync && sync && sync";
- exec "sleep 1";
- exec "zzz";
-}
-
-Will cause apmd to receive the APM event SUSPENDREQ (which may be
-posted by an LCD close), run the sync command 3 times and wait for a
-while, then execute zzz (apm -z) to put the system in the suspend
-state.
-
-4.1 The apm_event keyword
--------------------------
-`apm_event' is the keyword which indicates the start of configuration for
-each events.
-
-4.2 APM events
---------------
-
-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:
-
-o Events ignored by the kernel if apmd is running:
-
-STANDBYREQ
-SUSPENDREQ
-USERSUSPENDREQ
-BATTERYLOW
-
-o Events passed to apmd after kernel handling:
-
-NORMRESUME
-CRITRESUME
-STANDBYRESUME
-POWERSTATECHANGE
-UPDATETIME
-
-
-Other events will not be sent to apmd.
-
-4.3 command line syntax
------------------------
-
-In the example above, the three lines beginning with `exec' are commands
-for the event. Each line should be terminated with a semicolon. The
-command list for the event should be enclosed by `{' and `}'. apmd(8)
-uses /bin/sh for double-quotation enclosed command execution, just as
-with 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.
-apmd(8) will report any failed command's status code via syslog(3)
-and will then reject the request event posted by APM BIOS.
-
-4.4 Built-in functions
-----------------------
-
-You can also specify apmd 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:
-
-o reject;
-
- Reject last request posted by the 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.
-
-
-
-5. EXAMPLES
-===========
-
-Sample configuration commands include:
-
-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";
-#}
-
-
-6. Call for developers
-======================
-
-The initial version of apmd(8) was implemented primarily to test the
-kernel support code and was ALPHA quality. Based on that code, the
-current version was developed by KOIE Hidetaka <hide@koie.org>.
-However, we're still looking around for interesting new features and
-ideas, so if you have any thoughts, please let us know.
-Documentation is also sparse, and the manpage have just written.
-If you wish to collaborate on this work, please e-mail me:
-iwasaki@freebsd.org.
-
-
-June 1, 1999
-Created by: iwasaki@FreeBSD.org
-Edited by: jkh@FreeBSD.org
- nick@foobar.org
diff --git a/usr.sbin/apmd/apmd.8 b/usr.sbin/apmd/apmd.8
deleted file mode 100644
index 94640046bb74..000000000000
--- a/usr.sbin/apmd/apmd.8
+++ /dev/null
@@ -1,319 +0,0 @@
-.\" Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
-.\" Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.jp>
-.\" Copyright (c) 1999 Yoshihiko SARUMARU <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.
-.\"
-.Dd June 28, 1999
-.Dt APMD 8 i386
-.Os
-.Sh NAME
-.Nm apmd
-.Nd Advanced Power Management monitor daemon
-.Sh SYNOPSIS
-.Nm
-.Op Fl d
-.Op Fl f file
-.Op Fl s
-.Op Fl v
-.Sh DESCRIPTION
-The
-.Nm
-utility
-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
-The
-.Nm
-utility 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 s
-Causes
-.Nm
-to simulate a POWERSTATECHANGE event when a power state change is detected
-(AC_POWER_STATE) but the bios of the laptop does not report it.
-This enables you to do things like dimming the LCD backlight when you unplug
-the power cord.
-.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
-.Dv SIGHUP ,
-it will reread its configuration file and
-notify the APM device driver of any changes to its configuration.
-.Pp
-The
-.Nm
-utility 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
-utility 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:
-.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.
-.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 event.
-.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 beginning 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 } .
-The
-.Nm
-utility 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.
-The
-.Nm
-utility 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
-.Bl -tag -width ".It - reject"
-.It - reject
-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.
-.El
-.El
-.Ed
-.El
-.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 EXAMPLES
-Sample configuration commands include:
-.Bd -literal
-apm_event SUSPENDREQ {
- exec "/etc/rc.suspend apm suspend";
-}
-
-apm_event USERSUSPENDREQ {
- exec "sync && sync && sync";
- exec "sleep 1";
- exec "apm -z";
-}
-
-apm_event NORMRESUME {
- exec "/etc/rc.resume apm suspend";
-}
-
-apm_event STANDBYRESUME {
- exec "/etc/rc.resume apm standby";
-}
-
-# 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 SEE ALSO
-.Xr apm 4 ,
-.Xr apm 8
-.Sh HISTORY
-The
-.Nm
-utility appeared in
-.Fx 3.3 .
-.Sh AUTHORS
-.An Mitsuru IWASAKI Aq Mt iwasaki@FreeBSD.org
-.An KOIE Hidetaka Aq Mt koie@suri.co.jp
-.Pp
-.An -nosplit
-Some contributions made by
-.An Warner Losh Aq Mt imp@FreeBSD.org ,
-.An Hiroshi Yamashita Aq Mt bluemoon@msj.biglobe.ne.jp ,
-.An Yoshihiko SARUMARU Aq Mt mistral@imasy.or.jp ,
-.An Norihiro Kumagai Aq Mt kuma@nk.rim.or.jp ,
-.An NAKAGAWA Yoshihisa Aq Mt nakagawa@jp.FreeBSD.org ,
-and
-.An Nick Hilliard Aq Mt nick@foobar.org .
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
deleted file mode 100644
index 0a3fcf6315e0..000000000000
--- a/usr.sbin/apmd/apmd.c
+++ /dev/null
@@ -1,702 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * APM (Advanced Power Management) Event Dispatcher
- *
- * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
- * Copyright (c) 1999 KOIE Hidetaka <koie@suri.co.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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/types.h>
-#include <assert.h>
-#include <bitstring.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <machine/apm_bios.h>
-
-#include "apmd.h"
-
-int debug_level = 0;
-int verbose = 0;
-int soft_power_state_change = 0;
-const char *apmd_configfile = APMD_CONFIGFILE;
-const char *apmd_pidfile = APMD_PIDFILE;
-int apmctl_fd = -1, apmnorm_fd = -1;
-
-/*
- * table of event handlers
- */
-#define EVENT_CONFIG_INITIALIZER(EV,R) { #EV, NULL, R },
-struct event_config events[EVENT_MAX] = {
*** 1465 LINES SKIPPED ***