The Number of the Error

Hello, know, I am errno,
I love to get in the way.
The text replacement macro,
such a portable mainstay.

Good for every language,
so long as that language is C.
Some may call it brain damage,
but that some includes not me.

Some may get out of my way
or go seethe and bray,
but UNIX conspired,
and I am required.

So bind me tight;
I plan to fight.
I'll cause problems as I please,
any errors I can seize.


The explanation:

I've grown to like writing some little poem whenever I bind some UNIX nonsense.  This binding is one
rather simple, a single Ada function returning that C language value named ``errno'' and implemented
as text replacement with the C language preprocessor.  I overwhelmingly prefer to avoid accessing it
at all; this can be done easily by examining the failure cases, eliminating those which can't occur,
and leaving only conflatable cases.  I did this with my UDP binding; it helps how many failure cases
only exist from peculiarities of the C language that Ada avoids, such as invalid address parameters.

Implementing a TCP binding forces errno, however, from a design that has failure cases that can only
be distinguished properly from its use, particularly of the connect function and its asinine design.

I pored through the definitions and expansions to find that all relevant UNIX clones implement errno
as a function of no parameters returning an integer pointer; I later found even NetBSD does so.  The
function is trivially modelled in Ada.  The names it uses are __errno_location, __errno, or __error.