gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] errno weirdness


From: Rene Hartmann
Subject: Re: [gforth] errno weirdness
Date: Thu, 26 Oct 2017 20:04:37 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]