]> git.pond.sub.org Git - empserver/commit
Move Windows socket stuff out off posixio.c into w32sockets.c
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 13 Apr 2009 17:25:25 +0000 (19:25 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 30 Nov 2009 18:45:27 +0000 (19:45 +0100)
commit4c6deb1f98057f7a9044208d4f0d022c40832b50
treeb8c7dc4ec928b16cec71341ee1e680a4ed5b7b0f
parent39398997fe28b72e38af667bf9e036d8ef47e30f
Move Windows socket stuff out off posixio.c into w32sockets.c

This is so we can avoid linking utilities with socket libraries (see
commit 8b778634).

When using sockets, we need to replace close(), because Windows'
close() can't cope with socket file descriptors.  But replacing it
always would pull in the socket stuff again.  Define close() to call
function pointer w32_close_function, which is initially _close.
Rename posix_close() to w32_close_maybe_socket().  Make new
w32_socket_init() put it in w32_close_function.

Same for read() and write(): define read(), write() to call function
pointers w32_read_function, w32_write_function, initially _read(),
_write(); rename posix_read(), posix_write() to
w32_read_maybe_socket(), w32_write_maybe_socket(), and put them into
w32_read_function, w32_write_function in w32_socket_init().

Also call WSAStartup() there, and use that from loc_NTInit().
WSACleanup() now belongs next to w32_socket_init().  Don't bother,
just drop it, along with loc_NTTerm().
Make.mk
src/lib/w32/posixio.c
src/lib/w32/sys/socket.h
src/lib/w32/unistd.h
src/lib/w32/w32sockets.c [new file with mode: 0644]
src/server/main.c