Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Mar 2010 11:29:32 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Jung-uk Kim <jkim@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, Marcel Moolenaar <xcllnt@mac.com>
Subject:   Re: [RFC] Saving the latest errno from syscalls.
Message-ID:  <20100312092932.GJ2489@deviant.kiev.zoral.com.ua>
In-Reply-To: <201003111815.10186.jkim@FreeBSD.org>
References:  <201003111624.51018.jkim@FreeBSD.org> <8EE3605E-6E39-44A1-9E3A-5A37E1921D27@mac.com> <201003111815.10186.jkim@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



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