From: Stephen D. <sd...@gm...> - 2005-06-25 10:45:42
|
On 6/24/05, abe-t <it...@us...> wrote: > Update of /cvsroot/naviserver/naviserver/nsd > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15355/nsd >=20 > Modified Files: > driver.c binder.c > Log Message: > Excluded Unix calls from Windows code since some of the structs needed > to compile them are missing in Windows. >=20 >=20 > Index: driver.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/naviserver/naviserver/nsd/driver.c,v > retrieving revision 1.14 > retrieving revision 1.15 > diff -C2 -d -r1.14 -r1.15 > *** driver.c 19 Jun 2005 16:31:58 -0000 1.14 > --- driver.c 24 Jun 2005 08:36:29 -0000 1.15 > *************** > *** 448,453 **** > --- 448,455 ---- > if (drvPtr->opts & NS_DRIVER_UDP) { > drvPtr->sock =3D Ns_SockListenUdp(drvPtr->bindaddr, drvPtr-= >port); > + #ifndef _WIN32 > } else if (drvPtr->opts & NS_DRIVER_UNIX) { > drvPtr->sock =3D Ns_SockListenUnix(drvPtr->bindaddr); > + #endif > } else { > drvPtr->sock =3D Ns_SockListenEx(drvPtr->bindaddr, drvPtr->= port, >=20 > Index: binder.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/naviserver/naviserver/nsd/binder.c,v > retrieving revision 1.9 > retrieving revision 1.10 > diff -C2 -d -r1.9 -r1.10 > *** binder.c 15 Jun 2005 04:14:04 -0000 1.9 > --- binder.c 24 Jun 2005 08:36:29 -0000 1.10 > *************** > *** 36,40 **** >=20 > #include "nsd.h" > ! #include <sys/un.h> >=20 > NS_RCSID("@(#) $Header$"); > --- 36,43 ---- >=20 > #include "nsd.h" > ! > ! #ifndef _WIN32 > ! # include <sys/un.h> > ! #endif >=20 > NS_RCSID("@(#) $Header$"); > *************** > *** 52,56 **** > #ifndef _WIN32 > static void PreBind(char *line); > - #endif >=20 >=20 > --- 55,58 ---- > *************** > *** 103,107 **** > return (SOCKET)sock; > } > ! >=20 > /* > --- 105,109 ---- > return (SOCKET)sock; > } > ! #endif /* _WIN32 */ >=20 > /* > *************** > *** 189,192 **** > --- 191,195 ---- >=20 >=20 > + #ifndef _WIN32 > /* > *---------------------------------------------------------------------= - > *************** > *** 237,241 **** > return (SOCKET)sock; > } > ! >=20 > /* > --- 240,244 ---- > return (SOCKET)sock; > } > ! #endif /* _WIN32 */ >=20 > /* > *************** > *** 275,278 **** > --- 278,282 ---- >=20 >=20 > + #ifndef _WIN32 > /* > *---------------------------------------------------------------------= - > *************** > *** 315,319 **** > return (SOCKET)sock; > } > ! >=20 > /* > --- 319,323 ---- > return (SOCKET)sock; > } > ! #endif /* _WIN32 */ >=20 > /* You could have the functions return an error for Windows rather than defining them out. Something like:: SOCKET Ns_SockListenUnix(char *path) { int sock =3D -1; Tcl_HashEntry *hPtr; Tcl_HashSearch search; +#ifdef _WIN32 + Ns_Log(Error, "AF_UNIX sockets not supported on Windows: %s", path); + return -1; +#else + Ns_MutexLock(&lock); + ... +#endif This has the advantage that you don't also have to ifdef around the use of this function, as is done for the prebind functions and use of Ns_SockListenUnix in driver.c. It's easier for module writers, too. I'm not sure why Ns_SockListenEx is no longer available on Windows.=20 This is for simple TCP sockets, and it's called by Ns_SockListen in sock.c. |