tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ktrace output file not showing up in fstat



>>> Why does that ktrace file not show up? Because it isn't associated
>>> with a process?
>>     fstat identifies open files.  A file is considered open by a
>>     process if it was [...], or kernel trace file for that process.
>>     [..]
>> So it sounds like a bug.

I would agree...though whether it's a bug in the manpage or the code
remains to be determined.

> fstat only shows 'file descriptors' of processes.

Not in my experience.  It also shows working directories and root
directories, and I think I've seen it show other things as well, though
after looking at the code (see below) I suspect that's memories
crossing over from similar tools elsewhere.

Looking at the source, the fstat I have at ready hand has code for
file-backed text segments, root directory, working directory, and
ktrace files.  The code for text segments is partial; while there's
code to print them there is nothing that can ever provoke that code.
Root directory and working directory work.  Ktrace files are like text
files in that there is code to print them but that code can never be
run; they differ in that the code to recognize them is there but
disabled, rather than being entirely absent:

#if 0
	/*
	 * Disable for now, since p->p_tracep appears to point to a ktr_desc *
	 * ktrace vnode, if one
	 */
	if (p->p_tracep)
		ftrans((struct file *)(intptr_t)p->p_tracep, TRACE);
#endif

I don't know why it doesn't just chase through to the file_t pointed to
by ktd_fp.  Possibly because ktr_desc is private to kern_ktrace.c
instead of being exported to userland?  Still, that could be changed.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index