diff --git a/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj b/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj index 91bce2a..221e12f 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj +++ b/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj @@ -147,9 +147,6 @@ true - - - diff --git a/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj.filters b/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj.filters index 5646fa8..0b0f6b2 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj.filters +++ b/contrib/win32/w32-posix-prototype/win32posix/SampleServer/SampleServer.vcxproj.filters @@ -14,9 +14,6 @@ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - Header Files diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/debug.h b/contrib/win32/w32-posix-prototype/win32posix/win32posix/debug.h index 0694b18..e2b5bfe 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/debug.h +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/debug.h @@ -1,6 +1,7 @@ #define debug(cformat, ...) write_log(__FILE__, __FUNCTION__, __LINE__, cformat, __VA_ARGS__) +#define debug2(cformat, ...) write_log(__FILE__, __FUNCTION__, __LINE__, cformat, __VA_ARGS__) void debug_initialize(); void debug_done(); diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/fileio.c b/contrib/win32/w32-posix-prototype/win32posix/win32posix/fileio.c index 6bc2a89..c903d8f 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/fileio.c +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/fileio.c @@ -233,7 +233,7 @@ VOID CALLBACK ReadCompletionRoutine( _Inout_ LPOVERLAPPED lpOverlapped ) { struct w32_io* pio = (struct w32_io*)((char*)lpOverlapped - offsetof(struct w32_io, read_overlapped)); - debug("pio:%p, pending_state:%d, error:%d, transferred:%d", pio, pio->read_details.pending, dwErrorCode, dwNumberOfBytesTransfered); + debug2("pio:%p, pending_state:%d, error:%d, transferred:%d", pio, pio->read_details.pending, dwErrorCode, dwNumberOfBytesTransfered); pio->read_details.error = dwErrorCode; pio->read_details.remaining = dwNumberOfBytesTransfered; pio->read_details.completed = 0; @@ -276,7 +276,7 @@ int fileio_read(struct w32_io* pio, void *dst, unsigned int max) { //if read is pending if (pio->read_details.pending) { errno = EAGAIN; - debug("IO is already pending"); + debug2("IO is already pending"); return -1; } @@ -285,7 +285,7 @@ int fileio_read(struct w32_io* pio, void *dst, unsigned int max) { if (-1 == fileio_ReadFileEx(pio)) { if ((pio->type == PIPE_FD) && (errno == ERROR_NEGATIVE_SEEK)) {//write end of the pipe closed - debug("no more data"); + debug2("no more data"); errno = 0; return 0; } @@ -303,7 +303,7 @@ int fileio_read(struct w32_io* pio, void *dst, unsigned int max) { } else if (pio->read_details.pending) { errno = EAGAIN; - debug("IO is pending"); + debug2("IO is pending"); return -1; } } @@ -312,7 +312,7 @@ int fileio_read(struct w32_io* pio, void *dst, unsigned int max) { errno = errno_from_Win32Error(pio->read_details.error); if ((errno == ERROR_BROKEN_PIPE) || //write end of the pipe is closed or pipe broken (errno == ERROR_HANDLE_EOF)) { //end of file reached - debug("no more data"); + debug2("no more data"); errno = 0; pio->read_details.error = 0; return 0; @@ -326,7 +326,7 @@ int fileio_read(struct w32_io* pio, void *dst, unsigned int max) { memcpy(dst, pio->read_details.buf + pio->read_details.completed, bytes_copied); pio->read_details.remaining -= bytes_copied; pio->read_details.completed += bytes_copied; - debug("read %d bytes", bytes_copied); + debug2("read %d bytes", bytes_copied); return bytes_copied; } @@ -336,7 +336,7 @@ VOID CALLBACK WriteCompletionRoutine( _Inout_ LPOVERLAPPED lpOverlapped ) { struct w32_io* pio = (struct w32_io*)((char*)lpOverlapped - offsetof(struct w32_io, write_overlapped)); - debug("pio:%p, pending_state:%d, remaining:%d, error:%d, transferred:%d", pio, pio->write_details.pending, pio->write_details.remaining, dwErrorCode, dwNumberOfBytesTransfered); + debug2("pio:%p, pending_state:%d, remaining:%d, error:%d, transferred:%d", pio, pio->write_details.pending, pio->write_details.remaining, dwErrorCode, dwNumberOfBytesTransfered); pio->write_details.error = dwErrorCode; //assert that remaining == dwNumberOfBytesTransfered pio->write_details.remaining -= dwNumberOfBytesTransfered; @@ -352,7 +352,7 @@ int fileio_write(struct w32_io* pio, const void *buf, unsigned int max) { { //this covers the scenario when the fd was previously non blocking (and hence io is still pending) //wait for previous io to complete - debug("waiting for prior unblocking write to complete before proceeding with this blocking write"); + debug2("waiting for prior unblocking write to complete before proceeding with this blocking write"); while (pio->write_details.pending) { if (wait_for_any_event(NULL, 0, INFINITE) == -1) return -1; @@ -360,7 +360,7 @@ int fileio_write(struct w32_io* pio, const void *buf, unsigned int max) { } else { errno = EAGAIN; - debug("IO is already pending"); + debug2("IO is already pending"); return -1; } } @@ -420,7 +420,7 @@ int fileio_write(struct w32_io* pio, const void *buf, unsigned int max) { int fileio_fstat(struct w32_io* pio, struct stat *buf) { int fd = _open_osfhandle((intptr_t)pio->handle, 0); - debug("pio:%p", pio); + debug2("pio:%p", pio); if (fd == -1) { errno = EOTHER; return -1; @@ -438,7 +438,7 @@ int fileio_isatty(struct w32_io* pio) { FILE* fileio_fdopen(struct w32_io* pio, const char *mode) { int fd_flags = 0; - debug("pio:%p", pio); + debug2("pio:%p", pio); if (mode[1] == '\0') { switch (*mode) { @@ -489,7 +489,7 @@ int fileio_on_select(struct w32_io* pio, BOOL rd) { int fileio_close(struct w32_io* pio) { - debug("pio:%p", pio); + debug2("pio:%p", pio); CancelIo(pio->handle); //let queued APCs (if any) drain SleepEx(0, TRUE); diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/socketio.c b/contrib/win32/w32-posix-prototype/win32posix/win32posix/socketio.c index b148bc7..e51f7a8 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/socketio.c +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/socketio.c @@ -133,7 +133,7 @@ void CALLBACK WSARecvCompletionRoutine( ) { struct w32_io* pio = (struct w32_io*)((char*)lpOverlapped - offsetof(struct w32_io, read_overlapped)); - debug("pio:%p, pending_state:%d, remaining:%d, completed:%d, error:%d, transferred: %d", + debug2("pio:%p, pending_state:%d, remaining:%d, completed:%d, error:%d, transferred: %d", pio, pio->read_details.pending, pio->read_details.remaining, pio->read_details.pending, dwError, cbTransferred); if (!dwError && !cbTransferred) dwError = ERROR_GRACEFUL_DISCONNECT; @@ -176,7 +176,7 @@ int socketio_WSARecv(struct w32_io* pio, BOOL* completed) { { pio->read_details.pending = TRUE; //receive has completed but APC is pending to be scheduled - debug("WSARecv immediate completion"); + debug2("WSARecv immediate completion"); if (completed) *completed = TRUE; } @@ -258,7 +258,7 @@ int socketio_connect(struct w32_io* pio, const struct sockaddr* name, int namele int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { BOOL completed = FALSE; - debug("pio: %p", pio); + debug2("pio: %p", pio); if ((buf == NULL) || (len == 0)){ errno = EINVAL; @@ -275,7 +275,7 @@ int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { //if io is already pending if (pio->read_details.pending) { errno = EAGAIN; - debug("Read is already pending"); + debug2("Read is already pending"); return -1; } @@ -286,14 +286,14 @@ int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { memcpy(buf, pio->read_details.buf + pio->read_details.completed, num_bytes_copied); pio->read_details.remaining -= num_bytes_copied; pio->read_details.completed += num_bytes_copied; - debug("returning %d bytes from prior completed IO, remaining: %d", num_bytes_copied, pio->read_details.remaining); + debug2("returning %d bytes from prior completed IO, remaining: %d", num_bytes_copied, pio->read_details.remaining); return num_bytes_copied; } //if there was an error on async call, return if (pio->read_details.error) { if (pio->read_details.error == ERROR_GRACEFUL_DISCONNECT) { - debug("connection closed"); + debug2("connection closed"); //connection is closed return 0; } @@ -330,7 +330,7 @@ int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { else { if (socketio_is_io_available(pio, TRUE) == FALSE) { errno = EAGAIN; - debug("IO is pending"); + debug2("IO is pending"); return -1; } } @@ -340,7 +340,7 @@ int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { { if (pio->read_details.error == ERROR_GRACEFUL_DISCONNECT) { //connection is closed - debug("connection closed"); + debug2("connection closed"); return 0; } else { @@ -356,7 +356,7 @@ int socketio_recv(struct w32_io* pio, void *buf, size_t len, int flags) { memcpy(buf, pio->read_details.buf, num_bytes_copied); pio->read_details.remaining -= num_bytes_copied; pio->read_details.completed = num_bytes_copied; - debug("returning %d bytes from completed IO, remaining: %d", num_bytes_copied, pio->read_details.remaining); + debug2("returning %d bytes from completed IO, remaining: %d", num_bytes_copied, pio->read_details.remaining); return num_bytes_copied; } else { @@ -376,7 +376,7 @@ void CALLBACK WSASendCompletionRoutine( ) { struct w32_io* pio = (struct w32_io*)((char*)lpOverlapped - offsetof(struct w32_io, write_overlapped)); - debug("pio: %p, pending_state:%d, error:%d, transferred:%d, remaining: %d", pio, pio->write_details.pending, dwError, cbTransferred, pio->write_details.remaining); + debug2("pio: %p, pending_state:%d, error:%d, transferred:%d, remaining: %d", pio, pio->write_details.pending, dwError, cbTransferred, pio->write_details.remaining); pio->write_details.error = dwError; //assert that remaining == cbTransferred pio->write_details.remaining -= cbTransferred; @@ -387,7 +387,7 @@ int socketio_send(struct w32_io* pio, const void *buf, size_t len, int flags) { int ret = 0; WSABUF wsabuf; - debug("pio: %p", pio); + debug2("pio: %p", pio); if ((buf == NULL) || (len == 0)){ errno = EINVAL; @@ -408,7 +408,7 @@ int socketio_send(struct w32_io* pio, const void *buf, size_t len, int flags) { { //this covers the scenario when the fd was previously non blocking (and hence io is still pending) //wait for previous io to complete - debug("waiting for IO on a previous nonblocking send to complete"); + debug2("waiting for IO on a previous nonblocking send to complete"); while (pio->write_details.pending) { if (wait_for_any_event(NULL, 0, INFINITE) == -1) return -1; @@ -416,7 +416,7 @@ int socketio_send(struct w32_io* pio, const void *buf, size_t len, int flags) { } else { errno = EAGAIN; - debug("IO pending"); + debug2("IO pending"); return -1; } } @@ -456,7 +456,7 @@ int socketio_send(struct w32_io* pio, const void *buf, size_t len, int flags) { if (ret == 0) { //send has completed and APC is scheduled, let it run - debug("WSASend immediate completion"); + debug2("WSASend immediate completion"); pio->write_details.pending = TRUE; pio->write_details.remaining = wsabuf.len; SleepEx(1, TRUE); @@ -473,7 +473,7 @@ int socketio_send(struct w32_io* pio, const void *buf, size_t len, int flags) { if (WSAGetLastError() == WSA_IO_PENDING) { //io is initiated and pending - debug("IO pending"); + debug2("IO pending"); pio->write_details.pending = TRUE; pio->write_details.remaining = wsabuf.len; if (w32_io_is_blocking(pio)) @@ -500,12 +500,12 @@ int socketio_shutdown(struct w32_io* pio, int how) { } int socketio_close(struct w32_io* pio) { - debug("pio: %p", pio); + debug2("pio: %p", pio); closesocket(pio->sock); //wait for pending io to abort SleepEx(0, TRUE); if (pio->read_details.pending || pio->write_details.pending) - debug("IO is still pending on closed socket. read:%d, write:%d", pio->read_details.pending, pio->write_details.pending); + debug2("IO is still pending on closed socket. read:%d, write:%d", pio->read_details.pending, pio->write_details.pending); if (pio->type == LISTEN_FD) { if (pio->read_overlapped.hEvent) CloseHandle(pio->read_overlapped.hEvent); @@ -529,7 +529,7 @@ struct w32_io* socketio_accept(struct w32_io* pio, struct sockaddr* addr, int* a int iResult = 0; struct acceptEx_context* context = (struct acceptEx_context*)pio->context; - debug("pio:%p", pio); + debug2("pio:%p", pio); //start io if not already started if (pio->read_details.pending == FALSE) { if (socketio_acceptEx(pio) != 0) { @@ -551,7 +551,7 @@ struct w32_io* socketio_accept(struct w32_io* pio, struct sockaddr* addr, int* a //if i/o is not ready if (FALSE == socketio_is_io_available(pio, TRUE)) { errno = EAGAIN; - debug("accept is pending"); + debug2("accept is pending"); return NULL; } @@ -578,7 +578,7 @@ struct w32_io* socketio_accept(struct w32_io* pio, struct sockaddr* addr, int* a context->accept_socket = INVALID_SOCKET; pio->read_details.pending = FALSE; ResetEvent(pio->read_overlapped.hEvent); - debug("accept io:%p", accept_io); + debug2("accept io:%p", accept_io); return accept_io; } @@ -613,7 +613,7 @@ BOOL socketio_is_io_available(struct w32_io* pio, BOOL rd) { int socketio_on_select(struct w32_io* pio, BOOL rd) { - debug("pio:%p", pio); + debug2("pio:%p", pio); if (rd && pio->read_details.pending) return 0; diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/w32fd.c b/contrib/win32/w32-posix-prototype/win32posix/win32posix/w32fd.c index 3df5a83..0005fd6 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/w32fd.c +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/w32fd.c @@ -392,7 +392,7 @@ int w32_select(int fds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, co *readfds = read_ready_fds; if (writefds) *writefds = write_ready_fds; - debug("IO ready:%d, no wait", out_ready_fds); + debug2("IO ready:%d, no wait", out_ready_fds); return out_ready_fds; } @@ -450,7 +450,7 @@ int w32_select(int fds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, co if (out_ready_fds) break; - debug("wait ended without any IO completion, looping again"); + debug2("wait ended without any IO completion, looping again"); } while (1); diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj b/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj index 5576462..a513483 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj @@ -135,9 +135,6 @@ true - - - diff --git a/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj.filters b/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj.filters index 563a972..15b911b 100644 --- a/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj.filters +++ b/contrib/win32/w32-posix-prototype/win32posix/win32posix/win32posix.vcxproj.filters @@ -14,9 +14,6 @@ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - Source Files