From 4c6ca653b393007ad33b83f64d3a75244f9690bd Mon Sep 17 00:00:00 2001 From: eugen Date: Mon, 26 Nov 2018 13:36:30 +0000 Subject: [PATCH] MFC r339818: rcorder(8): Add support for /etc/rc.resume, so it calls "rcorder -k resume" and runs scripts containing "KEYWORD: resume" with single "resume" argument. Working example is the port sysutils/cpupdate that defines extra_commands="resume" to reload CPU microcode cleared by suspend/resume sequence. This change does nothing for a system having no scripts with KEYWORD: resume. PR: 227866 Differential Revision: https://reviews.freebsd.org/D15247 git-svn-id: svn://svn.freebsd.org/base/stable/10@340967 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- etc/rc.resume | 18 ++++++++++++++++++ sbin/rcorder/rcorder.8 | 23 +++++++++++++++++++++-- share/man/man8/rc.8 | 3 ++- usr.sbin/acpi/acpiconf/acpiconf.8 | 30 ++++++++++++++++++++++++++---- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/etc/rc.resume b/etc/rc.resume index cce616155..55fd6ffec 100755 --- a/etc/rc.resume +++ b/etc/rc.resume @@ -55,4 +55,22 @@ fi /usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'` /bin/sync && /bin/sync && /bin/sync +. /etc/rc.subr + +load_rc_config + +rcorder_opts="-k resume" + +case ${local_startup} in +[Nn][Oo] | '') ;; +*) find_local_scripts_new ;; +esac + +files=`rcorder ${rcorder_opts} /etc/rc.d/* ${local_rc} 2>/dev/null` + +for _rc_elem in $files; do + debug "run_rc_script $_rc_elem resume" + run_rc_script $_rc_elem resume +done + exit 0 diff --git a/sbin/rcorder/rcorder.8 b/sbin/rcorder/rcorder.8 index 995ef684b..8c03a8e3e 100644 --- a/sbin/rcorder/rcorder.8 +++ b/sbin/rcorder/rcorder.8 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 5, 2011 +.Dd October 27, 2018 .Dt RCORDER 8 .Os .Sh NAME @@ -136,6 +136,23 @@ There must be at least one file with no dependencies in the set of arguments passed to .Nm in order for it to find a starting place in the dependency ordering. +.Sh KEYWORDS +There are several +.Em KEYWORDs +in use: +.Bl -tag -width ".Cm shutdown" -offset indent +.It Cm firstboot, nojail, nojailvnet, nostart +Used by +.Xr rc 8 . +.It Cm resume +Used by +.Nm /etc/rc.resume +(see +.Xr acpiconf 8 ) +.It Cm shutdown +Used by +.Xr rc.shutdown 8 . +.El .Sh DIAGNOSTICS The .Nm @@ -156,7 +173,9 @@ A set of files has a circular dependency which was detected while processing the stated file. .El .Sh SEE ALSO -.Xr rc 8 +.Xr acpiconf 8 , +.Xr rc 8 , +.Xr rc.shutdown 8 .Sh HISTORY The .Nm diff --git a/share/man/man8/rc.8 b/share/man/man8/rc.8 index d7dc771aa..470571542 100644 --- a/share/man/man8/rc.8 +++ b/share/man/man8/rc.8 @@ -48,6 +48,7 @@ .Nm rc.d/ .Nm rc.firewall .Nm rc.local +.Nm rc.resume .Nm rc.shutdown .Nm rc.subr .Sh DESCRIPTION @@ -557,7 +558,7 @@ is unnecessary, but is often included. .Xr kill 1 , .Xr rc.conf 5 , .Xr init 8 , -.Xr rcorder 8 , +.Xr rc.resume 8 , .Xr rc.subr 8 , .Xr reboot 8 , .Xr savecore 8 , diff --git a/usr.sbin/acpi/acpiconf/acpiconf.8 b/usr.sbin/acpi/acpiconf/acpiconf.8 index 3830827c0..87663dc1b 100644 --- a/usr.sbin/acpi/acpiconf/acpiconf.8 +++ b/usr.sbin/acpi/acpiconf/acpiconf.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2015 +.Dd October 27, 2018 .Dt ACPICONF 8 .Os .Sh NAME @@ -72,13 +72,35 @@ If the .Pa /etc/rc.suspend and .Pa /etc/rc.resume -scripts are executable, they will be run before and after entering -the given sleep state. +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 +.Pa /etc/rc.resume +script uses the +.Xr rcorder 8 +utility to call scripts in +.Pa /etc/rc.d/ +and the +.Va $local_startup +directories that have a "resume" KEYWORD. +Called scripts are supplied with single "resume" +command line argument. See +.Xr rc.conf 5 +for more information about +.Va $local_startup . .El .Sh SEE ALSO .Xr acpi 4 , .Xr acpidump 8 , -.Xr apm 8 +.Xr apm 8 , +.Xr apmd 8 , +.Xr devd 8 , +.Xr rc.conf 5 , +.Xr rcorder 8 .Sh HISTORY The .Nm -- 2.42.0