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

Marc Zyngier Marc.Zyngier at evidian.com
Mon Feb 4 08:39:53 EST 2002


>>>>> "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.

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.

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").

Regards,

        M.

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 */
 

-- 
And don't forget you'll never get a dog to walk upright
Just 'cause you've got the power, that don't mean you've got the right.





More information about the Spread-users mailing list