Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2008 11:45:11 +0100
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        Kostik Belousov <kostikbel@gmail.com>, freebsd-current@freebsd.org, Giorgos Keramidas <keramida@freebsd.org>
Subject:   Re: [src] cvs commit: src/include unistd.h src/lib/libc/sys readlink.2 src/sys/compat/freebsd32 syscalls.master src/sys/kern syscalls.master vfs_syscalls.c src/sys/sys syscallsubr.h
Message-ID:  <86pruu7dc8.fsf@ds4.des.no>
In-Reply-To: <200802181513.42681.doconnor@gsoft.com.au> (Daniel O'Connor's message of "Mon\, 18 Feb 2008 15\:13\:35 %2B1030")
References:  <200802122009.m1CK94Y8026959@repoman.freebsd.org> <200802181004.21379.doconnor@gsoft.com.au> <20080218040625.GA8141@kobe.laptop> <200802181513.42681.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
"Daniel O'Connor" <doconnor@gsoft.com.au> writes:
> Giorgos Keramidas <keramida@freebsd.org> writes:
> > Specifying stdout may be a bit tricky, since the traced application
> > may be using the same stream to print output.  The same is possible
> > with stderr, but may be a tiny bit less likely.
> I didn't realise that the file descriptor used to write tracing data
> out was 'owned' by the process being traced, I always thought ktrace
> did.

ktrace does absolutely nothing other than enable tracing and exec the
application.  The 'k' in "ktrace" means "kernel".

> I did have a look at the source and the file opening etc is handled by
> the kernel but I am not sure who 'owns' that file descriptor.

There is no file descriptor.  There is a vnode in the kernel which is
not listed in the traced process's file table.  This is the whole point
of ktrace: it is undetectable by the traced process.

> I guess it couldn't be moved to ktrace without rearchitecting how
> ktracing works so the ktrace process sticks around writing stuff out
> to disk.

...which would make it just as useless as truss, since it would (among
other things) change the way job control works for the traced process.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86pruu7dc8.fsf>