Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147889616
D46313.1784695330.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D46313.1784695330.diff
View Options
diff --git a/usr.sbin/daemon/daemon.8.ORI b/usr.sbin/daemon/daemon.8
--- a/usr.sbin/daemon/daemon.8.ORI
+++ b/usr.sbin/daemon/daemon.8
@@ -35,6 +35,7 @@
.Op Fl cfHrS
.Op Fl p Ar child_pidfile
.Op Fl P Ar supervisor_pidfile
+.Op Fl x Ar command_pidfile
.Op Fl t Ar title
.Op Fl u Ar user
.Op Fl m Ar output_mask
@@ -156,6 +157,26 @@
locked and removes it after the process exits.
The
.Ar child_pidfile
+owner is the user who runs the
+.Nm
+regardless of whether the
+.Fl -user
+option is used or not.
+.It Fl x , Fl -command-pidfile Ar command_pidfile
+Write the ID of the executed command into the
+.Ar command_pidfile
+using the
+.Xr pidfile 3
+functionality.
+This is similar to the
+.Fl -child-pidfile
+option but without its
+supervisor functionality and, since the
+.Nm
+exits immediately after having executed the child, without any
+locks being held on the pidfile.
+The
+.Ar command_pidfile
owner is the user who runs the
.Nm
regardless of whether the
diff --git a/usr.sbin/daemon/daemon.c.ORI b/usr.sbin/daemon/daemon.c
--- a/usr.sbin/daemon/daemon.c.ORI
+++ b/usr.sbin/daemon/daemon.c
@@ -118,7 +118,7 @@
static int pidfile_truncate(struct pidfh *);
-static const char shortopts[] = "+cfHSp:P:ru:o:s:l:t:m:R:T:C:h";
+static const char shortopts[] = "+cfHSp:P:ru:o:s:l:t:m:R:T:C:x:h";
static const struct option longopts[] = {
{ "change-dir", no_argument, NULL, 'c' },
@@ -129,6 +129,7 @@
{ "output-mask", required_argument, NULL, 'm' },
{ "child-pidfile", required_argument, NULL, 'p' },
{ "supervisor-pidfile", required_argument, NULL, 'P' },
+ { "command-pidfile", required_argument, NULL, 'x' },
{ "restart", no_argument, NULL, 'r' },
{ "restart-count", required_argument, NULL, 'C' },
{ "restart-delay", required_argument, NULL, 'R' },
@@ -146,7 +147,7 @@
{
(void)fprintf(stderr,
"usage: daemon [-cfHrS] [-p child_pidfile] [-P supervisor_pidfile]\n"
- " [-u user] [-o output_file] [-t title]\n"
+ " [-x command_pidfile ] [-u user] [-o output_file] [-t title]\n"
" [-l syslog_facility] [-s syslog_priority]\n"
" [-T syslog_tag] [-m output_mask] [-R restart_delay_secs]\n"
" [-C restart_count]\n"
@@ -162,6 +163,7 @@
" 1=stdout, 2=stderr, 3=both\n"
" --child-pidfile -p <file> Write PID of the child process to file\n"
" --supervisor-pidfile -P <file> Write PID of the supervisor process to file\n"
+ " --command-pidfile -x <file> Write PID of the executed command to file\n"
" --restart -r Restart child if it terminates (1 sec delay)\n"
" --restart-count -C <N> Restart child at most N times, then exit\n"
" --restart-delay -R <N> Restart child if it terminates after N sec\n"
@@ -190,6 +192,8 @@
/*
* Supervision mode is enabled if one of the following options are used:
+ * --syslog-facility -l
+ * --output-file -o
* --child-pidfile -p
* --supervisor-pidfile -P
* --restart -r / --restart-delay -R
@@ -292,6 +296,9 @@
break;
case 'u':
state.user = optarg;
+ break;
+ case 'x':
+ state.child_pidfile = optarg;
break;
case 'h':
usage(0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 22, 4:42 AM (1 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29224657
Default Alt Text
D46313.1784695330.diff (3 KB)
Attached To
Mode
D46313: daemon(8): Add option to write pidfile w/o supervising it
Attached
Detach File
Event Timeline
Log In to Comment