This commit is contained in:
parent
09d3a52ffd
commit
dd6e5e377f
78
procps-3.2.7-pgrep_coption.dif
Normal file
78
procps-3.2.7-pgrep_coption.dif
Normal file
@ -0,0 +1,78 @@
|
||||
--- pgrep.1
|
||||
+++ pgrep.1 2007-10-05 22:36:42.000000000 +1000
|
||||
@@ -7,7 +7,7 @@
|
||||
pgrep, pkill \- look up or signal processes based on name and other attributes
|
||||
|
||||
.SH SYNOPSIS
|
||||
-pgrep [\-flvx] [\-d \fIdelimiter\fP] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...]
|
||||
+pgrep [\-cflvx] [\-d \fIdelimiter\fP] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...]
|
||||
.br
|
||||
[\-s \fIsid\fP,...] [\-u \fIeuid\fP,...] [\-U \fIuid\fP,...] [\-G \fIgid\fP,...]
|
||||
.br
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
+\-c
|
||||
+Suppress normal output; instead print a count of matching processes.
|
||||
+.TP
|
||||
\-d \fIdelimiter\fP
|
||||
Sets the string used to delimit each process ID in the output (by
|
||||
default a newline). (\fBpgrep\fP only.)
|
||||
--- pgrep.c
|
||||
+++ pgrep.c 2007-10-05 22:35:52.000000000 +1000
|
||||
@@ -54,6 +54,7 @@
|
||||
static int opt_newest = 0;
|
||||
static int opt_negate = 0;
|
||||
static int opt_exact = 0;
|
||||
+static int opt_count = 0;
|
||||
static int opt_signal = SIGTERM;
|
||||
static int opt_lock = 0;
|
||||
static int opt_case = 0;
|
||||
@@ -77,7 +78,7 @@
|
||||
if (i_am_pkill)
|
||||
fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] ");
|
||||
else
|
||||
- fprintf (stderr, "Usage: pgrep [-flvx] [-d DELIM] ");
|
||||
+ fprintf (stderr, "Usage: pgrep [-cflvx] [-d DELIM] ");
|
||||
fprintf (stderr, "[-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]\n"
|
||||
"\t[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] "
|
||||
"[PATTERN]\n");
|
||||
@@ -562,7 +563,7 @@
|
||||
strcat (opts, "ld:");
|
||||
}
|
||||
|
||||
- strcat (opts, "LF:fnovxP:g:s:u:U:G:t:?V");
|
||||
+ strcat (opts, "LF:cfnovxP:g:s:u:U:G:t:?V");
|
||||
|
||||
while ((opt = getopt (argc, argv, opts)) != -1) {
|
||||
switch (opt) {
|
||||
@@ -610,6 +611,9 @@
|
||||
exit(EXIT_SUCCESS);
|
||||
// case 'c': // Solaris: match by contract ID
|
||||
// break;
|
||||
+ case 'c':
|
||||
+ opt_count = 1;
|
||||
+ break;
|
||||
case 'd': // Solaris: change the delimiter
|
||||
opt_delim = strdup (optarg);
|
||||
break;
|
||||
@@ -721,10 +725,14 @@
|
||||
procs[i].num, strerror (errno));
|
||||
}
|
||||
} else {
|
||||
- if (opt_long)
|
||||
- output_strlist(procs,num);
|
||||
- else
|
||||
- output_numlist(procs,num);
|
||||
+ if (opt_count) {
|
||||
+ fprintf(stdout, "%ld\n", num);
|
||||
+ } else {
|
||||
+ if (opt_long)
|
||||
+ output_strlist (procs,num);
|
||||
+ else
|
||||
+ output_numlist (procs,num);
|
||||
+ }
|
||||
}
|
||||
return !num; // exit(EXIT_SUCCESS) if match, otherwise exit(EXIT_FAILURE)
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 15 17:56:31 CET 2008 - werner@suse.de
|
||||
|
||||
- Add c option patch to pgrep for counting matches (bnc#459081)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 10 13:38:35 CET 2008 - werner@suse.de
|
||||
|
||||
|
@ -27,7 +27,7 @@ Group: System/Monitoring
|
||||
PreReq: %fillup_prereq %insserv_prereq
|
||||
AutoReqProv: on
|
||||
Version: 3.2.7
|
||||
Release: 148
|
||||
Release: 149
|
||||
Summary: ps utilities for /proc
|
||||
Provides: ps
|
||||
Obsoletes: ps
|
||||
@ -60,6 +60,7 @@ Patch22: procps-3.2.7-selinux.patch
|
||||
Patch23: procps-3.2.7-accuracy.dif
|
||||
Patch24: procps-3.2.7-toosmall.dif
|
||||
Patch25: procps-3.2.7-cgroups_flag.diff
|
||||
Patch26: procps-3.2.7-pgrep_coption.dif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -114,6 +115,7 @@ Authors:
|
||||
%patch23
|
||||
%patch24
|
||||
%patch25 -p1
|
||||
%patch26
|
||||
|
||||
%build
|
||||
make CFLAGS="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS -pipe" \
|
||||
@ -179,6 +181,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%_mandir/man8/sysctl.8.gz
|
||||
|
||||
%changelog
|
||||
* Mon Dec 15 2008 werner@suse.de
|
||||
- Add c option patch to pgrep for counting matches (bnc#459081)
|
||||
* Wed Dec 10 2008 werner@suse.de
|
||||
- Make steal time part in vmstat active (bnc#457383)
|
||||
- Modify the patch for bnc#435544 to show summary CPU even on
|
||||
|
Loading…
x
Reference in New Issue
Block a user