From owner-freebsd-current@FreeBSD.ORG Mon Feb 18 10:45:16 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C9CB16A41B; Mon, 18 Feb 2008 10:45:16 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B8F8D13C4CE; Mon, 18 Feb 2008 10:45:15 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 37770208E; Mon, 18 Feb 2008 11:45:12 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.3/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 25490208C; Mon, 18 Feb 2008 11:45:12 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id D389D844B9; Mon, 18 Feb 2008 11:45:11 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Daniel O'Connor" References: <200802122009.m1CK94Y8026959@repoman.freebsd.org> <200802181004.21379.doconnor@gsoft.com.au> <20080218040625.GA8141@kobe.laptop> <200802181513.42681.doconnor@gsoft.com.au> Date: Mon, 18 Feb 2008 11:45:11 +0100 In-Reply-To: <200802181513.42681.doconnor@gsoft.com.au> (Daniel O'Connor's message of "Mon\, 18 Feb 2008 15\:13\:35 +1030") Message-ID: <86pruu7dc8.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , freebsd-current@freebsd.org, Giorgos Keramidas 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 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2008 10:45:16 -0000 "Daniel O'Connor" writes: > Giorgos Keramidas 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