Subject: bin/5358: ktrace -c shouldn't need an argument
To: None <gnats-bugs@gnats.netbsd.org>
From: None <nathanw@MIT.EDU>
List: netbsd-bugs
Date: 04/24/1998 16:19:43
>Number:         5358
>Category:       bin
>Synopsis:       'ktrace -c' should be valid, but isn't.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 24 13:20:00 1998
>Last-Modified:
>Originator:     Nathan J Williams
>Organization:
	Massachvsetts Institvte of Technology
>Release:        NetBSD 1.3.1
>Environment:
System: NetBSD snorklewacker.mit.edu 1.3.1 NetBSD 1.3.1 (ATHENADEBUG) #1: Fri Apr 24 14:58:34 EDT 1998 nathanw@snorklewacker.mit.edu:/u1/var/tmp/sys/arch/i386/compile/ATHENADEBUG i386


>Description:
	According to both the man page and the usage message "ktrace -c" 
should be a valid invocation to stop all tracing on the file ktrace.out 
(or whatever file is specified with -f). But if no pid or pgrp is specified
and no other argument is given on the command line, ktrace complains.

>How-To-Repeat:
	ktrace -p something, and then try to use ktrace -c to stop tracing. 

>Fix:

	This patch also corrects a nit in the usage message and makes it 
more accurately reflect the avaliable tracing points. 

*** ktrace.c.orig	Fri Apr 24 15:59:08 1998
--- ktrace.c	Fri Apr 24 16:10:13 1998
***************
*** 94,99 ****
--- 94,100 ----
  			break;
  		case 'c':
  			clear = CLEAR;
+ 			pidset = 1;
  			break;
  		case 'd':
  			ops |= KTRFLAG_DESCEND;
***************
*** 182,188 ****
  usage()
  {
  	(void)fprintf(stderr,
! "usage:\tktrace [-aCcid] [-f trfile] [-g pgid] [-p pid] [-t [acgn]\n\tktrace [-aCcid] [-f trfile] [-t [acgn] command\n");
  	exit(1);
  }
  
--- 183,189 ----
  usage()
  {
  	(void)fprintf(stderr,
! "usage:\tktrace [-aCcid] [-f trfile] [-g pgid] [-p pid] [-t [cenis]]\n\tktrace [-aCcid] [-f trfile] [-t [cenis]] command\n");
  	exit(1);
  }
  
>Audit-Trail:
>Unformatted: