bin/143558: commit references a PR

dfilter service dfilter at FreeBSD.ORG
Sun Jun 20 08:50:03 UTC 2010


The following reply was made to PR bin/143558; it has been noted by GNATS.

From: dfilter at FreeBSD.ORG (dfilter service)
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: bin/143558: commit references a PR
Date: Sun, 20 Jun 2010 08:48:40 +0000 (UTC)

 Author: brian
 Date: Sun Jun 20 08:48:30 2010
 New Revision: 209363
 URL: http://svn.freebsd.org/changeset/base/209363
 
 Log:
   Recognise the -l switch with pkill - list kill command(s) used.
   
   PR:		143558
   Submitted by:	eitanadlerlist at gmail dot com
   MFC after:	3 weeks
 
 Modified:
   head/bin/pkill/pkill.1
   head/bin/pkill/pkill.c
 
 Modified: head/bin/pkill/pkill.1
 ==============================================================================
 --- head/bin/pkill/pkill.1	Sun Jun 20 08:27:03 2010	(r209362)
 +++ head/bin/pkill/pkill.1	Sun Jun 20 08:48:30 2010	(r209363)
 @@ -156,14 +156,16 @@ The value
  matches processes not in jail.
  .It Fl l
  Long output.
 -Print the process name in addition to the process ID for each matching
 +For
 +.Nm pgrep ,
 +print the process name in addition to the process ID for each matching
  process.
  If used in conjunction with
  .Fl f ,
  print the process ID and the full argument list for each matching process.
 -This option can only be used with the
 -.Nm pgrep
 -command.
 +For
 +.Nm pkill ,
 +display the kill command used for each process killed.
  .It Fl n
  Select only the newest (most recently started) of the matching processes.
  .It Fl o
 
 Modified: head/bin/pkill/pkill.c
 ==============================================================================
 --- head/bin/pkill/pkill.c	Sun Jun 20 08:27:03 2010	(r209362)
 +++ head/bin/pkill/pkill.c	Sun Jun 20 08:48:30 2010	(r209363)
 @@ -128,7 +128,7 @@ main(int argc, char **argv)
  {
  	char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile;
  	const char *execf, *coref;
 -	int ancestors, debug_opt;
 +	int ancestors, debug_opt, did_action;
  	int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock;
  	size_t jsz;
  	int (*action)(const struct kinfo_proc *);
 @@ -242,8 +242,6 @@ main(int argc, char **argv)
  			criteria = 1;
  			break;
  		case 'l':
 -			if (!pgrep)
 -				usage();
  			longfmt = 1;
  			break;
  		case 'n':
 @@ -530,16 +528,24 @@ main(int argc, char **argv)
  	/*
  	 * Take the appropriate action for each matched process, if any.
  	 */
 +	did_action = 0;
  	for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) {
  		if (PSKIP(kp))
  			continue;
  		if (selected[i]) {
 +			if (longfmt && !pgrep) {
 +				did_action = 1;
 +				printf("kill -%d %d\n", signum, kp->ki_pid);
 +			}
  			if (inverse)
  				continue;
  		} else if (!inverse)
  			continue;
  		rv |= (*action)(kp);
  	}
 +	if (!did_action && !pgrep && longfmt)
 +		fprintf(stderr,
 +		    "No matching processes belonging to you were found\n");
  
  	exit(rv ? STATUS_MATCH : STATUS_NOMATCH);
  }
 @@ -552,7 +558,7 @@ usage(void)
  	if (pgrep)
  		ustr = "[-LSfilnoqvx] [-d delim]";
  	else
 -		ustr = "[-signal] [-ILfinovx]";
 +		ustr = "[-signal] [-ILfilnovx]";
  
  	fprintf(stderr,
  		"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
 _______________________________________________
 svn-src-all at freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"
 


More information about the freebsd-bugs mailing list