The present patch changes the rc.subr(8) manual page to match
the implementation.
The current manual page for rc.subr(8) says that $pexp is "A regular
expression to be passed to pgrep(1) in order to find the desired process
or to be passed to pkill(1) to stop it."
The file /etc/rc.d/rc.subr currently uses $pexp only as a fixed
expression, with the -xf flags.
> grep pexp /etc/rc.d/rc.subr
pexp=${pexp}
multicast nfs_server pexp pf pkg_scripts shlib_dirs spamd_black
pgrep -T "${daemon_rtable}" -q -xf "${pexp}"
pkill -HUP -T "${daemon_rtable}" -xf "${pexp}"
pkill -T "${daemon_rtable}" -xf "${pexp}"
# make sure pexp matches the process (i.e. doesn't include the quotes)
pexp="$(eval echo ${daemon}${daemon_flags:+ ${daemon_flags}})"
The -xf flags are explained in the pgrep(1) and pkill(1) man page.
-x Require an exact match of the process name, or argument
list if -f is given. The default is to match any substring.
The present patch replaces instances of "regular expression" with
"fixed expression".
I also think a better phrasing would be to explain in the rc.subr(8)
man page that $pexp is a substring of the process name with flags and
that it uses pgrep with -xf. I might eventually do that in a separate
patch.
Index: rc.subr.8
===================================================================
RCS file: /cvs/src/share/man/man8/rc.subr.8,v
retrieving revision 1.37
diff -u -p -r1.37 rc.subr.8
--- rc.subr.8 21 Feb 2020 00:47:21 -0000 1.37
+++ rc.subr.8 7 Aug 2020 00:46:34 -0000
@@ -184,7 +184,7 @@ call
.It Ic rc_check
Search for processes of the service with
.Xr pgrep 1
-using the regular expression given in the
+using the fixed expression given in the
.Va pexp
variable.
.It Ic rc_start
@@ -199,7 +199,7 @@ Send a
.Dv SIGTERM
signal using
.Xr pkill 1
-on the regular expression given in the
+on the fixed expression given in the
.Va pexp
variable.
.It Ic rc_reload
@@ -207,7 +207,7 @@ Send a
.Dv SIGHUP
signal using
.Xr pkill 1
-on the regular expression given in the
+on the fixed expression given in the
.Va pexp
variable.
One has to make sure that sending
@@ -267,7 +267,7 @@ functions.
User to run the daemon as, using
.Xr su 1 .
.It Va pexp
-A regular expression to be passed to
+A fixed expression to be passed to
.Xr pgrep 1
in order to find the desired process or to be passed to
.Xr pkill 1