DistroBaker 190a06
From 52afb3a8d31871d28b1c39573a7ed5196c2d5023 Mon Sep 17 00:00:00 2001
DistroBaker 190a06
From: Craig Small <csmall@dropbear.xyz>
DistroBaker 190a06
Date: Mon, 15 Feb 2021 21:10:06 +1100
DistroBaker 190a06
Subject: [PATCH] pidwait: Rename from pwait
DistroBaker 190a06
DistroBaker 190a06
pwait is already in at least Debian in a different package
DistroBaker 190a06
DistroBaker 190a06
References:
DistroBaker 190a06
 https://bugs.debian.org/982391
DistroBaker 190a06
---
DistroBaker 190a06
diff --git a/Makefile.am b/Makefile.am
DistroBaker 190a06
index e037e4c..de15e13 100644
DistroBaker 190a06
--- a/Makefile.am
DistroBaker 190a06
+++ b/Makefile.am
DistroBaker 190a06
@@ -49,8 +49,8 @@ bin_PROGRAMS = \
DistroBaker 190a06
 	uptime \
DistroBaker 190a06
 	vmstat \
DistroBaker 190a06
 	w
DistroBaker 190a06
-if BUILD_PWAIT
DistroBaker 190a06
-bin_PROGRAMS += pwait
DistroBaker 190a06
+if BUILD_PIDWAIT
DistroBaker 190a06
+bin_PROGRAMS += pidwait
DistroBaker 190a06
 endif
DistroBaker 190a06
 else
DistroBaker 190a06
 usrbin_exec_PROGRAMS += \
DistroBaker 190a06
@@ -85,8 +85,8 @@ dist_man_MANS += \
DistroBaker 190a06
 	sysctl.conf.5 \
DistroBaker 190a06
 	ps/ps.1
DistroBaker 190a06
 
DistroBaker 190a06
-if BUILD_PWAIT
DistroBaker 190a06
-dist_man_MANS += pwait.1
DistroBaker 190a06
+if BUILD_PIDWAIT
DistroBaker 190a06
+dist_man_MANS += pidwait.1
DistroBaker 190a06
 endif
DistroBaker 190a06
 endif
DistroBaker 190a06
 
DistroBaker 190a06
@@ -199,8 +199,8 @@ free_SOURCES = free.c lib/strutils.c lib/fileutils.c
DistroBaker 190a06
 pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
DistroBaker 190a06
 pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
DistroBaker 190a06
 pmap_SOURCES = pmap.c lib/fileutils.c
DistroBaker 190a06
-if BUILD_PWAIT
DistroBaker 190a06
-pwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
DistroBaker 190a06
+if BUILD_PIDWAIT
DistroBaker 190a06
+pidwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
DistroBaker 190a06
 endif
DistroBaker 190a06
 if !CYGWIN
DistroBaker 190a06
 pwdx_SOURCES = pwdx.c lib/fileutils.c
DistroBaker 190a06
diff --git a/NEWS b/NEWS
DistroBaker 190a06
index da63c9c..5fe6761 100644
DistroBaker 190a06
--- a/NEWS
DistroBaker 190a06
+++ b/NEWS
DistroBaker 190a06
@@ -1,3 +1,7 @@
DistroBaker 190a06
+procps-ng-NEXT
DistroBaker 190a06
+---------------
DistroBaker 190a06
+  * Rename pwait to pidwait
DistroBaker 190a06
+
DistroBaker 190a06
 procps-ng-3.3.17
DistroBaker 190a06
 ---------------
DistroBaker 190a06
   * library: Incremented to 8:3:0
DistroBaker 190a06
diff --git a/configure.ac b/configure.ac
DistroBaker 190a06
index 56a8669..750c0fb 100644
DistroBaker 190a06
--- a/configure.ac
DistroBaker 190a06
+++ b/configure.ac
DistroBaker 190a06
@@ -132,20 +132,20 @@ AC_TRY_COMPILE([#include <errno.h>],
DistroBaker 190a06
 		AC_MSG_RESULT(yes),
DistroBaker 190a06
 		AC_MSG_RESULT(no))
DistroBaker 190a06
 
DistroBaker 190a06
-AC_CHECK_FUNC([pidfd_open], [enable_pwait=yes], [
DistroBaker 190a06
+AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [
DistroBaker 190a06
   AC_MSG_CHECKING([for __NR_pidfd_open])
DistroBaker 190a06
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
DistroBaker 190a06
 #include <sys/syscall.h>
DistroBaker 190a06
 #ifndef __NR_pidfd_open
DistroBaker 190a06
 #error __NR_pidfd_open not defined
DistroBaker 190a06
 #endif
DistroBaker 190a06
-    ])], [enable_pwait=yes], [enable_pwait=no])
DistroBaker 190a06
-  AC_MSG_RESULT([$enable_pwait])
DistroBaker 190a06
+    ])], [enable_pidwait=yes], [enable_pidwait=no])
DistroBaker 190a06
+  AC_MSG_RESULT([$enable_pidwait])
DistroBaker 190a06
 ])
DistroBaker 190a06
-if test "$enable_pwait" = yes; then
DistroBaker 190a06
-  AC_DEFINE([ENABLE_PWAIT], [1], [Enable pwait])
DistroBaker 190a06
+if test "$enable_pidwait" = yes; then
DistroBaker 190a06
+  AC_DEFINE([ENABLE_PIDWAIT], [1], [Enable pidwait])
DistroBaker 190a06
 fi
DistroBaker 190a06
-AM_CONDITIONAL([BUILD_PWAIT], [test x$enable_pwait = xyes])
DistroBaker 190a06
+AM_CONDITIONAL([BUILD_PIDWAIT], [test x$enable_pidwait = xyes])
DistroBaker 190a06
 
DistroBaker 190a06
 dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
DistroBaker 190a06
 AC_SUBST([WITH_WATCH8BIT])
DistroBaker 190a06
diff --git a/pgrep.1 b/pgrep.1
DistroBaker 190a06
index 4f8907b..af6dcd5 100644
DistroBaker 190a06
--- a/pgrep.1
DistroBaker 190a06
+++ b/pgrep.1
DistroBaker 190a06
@@ -9,7 +9,7 @@
DistroBaker 190a06
 .\"
DistroBaker 190a06
 .TH PGREP "1" "2020-06-04" "procps-ng" "User Commands"
DistroBaker 190a06
 .SH NAME
DistroBaker 190a06
-pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and other attributes
DistroBaker 190a06
+pgrep, pkill, pidwait \- look up, signal, or wait for processes based on name and other attributes
DistroBaker 190a06
 .SH SYNOPSIS
DistroBaker 190a06
 .B pgrep
DistroBaker 190a06
 [options] pattern
DistroBaker 190a06
@@ -17,7 +17,7 @@ pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and
DistroBaker 190a06
 .B pkill
DistroBaker 190a06
 [options] pattern
DistroBaker 190a06
 .br
DistroBaker 190a06
-.B pwait
DistroBaker 190a06
+.B pidwait
DistroBaker 190a06
 [options] pattern
DistroBaker 190a06
 .SH DESCRIPTION
DistroBaker 190a06
 .B pgrep
DistroBaker 190a06
@@ -45,7 +45,7 @@ will send the specified signal (by default
DistroBaker 190a06
 .BR SIGTERM )
DistroBaker 190a06
 to each process instead of listing them on stdout.
DistroBaker 190a06
 .PP
DistroBaker 190a06
-.B pwait
DistroBaker 190a06
+.B pidwait
DistroBaker 190a06
 will wait for each process instead of listing them on stdout.
DistroBaker 190a06
 .SH OPTIONS
DistroBaker 190a06
 .TP
DistroBaker 190a06
@@ -60,7 +60,7 @@ only.)
DistroBaker 190a06
 \fB\-c\fR, \fB\-\-count\fR
DistroBaker 190a06
 Suppress normal output; instead print a count of matching processes.  When
DistroBaker 190a06
 count does not match anything, e.g. returns zero, the command will return
DistroBaker 190a06
-non-zero value. Note that for pkill and pwait, the count is the number of
DistroBaker 190a06
+non-zero value. Note that for pkill and pidwait, the count is the number of
DistroBaker 190a06
 matching processes, not the processes that were successfully signaled or waited
DistroBaker 190a06
 for.
DistroBaker 190a06
 .TP
DistroBaker 190a06
@@ -88,7 +88,7 @@ translated into
DistroBaker 190a06
 .BR pgrep 's,
DistroBaker 190a06
 .BR pkill 's,
DistroBaker 190a06
 or
DistroBaker 190a06
-.BR pwait 's
DistroBaker 190a06
+.BR pidwait 's
DistroBaker 190a06
 own process group.
DistroBaker 190a06
 .TP
DistroBaker 190a06
 \fB\-G\fR, \fB\-\-group\fR \fIgid\fP,...
DistroBaker 190a06
@@ -126,7 +126,7 @@ is translated into
DistroBaker 190a06
 .BR pgrep 's,
DistroBaker 190a06
 .BR pkill 's,
DistroBaker 190a06
 or
DistroBaker 190a06
-.BR pwait 's
DistroBaker 190a06
+.BR pidwait 's
DistroBaker 190a06
 own session ID.
DistroBaker 190a06
 .TP
DistroBaker 190a06
 \fB\-t\fR, \fB\-\-terminal\fR \fIterm\fP,...
DistroBaker 190a06
@@ -145,7 +145,7 @@ symbolical value may be used.
DistroBaker 190a06
 Negates the matching.  This option is usually used in
DistroBaker 190a06
 .BR pgrep 's
DistroBaker 190a06
 or
DistroBaker 190a06
-.BR pwait 's
DistroBaker 190a06
+.BR pidwait 's
DistroBaker 190a06
 context.  In
DistroBaker 190a06
 .BR pkill 's
DistroBaker 190a06
 context the short option is disabled to avoid accidental usage of the option.
DistroBaker 190a06
@@ -154,7 +154,7 @@ context the short option is disabled to avoid accidental usage of the option.
DistroBaker 190a06
 Shows all thread ids instead of pids in
DistroBaker 190a06
 .BR pgrep 's
DistroBaker 190a06
 or
DistroBaker 190a06
-.BR pwait 's
DistroBaker 190a06
+.BR pidwait 's
DistroBaker 190a06
 context.  In
DistroBaker 190a06
 .BR pkill 's
DistroBaker 190a06
 context this option is disabled.
DistroBaker 190a06
@@ -167,7 +167,7 @@ match the
DistroBaker 190a06
 .TP
DistroBaker 190a06
 \fB\-F\fR, \fB\-\-pidfile\fR \fIfile\fR
DistroBaker 190a06
 Read \fIPID\fRs from \fIfile\fR.  This option is more useful for
DistroBaker 190a06
-.BR pkill or pwait
DistroBaker 190a06
+.BR pkill or pidwait
DistroBaker 190a06
 than
DistroBaker 190a06
 .BR pgrep .
DistroBaker 190a06
 .TP
DistroBaker 190a06
@@ -237,7 +237,7 @@ $ renice +4 $(pgrep chrome)
DistroBaker 190a06
 .PD 0
DistroBaker 190a06
 .TP
DistroBaker 190a06
 0
DistroBaker 190a06
-One or more processes matched the criteria. For pkill and pwait, one or more
DistroBaker 190a06
+One or more processes matched the criteria. For pkill and pidwait, one or more
DistroBaker 190a06
 processes must also have been successfully signalled or waited for.
DistroBaker 190a06
 .TP
DistroBaker 190a06
 1
DistroBaker 190a06
@@ -258,7 +258,7 @@ The running
DistroBaker 190a06
 .BR pgrep ,
DistroBaker 190a06
 .BR pkill ,
DistroBaker 190a06
 or
DistroBaker 190a06
-.B pwait
DistroBaker 190a06
+.B pidwait
DistroBaker 190a06
 process will never report itself as a
DistroBaker 190a06
 match.
DistroBaker 190a06
 .SH BUGS
DistroBaker 190a06
diff --git a/pgrep.c b/pgrep.c
DistroBaker 190a06
index 4fe5e8a..1905cd1 100644
DistroBaker 190a06
--- a/pgrep.c
DistroBaker 190a06
+++ b/pgrep.c
DistroBaker 190a06
@@ -38,7 +38,7 @@
DistroBaker 190a06
 #include <stdbool.h>
DistroBaker 190a06
 #include <time.h>
DistroBaker 190a06
 
DistroBaker 190a06
-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
DistroBaker 190a06
+#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
DistroBaker 190a06
 #include <sys/epoll.h>
DistroBaker 190a06
 #include <sys/syscall.h>
DistroBaker 190a06
 #endif
DistroBaker 190a06
@@ -68,8 +68,8 @@
DistroBaker 190a06
 static enum {
DistroBaker 190a06
     PGREP = 0,
DistroBaker 190a06
     PKILL,
DistroBaker 190a06
-#ifdef ENABLE_PWAIT
DistroBaker 190a06
-    PWAIT,
DistroBaker 190a06
+#ifdef ENABLE_PIDWAIT
DistroBaker 190a06
+    PIDWAIT,
DistroBaker 190a06
 #endif
DistroBaker 190a06
 } prog_mode;
DistroBaker 190a06
 
DistroBaker 190a06
@@ -136,8 +136,8 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
DistroBaker 190a06
 		fputs(_(" -q, --queue <value>       integer value to be sent with the signal\n"), fp);
DistroBaker 190a06
 		fputs(_(" -e, --echo                display what is killed\n"), fp);
DistroBaker 190a06
 		break;
DistroBaker 190a06
-#ifdef ENABLE_PWAIT
DistroBaker 190a06
-	case PWAIT:
DistroBaker 190a06
+#ifdef ENABLE_PIDWAIT
DistroBaker 190a06
+	case PIDWAIT:
DistroBaker 190a06
 		fputs(_(" -e, --echo                display PIDs before waiting\n"), fp);
DistroBaker 190a06
 		break;
DistroBaker 190a06
 #endif
DistroBaker 190a06
@@ -687,7 +687,7 @@ static struct el * select_procs (int *num)
DistroBaker 190a06
 				xerrx(EXIT_FAILURE, _("internal error"));
DistroBaker 190a06
 			}
DistroBaker 190a06
 
DistroBaker 190a06
-			// pkill and pwait don't support -w, but this is checked in getopt
DistroBaker 190a06
+			// pkill and pidwait don't support -w, but this is checked in getopt
DistroBaker 190a06
 			if (opt_threads) {
DistroBaker 190a06
 				while (readtask(ptp, &task, &subtask)){
DistroBaker 190a06
 					// don't add redundant tasks
DistroBaker 190a06
@@ -742,7 +742,7 @@ static int signal_option(int *argc, char **argv)
DistroBaker 190a06
 	return -1;
DistroBaker 190a06
 }
DistroBaker 190a06
 
DistroBaker 190a06
-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
DistroBaker 190a06
+#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
DistroBaker 190a06
 static int pidfd_open (pid_t pid, unsigned int flags)
DistroBaker 190a06
 {
DistroBaker 190a06
 	return syscall(__NR_pidfd_open, pid, flags);
DistroBaker 190a06
@@ -793,9 +793,9 @@ static void parse_opts (int argc, char **argv)
DistroBaker 190a06
 		{NULL, 0, NULL, 0}
DistroBaker 190a06
 	};
DistroBaker 190a06
 
DistroBaker 190a06
-#ifdef ENABLE_PWAIT
DistroBaker 190a06
-	if (strcmp (program_invocation_short_name, "pwait") == 0) {
DistroBaker 190a06
-		prog_mode = PWAIT;
DistroBaker 190a06
+#ifdef ENABLE_PIDWAIT
DistroBaker 190a06
+	if (strcmp (program_invocation_short_name, "pidwait") == 0) {
DistroBaker 190a06
+		prog_mode = PIDWAIT;
DistroBaker 190a06
 		strcat (opts, "e");
DistroBaker 190a06
 	} else
DistroBaker 190a06
 #endif
DistroBaker 190a06
@@ -1008,7 +1008,7 @@ int main (int argc, char **argv)
DistroBaker 190a06
 	int num;
DistroBaker 190a06
 	int i;
DistroBaker 190a06
 	int kill_count = 0;
DistroBaker 190a06
-#ifdef ENABLE_PWAIT
DistroBaker 190a06
+#ifdef ENABLE_PIDWAIT
DistroBaker 190a06
 	int poll_count = 0;
DistroBaker 190a06
 	int wait_count = 0;
DistroBaker 190a06
 	int epollfd = epoll_create(1);
DistroBaker 190a06
@@ -1055,8 +1055,8 @@ int main (int argc, char **argv)
DistroBaker 190a06
 			fprintf(stdout, "%d\n", num);
DistroBaker 190a06
 		return !kill_count;
DistroBaker 190a06
 
DistroBaker 190a06
-#ifdef ENABLE_PWAIT
DistroBaker 190a06
-	case PWAIT:
DistroBaker 190a06
+#ifdef ENABLE_PIDWAIT
DistroBaker 190a06
+	case PIDWAIT:
DistroBaker 190a06
 		if (opt_count)
DistroBaker 190a06
 			fprintf(stdout, "%d\n", num);
DistroBaker 190a06
 
DistroBaker 190a06
diff --git a/pwait.1 b/pidwait.1
DistroBaker 190a06
similarity index 100%
DistroBaker 190a06
rename from pwait.1
DistroBaker 190a06
rename to pidwait.1
DistroBaker 190a06
-- 
DistroBaker 190a06
GitLab
DistroBaker 190a06