Re: errno weirdness

Rene Hartmann <[email protected]>
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <[email protected]>
Reepca Russelstein wrote:
> errno stubbornly refuses to change from 0 no matter what kind of
> ridiculous shenanigans I get up to, (-12938 -12932 kill, for example).
> Considering C libraries' annoying tendency to communicate all useful
> debugging information through that one point, that's pretty
> frustrating. The C functions themselves return -1 as is expected, but
> errno refuses to change, even when I erroneously use functions from
> libc.fs itself (example: s" /argle" s" /blargle" link).
> 
> So now I'm stuck trying to figure out why my ptraces are randomly
> failing despite using the exact same arguments without knowing what
> the error even is. I'm on the latest git checkout presently.
> 
> Any ideas? My first guess would be that something in gforth itself is
> overwriting errno routinely...
> 
> Oh. Well then, turns out the problem only occurs when interactively
> checking errno - when it's in a compiled definition it works fine. I
> suppose that makes sense, but it's definitely not what I expected. I
> don't suppose something could be done about that, even if it's just
> adding a note to the manual?
> 
> 

Are you taking into account that errno is a macro on some systems so the 
errno variable may not be used at all? Under Linux, I call 
__errno_location() which is what errno expands to (plus a *).

Under GForth it seems to be possible to expand macros but I'm trying to 
stay portable to other Forths as much as possible.

--
René Hartmann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.