From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 16 16:38:30 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id ABD71106566B; Tue, 16 Mar 2010 16:38:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-hackers@freebsd.org Date: Tue, 16 Mar 2010 12:38:20 -0400 User-Agent: KMail/1.6.2 References: <201003111624.51018.jkim@FreeBSD.org> <201003121332.16979.jkim@FreeBSD.org> <201003151410.35959.jkim@FreeBSD.org> In-Reply-To: <201003151410.35959.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003161238.23768.jkim@FreeBSD.org> Cc: Kostik Belousov , Marcel Moolenaar Subject: Re: [RFC] DTrace SYSCALL provider (was Re: [RFC] Saving the latest errno from syscalls.) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2010 16:38:30 -0000 On Monday 15 March 2010 02:10 pm, Jung-uk Kim wrote: > On Friday 12 March 2010 01:32 pm, Jung-uk Kim wrote: > > On Friday 12 March 2010 04:29 am, Kostik Belousov wrote: > > > On Thu, Mar 11, 2010 at 06:15:07PM -0500, Jung-uk Kim wrote: > > > > On Thursday 11 March 2010 04:55 pm, Marcel Moolenaar wrote: > > > > > On Mar 11, 2010, at 1:24 PM, Jung-uk Kim wrote: > > > > > > While I was debugging syscalls, I found a very useful > > > > > > field in struct thread, td_errno. It seems it was added > > > > > > for dtrace but it is only populated on amd64 and i386. > > > > > > Is the attached patch acceptable for maintainers of other > > > > > > platforms? > > > > > > > > > > Isn't it better to do it in cpu_set_syscall_retval()? > > > > > That way you catch all cases, plus you can save the > > > > > translated error as well... > > > > > > > > I just took amd64/i386 as an example and I was not sure > > > > whether it was meant to store translated error or not. Does > > > > anyone with DTrace internal knowledge answer the question? > > > > > > I do not know that much about DTrace, but it seems that setting > > > td_errno in cpu_set_syscall_retval() is too late. Dtrace has a > > > probe after the syscall return, and it is called right before > > > cpu_set_syscall_retval() can be reasonably called. The probe > > > only issued for syscall that goes into sysent. > > > > Ah, I can see that now. So, if/when we implement DTrace SYSCALL > > provider for other arches, this is the right place. :-) > > I went ahead and implemented DTrace SYSCALL providers for non-x86 > arches. It passes 'make universe' test but I don't know if it > works. Can maintainers of other arches test or review the attached > patch? I realized there are too many missing pieces for DTrace to work on other arches. :-( Please ignore this patch. Jung-uk Kim