crux-patch.diff: adjust for latest sync
This commit is contained in:
parent
5c9e654aa5
commit
bf12d4ef67
@ -1,21 +1,55 @@
|
||||
diff --git a/start-stop-daemon.8 b/start-stop-daemon.8
|
||||
index de2d35c..c370bbe 100644
|
||||
index 4723596..5b880af 100644
|
||||
--- a/start-stop-daemon.8
|
||||
+++ b/start-stop-daemon.8
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
.
|
||||
-.TH start\-stop\-daemon 8 "2017-07-04" "Debian Project" "dpkg suite"
|
||||
+.TH start\-stop\-daemon 8 "2018-08-11" "CRUX 3.4" "core services"
|
||||
-.TH start\-stop\-daemon 8 "%RELEASE_DATE%" "%VERSION%" "dpkg suite"
|
||||
+.TH start\-stop\-daemon 8 "2019-01-22" "CRUX 3.5" "dpkg suite"
|
||||
.nh
|
||||
.SH NAME
|
||||
start\-stop\-daemon \- start and stop system daemon programs
|
||||
@@ -266,33 +266,6 @@ reason. This is a last resort, and is only meant for programs that either
|
||||
make no sense forking on their own, or where it's not feasible to add the
|
||||
code for them to do this themselves.
|
||||
.TP
|
||||
-.BR \-\-notify\-await
|
||||
-Wait for the background process to send a readiness notification before
|
||||
-considering the service started (since version 1.19.3).
|
||||
-This implements parts of the systemd readiness procotol, as specified
|
||||
-in the \fBsd_notify\fP(3) man page.
|
||||
-The following variables are supported:
|
||||
-.RS
|
||||
-.TP
|
||||
-.B READY=1
|
||||
-The program is ready to give service, so we can exit safely.
|
||||
-.TP
|
||||
-.BI EXTEND_TIMEOUT_USEC= number
|
||||
-The program requests to extend the timeout by \fInumber\fP microseconds.
|
||||
-This will reset the current timeout to the specified value.
|
||||
-.TP
|
||||
-.BI ERRNO= number
|
||||
-The program is exiting with an error.
|
||||
-Do the same and print the user-friendly string for the \fBerrno\fP value.
|
||||
-.RE
|
||||
-.
|
||||
-.TP
|
||||
-.BI \-\-notify\-timeout timeout
|
||||
-Set a timeout for the \fB\-\-notify\-await\fP option (since version 1.19.3).
|
||||
-When the timeout is reached, \fBstart\-stop\-daemon\fP will exit with an
|
||||
-error code, and no readiness notification will be awaited.
|
||||
-The default is \fB60\fP seconds.
|
||||
-.TP
|
||||
.BR \-C ", " \-\-no\-close
|
||||
Do not close any file descriptor when forcing the daemon into the background
|
||||
(since version 1.16.5).
|
||||
diff --git a/start-stop-daemon.c b/start-stop-daemon.c
|
||||
index e972042..35b79ee 100644
|
||||
index e7e1cdc..9f30377 100644
|
||||
--- a/start-stop-daemon.c
|
||||
+++ b/start-stop-daemon.c
|
||||
@@ -20,10 +20,34 @@
|
||||
@@ -20,10 +20,36 @@
|
||||
* Changes by Ian Jackson: added --retry (and associated rearrangements).
|
||||
*/
|
||||
|
||||
@ -25,8 +59,10 @@ index e972042..35b79ee 100644
|
||||
|
||||
#include <dpkg/macros.h>
|
||||
+#else
|
||||
+# define VERSION "20180811"
|
||||
+# define CRUX "CRUX 3.4"
|
||||
+# define VERSION "20190122"
|
||||
+# define CRUX "CRUX-Linux"
|
||||
+
|
||||
+# define WANT_SYSTEMD_NOTIFY 0 /* 1=yes */
|
||||
+
|
||||
+# define HAVE_SYS_PARAM_H
|
||||
+# define HAVE_SYS_SYSCALL_H
|
||||
@ -50,7 +86,7 @@ index e972042..35b79ee 100644
|
||||
|
||||
#if defined(__linux__)
|
||||
# define OS_Linux
|
||||
@@ -158,6 +182,10 @@
|
||||
@@ -160,6 +186,10 @@
|
||||
#define HAVE_IOPRIO_SET
|
||||
#endif
|
||||
|
||||
@ -61,7 +97,20 @@ index e972042..35b79ee 100644
|
||||
#define IOPRIO_CLASS_SHIFT 13
|
||||
#define IOPRIO_PRIO_VALUE(class, prio) (((class) << IOPRIO_CLASS_SHIFT) | (prio))
|
||||
#define IO_SCHED_PRIO_MIN 0
|
||||
@@ -345,8 +373,7 @@ xstrndup(const char *str, size_t n)
|
||||
@@ -212,10 +242,12 @@ static int quietmode = 0;
|
||||
static int exitnodo = 1;
|
||||
static bool background = false;
|
||||
static bool close_io = true;
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
static bool notify_await = false;
|
||||
static int notify_timeout = 60;
|
||||
static char *notify_sockdir;
|
||||
static char *notify_socket;
|
||||
+#endif
|
||||
static bool mpidfile = false;
|
||||
static bool rpidfile = false;
|
||||
static int signal_nr = SIGTERM;
|
||||
@@ -388,8 +420,7 @@ xstrndup(const char *str, size_t n)
|
||||
static void
|
||||
timespec_gettime(struct timespec *ts)
|
||||
{
|
||||
@ -71,7 +120,71 @@ index e972042..35b79ee 100644
|
||||
if (clock_gettime(CLOCK_MONOTONIC, ts) < 0)
|
||||
fatal("clock_gettime failed");
|
||||
#else
|
||||
@@ -664,9 +691,9 @@ usage(void)
|
||||
@@ -531,6 +562,7 @@ wait_for_child(pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
static void
|
||||
cleanup_socket_dir(void)
|
||||
{
|
||||
@@ -711,6 +743,7 @@ wait_for_notify(int fd)
|
||||
}
|
||||
}
|
||||
}
|
||||
+#endif /* WANT_SYSTEMD_NOTIFY */
|
||||
|
||||
static void
|
||||
write_pidfile(const char *filename, pid_t pid)
|
||||
@@ -743,7 +776,9 @@ remove_pidfile(const char *filename)
|
||||
static void
|
||||
daemonize(void)
|
||||
{
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
int notify_fd = -1;
|
||||
+#endif
|
||||
pid_t pid;
|
||||
sigset_t mask;
|
||||
sigset_t oldmask;
|
||||
@@ -757,8 +792,10 @@ daemonize(void)
|
||||
if (sigprocmask(SIG_BLOCK, &mask, &oldmask) == -1)
|
||||
fatal("cannot block SIGCHLD");
|
||||
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
if (notify_await)
|
||||
notify_fd = create_notify_socket();
|
||||
+#endif
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
@@ -769,6 +806,7 @@ daemonize(void)
|
||||
* not suffer from race conditions on return. */
|
||||
wait_for_child(pid);
|
||||
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
if (notify_await) {
|
||||
/* Wait for a readiness notification from the second
|
||||
* child, so that we can safely exit when the service
|
||||
@@ -777,6 +815,7 @@ daemonize(void)
|
||||
close(notify_fd);
|
||||
cleanup_socket_dir();
|
||||
}
|
||||
+#endif
|
||||
|
||||
_exit(0);
|
||||
}
|
||||
@@ -875,8 +914,10 @@ usage(void)
|
||||
" scheduler (default prio is 4)\n"
|
||||
" -k, --umask <mask> change the umask to <mask> before starting\n"
|
||||
" -b, --background force the process to detach\n"
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
" --notify-await wait for a readiness notification\n"
|
||||
" --notify-timeout <int> timeout after <int> seconds of notify wait\n"
|
||||
+#endif
|
||||
" -C, --no-close do not close any file descriptor\n"
|
||||
" -m, --make-pidfile create the pidfile before starting\n"
|
||||
" --remove-pidfile delete the pidfile after stopping\n"
|
||||
@@ -921,9 +962,9 @@ usage(void)
|
||||
static void
|
||||
do_version(void)
|
||||
{
|
||||
@ -84,3 +197,51 @@ index e972042..35b79ee 100644
|
||||
}
|
||||
|
||||
static void DPKG_ATTR_NORET
|
||||
@@ -1248,8 +1289,10 @@ parse_options(int argc, char * const *argv)
|
||||
{ "iosched", 1, NULL, 'I'},
|
||||
{ "umask", 1, NULL, 'k'},
|
||||
{ "background", 0, NULL, 'b'},
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
{ "notify-await", 0, NULL, OPT_NOTIFY_AWAIT},
|
||||
{ "notify-timeout", 1, NULL, OPT_NOTIFY_TIMEOUT},
|
||||
+#endif
|
||||
{ "no-close", 0, NULL, 'C'},
|
||||
{ "make-pidfile", 0, NULL, 'm'},
|
||||
{ "remove-pidfile", 0, NULL, OPT_RM_PIDFILE},
|
||||
@@ -1264,7 +1307,9 @@ parse_options(int argc, char * const *argv)
|
||||
const char *schedule_str = NULL;
|
||||
const char *proc_schedule_str = NULL;
|
||||
const char *io_schedule_str = NULL;
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
const char *notify_timeout_str = NULL;
|
||||
+#endif
|
||||
size_t changeuser_len;
|
||||
int c;
|
||||
|
||||
@@ -1364,12 +1409,14 @@ parse_options(int argc, char * const *argv)
|
||||
case 'b': /* --background */
|
||||
background = true;
|
||||
break;
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
case OPT_NOTIFY_AWAIT:
|
||||
notify_await = true;
|
||||
break;
|
||||
case OPT_NOTIFY_TIMEOUT:
|
||||
notify_timeout_str = optarg;
|
||||
break;
|
||||
+#endif
|
||||
case 'C': /* --no-close */
|
||||
close_io = false;
|
||||
break;
|
||||
@@ -1422,9 +1469,11 @@ parse_options(int argc, char * const *argv)
|
||||
badusage("umask value must be a positive number");
|
||||
}
|
||||
|
||||
+#if WANT_SYSTEMD_NOTIFY
|
||||
if (notify_timeout_str != NULL)
|
||||
if (parse_unsigned(notify_timeout_str, 10, ¬ify_timeout) != 0)
|
||||
badusage("invalid notify timeout value");
|
||||
+#endif
|
||||
|
||||
if (action == ACTION_NONE)
|
||||
badusage("need one of --start or --stop or --status");
|
||||
|
Loading…
x
Reference in New Issue
Block a user