g is criteria

This commit is contained in:
albert 2006-06-24 20:12:29 +00:00
parent b4b97c71bf
commit 47d33e7ed4
4 changed files with 9 additions and 7 deletions

1
NEWS
View File

@ -11,6 +11,7 @@ pwdx: buffer overflow fixed -- thanks Ulf Harnhammar
procps.spec needed a slash -- thanks Jesse Brandeburg
w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch
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

11
pgrep.c
View File

@ -55,7 +55,7 @@ static int opt_newest = 0;
static int opt_negate = 0;
static int opt_exact = 0;
static int opt_signal = SIGTERM;
static int opt_flock = 0;
static int opt_lock = 0;
static int opt_case = 0;
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)
goto out;
// 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;
memset(buf,'\0',sizeof buf);
buf[read(fd,buf+1,sizeof buf-2)] = '\0';
@ -581,8 +581,8 @@ static void parse_opts (int argc, char **argv)
// break;
// case 'J': // Solaris: match by project ID (name or number)
// break;
case 'L': // FreeBSD: fail if pidfile (see -F) not locked with flock()
opt_flock++;
case 'L': // FreeBSD: fail if pidfile (see -F) not locked
opt_lock++;
break;
// case 'M': // FreeBSD: specify core (OS crash dump) file
// break;
@ -619,6 +619,7 @@ static void parse_opts (int argc, char **argv)
opt_pgrp = split_list (optarg, conv_pgrp);
if (opt_pgrp == NULL)
usage (opt);
++criteria_count;
break;
// case 'i': // FreeBSD: ignore case. OpenBSD: withdrawn. See -I. This sucks.
// 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);
usage(0);
}

View File

@ -306,7 +306,7 @@ int get_slabinfo(struct slab_info **list, struct slab_stat *stats)
slabfile = fopen(SLABINFO_FILE, "r");
if (!slabfile) {
perror("fopen");
perror("fopen " SLABINFO_FILE);
return 1;
}

View File

@ -30,7 +30,7 @@ long smp_num_cpus; /* number of CPUs */
"Error: /proc must be mounted\n" \
" To mount /proc at boot you need an /etc/fstab line like:\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"
static int stat_fd = -1;