Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: spike@hal.com (Spike White)
Subject: Re: errno and DCE and threads
Date: 15 Nov 1994 22:09:03 GMT	[thread overview]
Message-ID: <3abbhv$9cs@halsoft.com> (raw)
In-Reply-To: 3aa1mo$6b8@mail.fwi.uva.nl

Casper H.S. Dik (casper@fwi.uva.nl) wrote:
: rsalz@osf.org (Rich Salz) writes:

: >In practice, however, it's probably easier to just store errno in the internal
: >per-thread state block and copy it in/out as part of your thread task
: >context switch.


: >For kernel threads, the kernel should just be doing the right thing.

: How can a the kernel do this?  If errno is a statica variable,
: the kernel cannot move it about in a transparent way.
: Multpiple threads on multiple processors will want to read
: the variable so without #define errno (*(___errno())) I don't
: see a way of doing it.

In fact, at least one kernel level threads implementation (Solaris') does
use the '#define errno' trick.  Mainly, in /usr/include/errno.h, it has
the following:

extern int *___errno();
#define errno (*(___errno()))


So every time the process looks at errno, it's really looking at *(___errno()),
which, if you look at carefully, evaluates to a lhs.  Presumably, 
___errno() returns a pointer to the thread-specific errno and there's a errno
maintained by the kernel for each thread.

It seems like in this implementation, there's no notion of errno as a
process-wide global.

--
Spike White       | spike@hal.com               |  Biker Nerds From 
HaL Computer Corp | spike@rider.cactus.org      |     HaL
Austin, TX        | '87 BMW K75S, DoD #1347     |
Disclaimer:  HaL, do you want me to speak for you?  No, Dave... 


  parent reply	other threads:[~1994-11-15 22:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-07 18:45 errno and DCE and threads David Wright
1994-11-07 20:14 ` Alan Lehotsky
1994-11-08 15:42 ` Andrew Hastings
1994-11-08 21:35   ` Simon Patience
1994-11-09 20:05     ` Andrew Hastings
1994-11-09 13:27 ` Rich Salz
1994-11-15 10:14   ` Casper H.S. Dik
1994-11-15 16:38     ` Rich Salz
1994-11-15 21:19       ` Casper H.S. Dik
1994-11-15 21:40       ` Alan Lehotsky
1994-11-15 22:09     ` Spike White [this message]
1994-11-17 17:09       ` Alan Deehr
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox