[Spread-users] [BUG][PATCH] fd to session troubles

Jonathan Stanton jonathan at cnds.jhu.edu
Mon Feb 4 10:13:46 EST 2002


On Mon, Feb 04, 2002 at 02:39:53PM +0100, Marc Zyngier wrote:
> >>>>> "JS" == Jonathan Stanton <jonathan at cnds.jhu.edu> writes:
> 
> JS> It should work much better on windows and have a few other bugfixes.
> 
> Well... More or less. In fact, it doesn't compile out of the box,
> because of EWOULDBLOCK that doesn't exist as such on Windows.

Ok. I think this one might also not exist on some more esoteric Unixes.
> 
> Even worse, testing errno in such a case is a non-sense, since socket
> errors are reported via WSAGetLastError(), which has nothing to do
> with libc errors (that's what errno really reports). Using E*
> constants is broken as well, since socket errors are really WSAE*
> constants.

I know using the WSA error stuff is "better" on windows, but isn't there at
least a backwands compatible Posix errno error reporting that I can enable
as default until everything is converted? It seems odd that windows has
most of the posix/unix stuff (at least as a compatibility layer) but
doesn't do error reporting the same way.

 > 
> The included patch does the first half of the job (using correct
> values for E* constants). It just helps compiling, and does not fix
> anything. The second part is to change all reference to errno in a
> socket context to something that returns errno on Unix and
> WSAGetLastError() on Windows.
> 
> Suspects are alarm.c, auth-pword-client.c, data_link.c, events.c,
> session.c and sp.c. sp.c is quite nasty, since it *affects* errno
> (lines 202 and 209, "errno = ERR_TIMEDOUT").

This is a big search and replace, which i'm willing to do, but it touches a
lot of code. About the sp.c problem, I would think there has to be a way to
set the returned error on Windows, libraries often have to change set what
error applications who see them will get. Maybe a WSASetError() ? :-)

> Index: session.c
> ===================================================================
> RCS file: /CVSROOT/src/components/farm/spread/daemon/session.c,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -r1.10 -r1.11
> --- session.c	2002/02/04 09:17:23	1.10
> +++ session.c	2002/02/04 12:11:01	1.11
> @@ -60,6 +60,13 @@
>  
>  #include <winsock.h>
>  #define	ioctl 	ioctlsocket
> +/* Use winsock constants since we are dealing with sockets */
> +#undef EINTR 
> +#undef EAGAIN
> +#define EWOULDBLOCK WSAEWOULDBLOCK
> +#define EINTR       WSAEINTR
> +#define EAGAIN      WSAEWOULDBLOCK
> +
>  
>  #endif  /* ARCH_PC_WIN95 */

This makes sense. 

Thanks,

Jonathan

-- 
-------------------------------------------------------
Jonathan R. Stanton         jonathan at cs.jhu.edu
Dept. of Computer Science   
Johns Hopkins University    
-------------------------------------------------------





More information about the Spread-users mailing list