diff options
author | Christopher Faylor <me@cgf.cx> | 2001-05-16 05:07:51 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-05-16 05:07:51 +0000 |
commit | d61b1993b36f3e7459c37db692c321654af3662e (patch) | |
tree | 0c7c4e6add1fd69120ce5cf969394e08ed72bb01 /winsup/cygwin/net.cc | |
parent | 2b0a111fcf0a2e7276f9c0f1cb9e56dc5d14361c (diff) | |
download | newlib-d61b1993b36f3e7459c37db692c321654af3662e.zip newlib-d61b1993b36f3e7459c37db692c321654af3662e.tar.gz newlib-d61b1993b36f3e7459c37db692c321654af3662e.tar.bz2 |
* autoload.h: Eliminate.
* autoload.cc: Pull in autoload.h. Eliminate many macros. Rewrite to avoid
necessity of initialization routines. Just use a standard one.
(wsock_init): New function. Moved from net.cc.
* net.cc (wsock_init): Move to autoload.cc.
(wsadata): Make global.
* dtable.cc (dtable::build_fhandler): Use more reliable method for checking if
net stuff has been loaded.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index b1b42ed..00b830b 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -103,7 +103,7 @@ wsock_event::wait (int socket, LPDWORD flags) return ret; } -static WSADATA wsadata; +WSADATA wsadata; /* Cygwin internal */ static SOCKET __stdcall @@ -2065,42 +2065,3 @@ extern "C" void endhostent (void) { } - -extern "C" void -wsock_init () -{ - static LONG NO_COPY here = -1L; - static int NO_COPY wsock_started = 0; - - while (InterlockedIncrement (&here)) - { - InterlockedDecrement (&here); - Sleep (0); - } - if (!wsock_started && (wsock32_handle || ws2_32_handle)) - { - /* Don't use autoload to load WSAStartup to eliminate recursion. */ - int (*wsastartup) (int, WSADATA *); - - wsastartup = (int (*)(int, WSADATA *)) - GetProcAddress ((HMODULE) (wsock32_handle ?: ws2_32_handle), - "WSAStartup"); - if (wsastartup) - { - int res = wsastartup ((2<<8) | 2, &wsadata); - - debug_printf ("res %d", res); - debug_printf ("wVersion %d", wsadata.wVersion); - debug_printf ("wHighVersion %d", wsadata.wHighVersion); - debug_printf ("szDescription %s", wsadata.szDescription); - debug_printf ("szSystemStatus %s", wsadata.szSystemStatus); - debug_printf ("iMaxSockets %d", wsadata.iMaxSockets); - debug_printf ("iMaxUdpDg %d", wsadata.iMaxUdpDg); - debug_printf ("lpVendorInfo %d", wsadata.lpVendorInfo); - - wsock_started = 1; - } - } - InterlockedDecrement (&here); -} - |