From owner-freebsd-hackers Sun Jan 31 12:36:31 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA17556 for freebsd-hackers-outgoing; Sun, 31 Jan 1999 12:36:31 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from cimlogic.com.au (cimlog.lnk.telstra.net [139.130.51.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA17480 for ; Sun, 31 Jan 1999 12:36:19 -0800 (PST) (envelope-from jb@cimlogic.com.au) Received: (from jb@localhost) by cimlogic.com.au (8.9.1/8.9.1) id HAA03095; Mon, 1 Feb 1999 07:36:14 +1100 (EST) (envelope-from jb) From: John Birrell Message-Id: <199901312036.HAA03095@cimlogic.com.au> Subject: Re: Correct way to write a thread-safe library In-Reply-To: <199901311837.KAA07195@vashon.polstra.com> from John Polstra at "Jan 31, 1999 10:37:10 am" To: jdp@polstra.com (John Polstra) Date: Mon, 1 Feb 1999 07:36:14 +1100 (EST) Cc: robert+freebsd@cyrus.watson.org, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Polstra wrote: > and then make "__error()" return a pointer to where the possibly > thread-specific value is stored. You can look at our existing libc > and libc_r code for an example. > > The C standard explicitly allows for this by requiring "errno" to be > an lvalue but not necessarily a simple variable. It also requires > compilation units that reference "errno" to include . Sorry I missed the original mail. I think the question was about writing a library that _uses_ errno rather than one that implements it. From 3.0-RELEASE on, FreeBSD's errno definition in is thread aware, so there is no need to do anything in third-party libraries other than to code: errno = Esomething; -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message