🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4470

Re: Can longjmp modify errno?

#4470
From: Christopher R. Volpe
Date: Thu, 14 Dec 1995 16:38
29 lines
1805 bytes
In article <4aokt2$14j@elf.bsdi.com>, torek@elf.bsdi.com (Chris Torek) writes:
|>
|>Unfortunately, it is possible, and maybe even ever-so-slightly
|>sensible, for `errno' to refer to a *different* object on return
|>from longjmp.  For instance, suppose a compiler elects to put an
|>`errno' in each activation record (function call stack frame) and
|>to define `errno' as `the current frame's errno', e.g.,
|>
|>	#define errno (__builtin_upframe(0)->__errno)
|>
|>C library functions that set errno would use a different define,
|>such as:
|>
|>	#define callers_errno (__builtin_upframe(1)->__errno)

I hate to question anything Chris Torek says, because it's almost guaranteed
to make me look stupid, but here goes:

If there's a different errno for each activation record, then what happens if
function A calls function B, function B calls a system function during which
an error occurs, function B returns an error indication to function A, and
function A attempts to look at errno (A's own errno, not B's errno) to see
what happened?

--

Chris Volpe				Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D			Fax:   (518) 387-6560
PO Box 8, Schenectady, NY 12301		Email: volpecr@crd.ge.com
Technical Details
Message-ID: <4apjtb$8sp@rdsunx.crd.ge.com>
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
References: <DJEADH.HwC@nntpa.cb.att.com> <4alnjh$r8l@usenet.pa.dec.com> <4ampmf$4td@rdsunx.crd.ge.com> <30cf690b.6742464@nntp.ix.netcom.com> <4aokt2$14j@elf.bsdi.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
From: volpe@bart.crd.ge.com (Christopher R. Volpe)
Newsgroups: comp.std.c
Subject: Re: Can longjmp modify errno?
Date: 14 Dec 1995 16:38:03 GMT
Organization: GE Corporate Research & Development
Sender: volpe@bart (Christopher R. Volpe)
Distribution: world
Message-ID: <4apjtb$8sp@rdsunx.crd.ge.com>
References: <DJEADH.HwC@nntpa.cb.att.com> <4alnjh$r8l@usenet.pa.dec.com> <4ampmf$4td@rdsunx.crd.ge.com> <30cf690b.6742464@nntp.ix.netcom.com> <4aokt2$14j@elf.bsdi.com>
Reply-To: volpe@ausable.crd.ge.com
NNTP-Posting-Host: bart.crd.ge.com