Re: ktrace buglet

2018-12-06 Thread Klemens Nanni
On Thu, Dec 06, 2018 at 03:33:06PM -0500, Ted Unangst wrote:
> ktrace -C will return an error if you don't have a ktrace.out file because
> sys_ktrace tries to open it whenever it has a filename, even if it won't be
> used. I think it is more consistent to require it be null, so that we aren't
> opening files we won't be using.

> 
> man page and utility diff below.
`ktrace -C' is shown twice as example in ktrace(1), once in DESCRIPTION
and at the end of EXAMPLES again.

OK kn



ktrace buglet

2018-12-06 Thread Ted Unangst
ktrace -C will return an error if you don't have a ktrace.out file because
sys_ktrace tries to open it whenever it has a filename, even if it won't be
used. I think it is more consistent to require it be null, so that we aren't
opening files we won't be using.

man page and utility diff below.


Index: usr.bin/ktrace/ktrace.c
===
RCS file: /cvs/src/usr.bin/ktrace/ktrace.c,v
retrieving revision 1.34
diff -u -p -r1.34 ktrace.c
--- usr.bin/ktrace/ktrace.c 11 Jun 2017 17:32:19 -  1.34
+++ usr.bin/ktrace/ktrace.c 6 Dec 2018 20:23:52 -
@@ -110,6 +110,7 @@ main(int argc, char *argv[])
break;
case 'C':
clear = CLEARALL;
+   tracefile = NULL;
pidset = 1;
break;
case 'c':
Index: lib/libc/sys/ktrace.2
===
RCS file: /cvs/src/lib/libc/sys/ktrace.2,v
retrieving revision 1.36
diff -u -p -r1.36 ktrace.2
--- lib/libc/sys/ktrace.2   19 Jun 2018 15:39:01 -  1.36
+++ lib/libc/sys/ktrace.2   6 Dec 2018 20:30:07 -
@@ -61,11 +61,8 @@ If tracing points are being disabled (se
 .Dv KTROP_CLEAR
 below),
 .Fa tracefile
-may be
-.Dv NULL
-or
-.Fa tracefd
-may be -1.
+must be
+.Dv NULL .
 .Pp
 Trace records are always appended to the file, ignoring the file offset,
 so the caller will usually want to truncate the file before calling