httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: APR errno handling finished.
Date Thu, 06 Apr 2000 00:18:04 GMT
> I didn't.  See my last response to Ben's complaint.  Instead of thinking
> that ALL platforms use their own error values as the primary value, start
> from the other direction.  ALL platforms use errno as their primary value.
> You end up with Ben's proposal exactly.
> Where doesn't this work?

Who is Ben?  (Maybe I need to seek professional help.)

When you say "primary value", do you mean the type of error indicator
which can be returned directly (e.g., "return errno" or "return
GetLastError()") or do you mean something else?

Your APRDesign text seems to say that on Windows APR functions can
"return GetLastError()" and on UNIX APR functions can "return errno."

Here is the exact text of yours that implies this:

+    On Unix which uses errno as the primary status values in ap_open:
+        if (open(fname, oflags, 0777) < 0)
+            return errno;
+    On Windows which uses win32 native errors in ap_open:
+        if (CreateFile(fname, oflags, sharemod, NULL, 
+                       createflags, attributes,0) == INVALID_HANDLE_VALUE
+            return GetLAstError();

If anywhere in APR we have Windows code that does "return
GetLastError()" or equivalent, then on Windows APR can never ever
"return errno." 

The reason it can't "return errno" if it does "return GetLastError()"
is that if you have this mismatch then you won't be able to write a
function like ap_strerror() and you won't be able to write a function
that canonicalizes an ap_status_t.  Also, it will be problematic to
look at a traced ap_status_t value and determine what error it really

If anywhere in APR we have OS/2 code that does "return os2_error" or
equivalent, then it can never ever "return errno" for the same

We certainly won't be able to have code in APR which runs on more than
just UNIX and which uses functions/kernel calls which set errno,
unless of course you introduce yet more macros which such common code
will use whenever they want to "return errno."

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message