pidwait: Rename from pwait
pwait is already in at least Debian in a different package References: https://bugs.debian.org/982391
This commit is contained in:
22
pgrep.c
22
pgrep.c
@ -38,7 +38,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
|
||||
#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
@ -87,8 +87,8 @@ enum rel_items {
|
||||
static enum {
|
||||
PGREP = 0,
|
||||
PKILL,
|
||||
#ifdef ENABLE_PWAIT
|
||||
PWAIT,
|
||||
#ifdef ENABLE_PIDWAIT
|
||||
PIDWAIT,
|
||||
#endif
|
||||
} prog_mode;
|
||||
|
||||
@ -154,8 +154,8 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
|
||||
fputs(_(" -<sig>, --signal <sig> signal to send (either number or name)\n"), fp);
|
||||
fputs(_(" -q, --queue <value> integer value to be sent with the signal\n"), fp);
|
||||
fputs(_(" -e, --echo display what is killed\n"), fp);
|
||||
#ifdef ENABLE_PWAIT
|
||||
case PWAIT:
|
||||
#ifdef ENABLE_PIDWAIT
|
||||
case PIDWAIT:
|
||||
fputs(_(" -e, --echo display PIDs before waiting\n"), fp);
|
||||
break;
|
||||
#endif
|
||||
@ -698,7 +698,7 @@ static int signal_option(int *argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
|
||||
#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
|
||||
static int pidfd_open (pid_t pid, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_pidfd_open, pid, flags);
|
||||
@ -749,8 +749,8 @@ static void parse_opts (int argc, char **argv)
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
#ifdef ENABLE_PWAIT
|
||||
if (strcmp (program_invocation_short_name, "pwait") == 0) {
|
||||
#ifdef ENABLE_PIDWAIT
|
||||
if (strcmp (program_invocation_short_name, "pidwait") == 0) {
|
||||
prog_mode = PWAIT;
|
||||
strcat (opts, "e");
|
||||
} else
|
||||
@ -962,7 +962,7 @@ int main (int argc, char **argv)
|
||||
int num;
|
||||
int i;
|
||||
int kill_count = 0;
|
||||
#ifdef ENABLE_PWAIT
|
||||
#ifdef ENABLE_PIDWAIT
|
||||
int poll_count = 0;
|
||||
int wait_count = 0;
|
||||
int epollfd = epoll_create(1);
|
||||
@ -1007,8 +1007,8 @@ int main (int argc, char **argv)
|
||||
if (opt_count)
|
||||
fprintf(stdout, "%d\n", num);
|
||||
return !kill_count;
|
||||
#ifdef ENABLE_PWAIT
|
||||
case PWAIT:
|
||||
#ifdef ENABLE_PIDWAIT
|
||||
case PIDWAIT:
|
||||
if (opt_count)
|
||||
fprintf(stdout, "%d\n", num);
|
||||
|
||||
|
Reference in New Issue
Block a user