the write to the ktraced file descriptor (when they used fktrace internally)
would block. Fix by clearing the non-blocking bit in the file descriptor by
default, so that the writes will block. This has the side effect of stopping
the traced process. Add a flag to override (-n) this behavior and have the
trace stop without blocking the traced process (the previous behavior).
Fix lint, add checks to failed syscalls, ansify.
Make ktrace -c default to removing all trace points (not just the default ones).
Make kdump default to dumping everything in the trace file.
Add 'A' (all) and '-' (remove following) to valid -t arguments.
Dump data block of UNKNOWN trace points in hex + ascii.
Make first time output with -R 0 (instead of time since epoch).
Use svis() instead of vis() to get " escaped (as \") (needs fixed libc)
Correctly pass unsigned values to svis()
Update man pages.
- For cleaner subprocess traces, malloc something before
spawning, so the syscalls malloc does while initializing don't gunk up
the trace.
- Increase pipe buffer sizes.
The child process of do_ktrace() does return and the stack is
changed by another function call (execvp()).
By using vfork() (my previous change), the execution of the parent
process resumes on the modified stack. Oops.
We could use vfork() carefully, but for now use fork().
Problem reported and investigated by Ethan Solomita <ethan@geocast.com>.
Thanks.
Following examples show the cases.
% ktrace -f - false >/dev/null && echo wrong
wrong
% ktrace -f - -i /usr/sbin/update >/dev/null
(does not return to command line)
That is, back out last change and restore the roles of parent/child for
ktrace(1). The ktruss(1) stuff still remains.
Yes, ktruss(1) has the problems. Better implementation is expected.
1. If fork()ing, the program is executed twice.
2. If the ktruss(1) output is bufferd, the final output is not flushed
(because it is executing).
% ktrace -f - rm >/dev/null
usage: rm [-dfiPRrW] file ...
usage: rm [-dfiPRrW] file ...
% ktruss date | cat
Fri Jul 23 12:09:45 JST 1999
Fri Jul 23 12:09:46 JST 1999
%