From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 12 09:29:48 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EF18106564A; Fri, 12 Mar 2010 09:29:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A38FB8FC19; Fri, 12 Mar 2010 09:29:47 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o2C9TWtn027972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Mar 2010 11:29:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o2C9TWVe053931; Fri, 12 Mar 2010 11:29:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o2C9TWuk053930; Fri, 12 Mar 2010 11:29:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Mar 2010 11:29:32 +0200 From: Kostik Belousov To: Jung-uk Kim Message-ID: <20100312092932.GJ2489@deviant.kiev.zoral.com.ua> References: <201003111624.51018.jkim@FreeBSD.org> <8EE3605E-6E39-44A1-9E3A-5A37E1921D27@mac.com> <201003111815.10186.jkim@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7epHAAa1/vAPJ6LR" Content-Disposition: inline In-Reply-To: <201003111815.10186.jkim@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, Marcel Moolenaar Subject: 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: Fri, 12 Mar 2010 09:29:48 -0000 --7epHAAa1/vAPJ6LR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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... >=20 > I just took amd64/i386 as an example and I was not sure whether it was=20 > meant to store translated error or not. Does anyone with DTrace=20 > 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. --7epHAAa1/vAPJ6LR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkuaCXwACgkQC3+MBN1Mb4iYGQCfbxmtBnBDez8DMbLGZLKuXcYj SRQAoNdLRhK4xmEf5VRk6OJBJauQjvAQ =W5iU -----END PGP SIGNATURE----- --7epHAAa1/vAPJ6LR--