g is criteria
This commit is contained in:
parent
b4b97c71bf
commit
47d33e7ed4
1
NEWS
1
NEWS
@ -11,6 +11,7 @@ pwdx: buffer overflow fixed -- thanks Ulf Harnhammar
|
|||||||
procps.spec needed a slash -- thanks Jesse Brandeburg
|
procps.spec needed a slash -- thanks Jesse Brandeburg
|
||||||
w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch
|
w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch
|
||||||
pgrep/pkill: fix some realloc-related crashes #353894
|
pgrep/pkill: fix some realloc-related crashes #353894
|
||||||
|
pgrep/pkill: g is criteria (secret PLD Linux patch)
|
||||||
|
|
||||||
procps-3.2.5 --> procps-3.2.6
|
procps-3.2.5 --> procps-3.2.6
|
||||||
|
|
||||||
|
11
pgrep.c
11
pgrep.c
@ -55,7 +55,7 @@ static int opt_newest = 0;
|
|||||||
static int opt_negate = 0;
|
static int opt_negate = 0;
|
||||||
static int opt_exact = 0;
|
static int opt_exact = 0;
|
||||||
static int opt_signal = SIGTERM;
|
static int opt_signal = SIGTERM;
|
||||||
static int opt_flock = 0;
|
static int opt_lock = 0;
|
||||||
static int opt_case = 0;
|
static int opt_case = 0;
|
||||||
|
|
||||||
static const char *opt_delim = "\n";
|
static const char *opt_delim = "\n";
|
||||||
@ -199,7 +199,7 @@ static union el *read_pidfile(void)
|
|||||||
if(fstat(fd,&sbuf) || !S_ISREG(sbuf.st_mode) || sbuf.st_size<1)
|
if(fstat(fd,&sbuf) || !S_ISREG(sbuf.st_mode) || sbuf.st_size<1)
|
||||||
goto out;
|
goto out;
|
||||||
// type of lock, if any, is not standardized on Linux
|
// type of lock, if any, is not standardized on Linux
|
||||||
if(opt_flock && !has_flock(fd) && !has_fcntl(fd))
|
if(opt_lock && !has_flock(fd) && !has_fcntl(fd))
|
||||||
goto out;
|
goto out;
|
||||||
memset(buf,'\0',sizeof buf);
|
memset(buf,'\0',sizeof buf);
|
||||||
buf[read(fd,buf+1,sizeof buf-2)] = '\0';
|
buf[read(fd,buf+1,sizeof buf-2)] = '\0';
|
||||||
@ -581,8 +581,8 @@ static void parse_opts (int argc, char **argv)
|
|||||||
// break;
|
// break;
|
||||||
// case 'J': // Solaris: match by project ID (name or number)
|
// case 'J': // Solaris: match by project ID (name or number)
|
||||||
// break;
|
// break;
|
||||||
case 'L': // FreeBSD: fail if pidfile (see -F) not locked with flock()
|
case 'L': // FreeBSD: fail if pidfile (see -F) not locked
|
||||||
opt_flock++;
|
opt_lock++;
|
||||||
break;
|
break;
|
||||||
// case 'M': // FreeBSD: specify core (OS crash dump) file
|
// case 'M': // FreeBSD: specify core (OS crash dump) file
|
||||||
// break;
|
// break;
|
||||||
@ -619,6 +619,7 @@ static void parse_opts (int argc, char **argv)
|
|||||||
opt_pgrp = split_list (optarg, conv_pgrp);
|
opt_pgrp = split_list (optarg, conv_pgrp);
|
||||||
if (opt_pgrp == NULL)
|
if (opt_pgrp == NULL)
|
||||||
usage (opt);
|
usage (opt);
|
||||||
|
++criteria_count;
|
||||||
break;
|
break;
|
||||||
// case 'i': // FreeBSD: ignore case. OpenBSD: withdrawn. See -I. This sucks.
|
// case 'i': // FreeBSD: ignore case. OpenBSD: withdrawn. See -I. This sucks.
|
||||||
// if (opt_case)
|
// if (opt_case)
|
||||||
@ -677,7 +678,7 @@ static void parse_opts (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opt_flock && !opt_pidfile){
|
if(opt_lock && !opt_pidfile){
|
||||||
fprintf(stderr, "%s: -L without -F makes no sense\n",progname);
|
fprintf(stderr, "%s: -L without -F makes no sense\n",progname);
|
||||||
usage(0);
|
usage(0);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ int get_slabinfo(struct slab_info **list, struct slab_stat *stats)
|
|||||||
|
|
||||||
slabfile = fopen(SLABINFO_FILE, "r");
|
slabfile = fopen(SLABINFO_FILE, "r");
|
||||||
if (!slabfile) {
|
if (!slabfile) {
|
||||||
perror("fopen");
|
perror("fopen " SLABINFO_FILE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ long smp_num_cpus; /* number of CPUs */
|
|||||||
"Error: /proc must be mounted\n" \
|
"Error: /proc must be mounted\n" \
|
||||||
" To mount /proc at boot you need an /etc/fstab line like:\n" \
|
" To mount /proc at boot you need an /etc/fstab line like:\n" \
|
||||||
" /proc /proc proc defaults\n" \
|
" /proc /proc proc defaults\n" \
|
||||||
" In the meantime, mount /proc /proc -t proc\n"
|
" In the meantime, run \"mount /proc /proc -t proc\"\n"
|
||||||
|
|
||||||
#define STAT_FILE "/proc/stat"
|
#define STAT_FILE "/proc/stat"
|
||||||
static int stat_fd = -1;
|
static int stat_fd = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user