delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/11/25/10:02:59

Date: Tue, 25 Nov 97 16:02:37 +0100
From: wgalazka AT dodek DOT chem DOT uw DOT edu DOT pl (Wojtek Galazka)
Message-Id: <9711251502.AA09009@dodek.chem.uw.edu.pl>
To: eliz AT is DOT elta DOT co DOT il, djgpp-workers AT delorie DOT com
Subject: Re: errno constants in <errno.h>

> On Tue, 25 Nov 1997, Wojtek Galazka wrote:
> 
> > I want to change these values because I want to add some more EA*s
> > What's your opinion?
> 
> Don't  
> But I fail to understand why this is even needed.
> 
Here's the explanation.
Here's a very simplified description how the networking library
interracts with winsock.vxd

	err=wsock_call(socket_function, socket_parameters)

On return from this function in case of error an error code is
returned from in the err variable. THe numeric values of the error
codes at least as far as socket errors are concerned are the same as the
values of correcponding EA*s in BSD errno.h file. This is of no surprise as
it was the BSD folks who have invented and developed socket stuff and not Microsoft.

To be in in spirit with error checking I'd like to be able to check
the value of errno on return from socket function calls as it is
in Unix programs - winsock is different at this point.

To give a illustrious example:
on return from socket(AF_INET,SOCK_RAW, IP_ICMP) I get an
error code whose value is 44 (I cannot change the value, it comes
right from the internals of Windows) Checking winsock docs I found
this means that such kind of socket is not supported.
And the BSD docs say the following

#define ESOCKTNOSUPPORT  44 /* Socket type not supported*/

It therefore semms at least natural to reorganize EA* constants in
DJGPP errno.h file so that it would include network error codes.
However this requires changing almost all EA* values not just
these below network code error range.

The other solution seems to be in translating "on the fly" 
(==on the occurence of the error) from winsock error codes to
DJGPP errno codes which would sit above all EA*'s defined so far 

Your comennting this on is welcome.

Wojciech Galazka

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019