From: cgf AT cygnus DOT com (Christopher Faylor) Subject: Re: Problem with select() 19 Sep 1998 20:17:42 -0700 Message-ID: <19980919225157.A6978.cygnus.cygwin32.developers@cygnus.com> References: <01BDE3E8 DOT 3772F340 AT sos> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Sergey Okhapkin , "'cygwin32-developers AT cygnus DOT com'" On Sat, Sep 19, 1998 at 04:11:52PM +0400, Sergey Okhapkin wrote: >Sergey Okhapkin wrote: >> I run NTS4.0 SP3 with MS winsock proxy client installed. To fix a problem I made >the following changes in select() code: > >The problem still present: > >[main] wget 1017 (0) cygwin32_select: 4, 0x0, 0x242EB40, 0x242EB38, 0x242EB30 >[main] wget 1017 (0) hinfo::select_write: /dev/tcp fd 3 >[main] wget 1017 (0) hinfo::select_except: /dev/tcp fd 3 >[main] wget 1017 (0) start_thread_socket: adding socket 0x194 >[main] wget 1017 (0) start_thread_socket: stuff_start 0x242EA4C, exitsock 184 >[main] wget 1017 (0) select_stuff::wait: n 2, ms 900000 >[select_socket] wget 1017 (0) thread_socket: stuff_start 0xA044E44 >[select_socket] wget 1017 (0) thread_socket: Win32 select returned -1 >[select_socket] wget 1017 (0) thread_socket: error 10038 >[select_socket] wget 1017 (0) thread_socket: s 0xA041DF0, testing fd 3 (/dev/tcp) >[select_socket] wget 1017 (0) handle_exceptions: In cygwin32_except_handler exc C0000005 at 776B94D8 sp 20CFFF48 >[select_socket] wget 1017 (0) handle_exceptions: In cygwin32_except_handler sig = 11 at 776B94D8 >[select_socket] wget 1017 (0) handle_exceptions: Exception: STATUS_ACCESS_VIOLATION >[select_socket] wget 1017 (0) handle_exceptions: Dumping stack trace to wget.exe.core >[select_socket] wget 1017 (0) exception: trapped! >[select_socket] wget 1017 (0) exception: code C0000005 at 776B94D8(select_socket) >[select_socket] wget 1017 (0) exception: ax 0 bx A041DF0 cx 194 dx C7381E34 >[select_socket] wget 1017 (0) exception: si 194 di 6F4CFFFF bp 20CFFF88 sp 20CFFF48 >[select_socket] wget 1017 (0) exception: exception is: STATUS_ACCESS_VIOLATION Ok. I played with this a little. This seems to fix things. I don't know why. I just did it for debugging purposes and everything started working. Index: select.h =================================================================== RCS file: /cvs/cvsfiles/devo/winsup/select.h,v retrieving revision 1.2 diff -u -p -r1.2 select.h --- select.h 1998/09/11 02:21:45 1.2 +++ select.h 1998/09/20 02:45:18 @@ -28,7 +28,7 @@ typedef struct winsock_fd_set #define WINSOCK_FD_SET(fd, set) do { \ (set)->fd_array[(set)->fd_count++]=fd;\ } while(0) -#define WINSOCK_FD_ZERO(set) ((set)->fd_count=0) +#define WINSOCK_FD_ZERO(set) memset ((set), 0, sizeof (*(set))) #define WINSOCK_FD_CLR(fd, set) do { \ u_int __i; \ for (__i = 0; __i < (set)->fd_count ; __i++) { \