From c653e22cc238da34087b16d1d97bfd463b1f52e4 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 14 Jun 2018 19:57:46 +0000 Subject: [PATCH] start-stop-daemon: updated to 20170812 --- start-stop-daemon/.md5sum | 6 +- start-stop-daemon/Pkgfile | 9 +- start-stop-daemon/crux-patch.diff | 24 +- start-stop-daemon/start-stop-daemon.8 | 3 +- start-stop-daemon/start-stop-daemon.c | 570 ++++++++++++++++++++------ 5 files changed, 455 insertions(+), 157 deletions(-) diff --git a/start-stop-daemon/.md5sum b/start-stop-daemon/.md5sum index 76fcb21..c5de7f2 100644 --- a/start-stop-daemon/.md5sum +++ b/start-stop-daemon/.md5sum @@ -1,4 +1,4 @@ -d69ea09c844389f3e4d0cda696d0d968 crux-patch.diff +1e05f0bfc53cb9b18eb3bed57ecc489a crux-patch.diff 707efd334e4ba1d5f65f366a3c03c794 makefile -c021c418059b2afcb2f501927239beca start-stop-daemon.8 -61ba9ca1003221e1af632714c1cfbd11 start-stop-daemon.c +b270e8a21cb232fb64d65f94e40c8736 start-stop-daemon.8 +ec4856efaaad656a8975e19c63d65c20 start-stop-daemon.c diff --git a/start-stop-daemon/Pkgfile b/start-stop-daemon/Pkgfile index 311d22d..a82fb8d 100644 --- a/start-stop-daemon/Pkgfile +++ b/start-stop-daemon/Pkgfile @@ -1,17 +1,16 @@ # Description: Control the creation and termination of system-level processes -# URL: http://man7.org/linux/man-pages/man8/start-stop-daemon.8.html -# Maintainer: CRUX System Team, core-ports at crux dot nu -# Arch Maintainer: CRUX-ARM System Team, devel at crux-arm dot nu +# URL: http://man7.org/linux/man-pages/man8/start-stop-daemon.8.html +# Maintainer: CRUX System Team, core-ports at crux dot nu name=start-stop-daemon -version=20150921 +version=20170812 release=1 source=(start-stop-daemon.c start-stop-daemon.8 crux-patch.diff makefile) build () { patch -p2 -i crux-patch.diff - make CC="$CC" + make install -d $PKG/{sbin,usr/share/man/man8} install -m 755 $name $PKG/sbin/ diff --git a/start-stop-daemon/crux-patch.diff b/start-stop-daemon/crux-patch.diff index 7c0498b..fd59b04 100644 --- a/start-stop-daemon/crux-patch.diff +++ b/start-stop-daemon/crux-patch.diff @@ -1,18 +1,18 @@ diff --git a/start-stop-daemon/start-stop-daemon.8 b/start-stop-daemon/start-stop-daemon.8 -index deae6c6..28d2de8 100644 +index de2d35c3..de666e65 100644 --- a/start-stop-daemon/start-stop-daemon.8 +++ b/start-stop-daemon/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 . . --.TH start\-stop\-daemon 8 "2014-03-26" "Debian Project" "dpkg utilities" -+.TH start\-stop\-daemon 8 "2015-09-21" "CRUX 3.2" "core services" +-.TH start\-stop\-daemon 8 "2017-07-04" "Debian Project" "dpkg suite" ++.TH start\-stop\-daemon 8 "2017-08-12" "CRUX 3.3" "core services" + .nh .SH NAME start\-stop\-daemon \- start and stop system daemon programs - . diff --git a/start-stop-daemon/start-stop-daemon.c b/start-stop-daemon/start-stop-daemon.c -index c844f2e..67cd043 100644 +index 81357504..f586fd91 100644 --- a/start-stop-daemon/start-stop-daemon.c +++ b/start-stop-daemon/start-stop-daemon.c @@ -20,10 +20,34 @@ @@ -25,8 +25,8 @@ index c844f2e..67cd043 100644 #include +#else -+# define VERSION "20150921" -+# define CRUX "CRUX 3.2" ++# define VERSION "20170812" ++# define CRUX "CRUX 3.3" + +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSCALL_H @@ -48,9 +48,9 @@ index c844f2e..67cd043 100644 +# include +#endif - #if defined(linux) - # define OSLinux -@@ -142,6 +166,10 @@ + #if defined(__linux__) + # define OS_Linux +@@ -159,6 +183,10 @@ #define HAVE_IOPRIO_SET #endif @@ -61,7 +61,7 @@ index c844f2e..67cd043 100644 #define IOPRIO_CLASS_SHIFT 13 #define IOPRIO_PRIO_VALUE(class, prio) (((class) << IOPRIO_CLASS_SHIFT) | (prio)) #define IO_SCHED_PRIO_MIN 0 -@@ -310,8 +338,7 @@ xstrndup(const char *str, size_t n) +@@ -327,8 +355,7 @@ xstrndup(const char *str, size_t n) static void timespec_gettime(struct timespec *ts) { @@ -71,7 +71,7 @@ index c844f2e..67cd043 100644 if (clock_gettime(CLOCK_MONOTONIC, ts) < 0) fatal("clock_gettime failed"); #else -@@ -615,9 +642,9 @@ usage(void) +@@ -646,9 +673,9 @@ usage(void) static void do_version(void) { diff --git a/start-stop-daemon/start-stop-daemon.8 b/start-stop-daemon/start-stop-daemon.8 index deae6c6..de2d35c 100644 --- a/start-stop-daemon/start-stop-daemon.8 +++ b/start-stop-daemon/start-stop-daemon.8 @@ -20,7 +20,8 @@ .\" You should have received a copy of the GNU General Public License .\" along with this program. If not, see . . -.TH start\-stop\-daemon 8 "2014-03-26" "Debian Project" "dpkg utilities" +.TH start\-stop\-daemon 8 "2017-07-04" "Debian Project" "dpkg suite" +.nh .SH NAME start\-stop\-daemon \- start and stop system daemon programs . diff --git a/start-stop-daemon/start-stop-daemon.c b/start-stop-daemon/start-stop-daemon.c index c844f2e..8135750 100644 --- a/start-stop-daemon/start-stop-daemon.c +++ b/start-stop-daemon/start-stop-daemon.c @@ -25,26 +25,33 @@ #include -#if defined(linux) -# define OSLinux +#if defined(__linux__) +# define OS_Linux #elif defined(__GNU__) -# define OSHurd -#elif defined(__sun) -# define OSsunos -#elif defined(OPENBSD) || defined(__OpenBSD__) -# define OSOpenBSD -#elif defined(hpux) -# define OShpux +# define OS_Hurd #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# define OSFreeBSD +# define OS_FreeBSD #elif defined(__NetBSD__) -# define OSNetBSD +# define OS_NetBSD +#elif defined(__OpenBSD__) +# define OS_OpenBSD #elif defined(__DragonFly__) -# define OSDragonFlyBSD +# define OS_DragonFlyBSD +#elif defined(__APPLE__) && defined(__MACH__) +# define OS_Darwin +#elif defined(__sun) +# define OS_Solaris +#elif defined(_AIX) +# define OS_AIX +#elif defined(__hpux) +# define OS_HPUX #else # error Unknown architecture - cannot build start-stop-daemon #endif +/* NetBSD needs this to expose struct proc. */ +#define _KMEMUSER 1 + #ifdef HAVE_SYS_PARAM_H #include #endif @@ -54,6 +61,9 @@ #ifdef HAVE_SYS_SYSCTL_H #include #endif +#ifdef HAVE_SYS_PROCFS_H +#include +#endif #ifdef HAVE_SYS_PROC_H #include #endif @@ -98,21 +108,25 @@ #include #endif -#if defined(OSHurd) +#if defined(OS_Hurd) #include #include #endif +#if defined(OS_Darwin) +#include +#endif + #ifdef HAVE_KVM_H #include -#if defined(OSFreeBSD) +#if defined(OS_FreeBSD) #define KVM_MEMFILE "/dev/null" #else #define KVM_MEMFILE NULL #endif #endif -#ifdef _POSIX_PRIORITY_SCHEDULING +#if defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0 #include #else #define SCHED_OTHER -1 @@ -120,20 +134,23 @@ #define SCHED_RR -1 #endif -#if defined(OSLinux) +#if defined(OS_Linux) /* This comes from TASK_COMM_LEN defined in Linux' include/linux/sched.h. */ #define PROCESS_NAME_SIZE 15 -#elif defined(OSsunos) +#elif defined(OS_Solaris) #define PROCESS_NAME_SIZE 15 -#elif defined(OSDarwin) +#elif defined(OS_Darwin) #define PROCESS_NAME_SIZE 16 -#elif defined(OSNetBSD) +#elif defined(OS_AIX) +/* This comes from PRFNSZ defined in AIX's . */ #define PROCESS_NAME_SIZE 16 -#elif defined(OSOpenBSD) +#elif defined(OS_NetBSD) #define PROCESS_NAME_SIZE 16 -#elif defined(OSFreeBSD) +#elif defined(OS_OpenBSD) +#define PROCESS_NAME_SIZE 16 +#elif defined(OS_FreeBSD) #define PROCESS_NAME_SIZE 19 -#elif defined(OSDragonFlyBSD) +#elif defined(OS_DragonFlyBSD) /* On DragonFlyBSD MAXCOMLEN expands to 16. */ #define PROCESS_NAME_SIZE MAXCOMLEN #endif @@ -200,13 +217,13 @@ static char *startas = NULL; static pid_t match_pid = -1; static pid_t match_ppid = -1; static const char *pidfile = NULL; -static char what_stop[1024]; +static char *what_stop = NULL; static const char *progname = ""; static int nicelevel = 0; static int umask_value = -1; static struct stat exec_stat; -#if defined(OSHurd) +#if defined(OS_Hurd) static struct proc_stat_list *procset = NULL; #endif @@ -420,10 +437,10 @@ wait_for_child(pid_t pid) fatal("error waiting for child"); if (WIFEXITED(status)) { - int err = WEXITSTATUS(status); + int ret = WEXITSTATUS(status); - if (err != 0) - fatal("child returned error exit status %d", err); + if (ret != 0) + fatal("child returned error exit status %d", ret); } else if (WIFSIGNALED(status)) { int signo = WTERMSIG(status); @@ -545,61 +562,75 @@ static void usage(void) { printf( -"Usage: start-stop-daemon [