From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,8e9b885446835ab4 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1994-11-15 14:09:03 PST Path: nntp.gmd.de!xlink.net!fauern!zib-berlin.de!zrz.TU-Berlin.DE!netmbx.de!Germany.EU.net!howland.reston.ans.net!news.sprintlink.net!pipex!uunet!olivea!news.hal.COM!halsoft.com!spike From: spike@hal.com (Spike White) Newsgroups: comp.unix.osf.misc Subject: Re: errno and DCE and threads Date: 15 Nov 1994 22:09:03 GMT Organization: HaL Software Systems, Inc. Distribution: world Message-ID: <3abbhv$9cs@halsoft.com> References: <39lsjk$lrf@clam.hi.com> <39qin9$9g6@paperboy.osf.org> <3aa1mo$6b8@mail.fwi.uva.nl> NNTP-Posting-Host: zarathustra.halsoft.com X-Newsreader: TIN [version 1.2 PL2] 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...