You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Dean Gaudet <dg...@hyperreal.com> on 1997/06/29 21:27:25 UTC
cvs commit: apache/src/modules/proxy proxy_connect.c
dgaudet 97/06/29 12:27:24
Modified: src buff.c conf.h http_main.c
src/modules/proxy proxy_connect.c
Log:
Introduce ap_select to clean up SELECT_NEEDS_CAST #ifdefs everywhere.
Revision Changes Path
1.32 +1 -5 apache/src/buff.c
Index: buff.c
===================================================================
RCS file: /export/home/cvs/apache/src/buff.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C3 -r1.31 -r1.32
*** buff.c 1997/06/29 19:19:34 1.31
--- buff.c 1997/06/29 19:27:20 1.32
***************
*** 448,458 ****
FD_SET( fb->fd_in, &fds );
tv.tv_sec = 0;
tv.tv_usec = 0;
! #ifdef SELECT_NEEDS_CAST
! rv = select( fb->fd_in + 1, (int *)&fds, NULL, NULL, &tv );
! #else
! rv = select( fb->fd_in + 1, &fds, NULL, NULL, &tv );
! #endif
} while( rv < 0 && errno == EINTR );
/* treat any error as if it would block as well */
if( rv != 1 ) {
--- 448,454 ----
FD_SET( fb->fd_in, &fds );
tv.tv_sec = 0;
tv.tv_usec = 0;
! rv = ap_select( fb->fd_in + 1, &fds, NULL, NULL, &tv );
} while( rv < 0 && errno == EINTR );
/* treat any error as if it would block as well */
if( rv != 1 ) {
1.107 +7 -0 apache/src/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache/src/conf.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -C3 -r1.106 -r1.107
*** conf.h 1997/06/29 01:58:32 1.106
--- conf.h 1997/06/29 19:27:20 1.107
***************
*** 731,736 ****
--- 731,743 ----
#define ap_setjmp(x) sigsetjmp((x), 1)
#endif
+ #ifdef SELECT_NEEDS_CAST
+ #define ap_select(_a, _b, _c, _d, _e) \
+ select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
+ #else
+ #define ap_select select
+ #endif
+
/* Finding offsets of elements within structures.
* Taken from the X code... they've sweated portability of this stuff
* so we don't have to. Sigh...
1.170 +4 -16 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -C3 -r1.169 -r1.170
*** http_main.c 1997/06/29 19:19:35 1.169
--- http_main.c 1997/06/29 19:27:21 1.170
***************
*** 704,714 ****
fds_read = lfds;
fds_err = lfds;
! #ifdef SELECT_NEEDS_CAST
! select_rv = select(lsd+1, (int*)&fds_read, NULL, (int*)&fds_err, &tv);
! #else
! select_rv = select(lsd+1, &fds_read, NULL, &fds_err, &tv);
! #endif
} while ((select_rv > 0) && /* Something to see on socket */
!FD_ISSET(lsd, &fds_err) && /* that isn't an error condition */
FD_ISSET(lsd, &fds_read) && /* and is worth trying to read */
--- 704,710 ----
fds_read = lfds;
fds_err = lfds;
! select_rv = ap_select(lsd+1, &fds_read, NULL, &fds_err, &tv);
} while ((select_rv > 0) && /* Something to see on socket */
!FD_ISSET(lsd, &fds_err) && /* that isn't an error condition */
FD_ISSET(lsd, &fds_read) && /* and is worth trying to read */
***************
*** 1248,1254 ****
tv.tv_sec = waittime / 1000000;
tv.tv_usec = waittime % 1000000;
waittime = waittime * 2;
! select(0, NULL, NULL, NULL, &tv);
}
if (waitret == 0) {
switch (tries) {
--- 1244,1250 ----
tv.tv_sec = waittime / 1000000;
tv.tv_usec = waittime % 1000000;
waittime = waittime * 2;
! ap_select(0, NULL, NULL, NULL, &tv);
}
if (waitret == 0) {
switch (tries) {
***************
*** 2093,2103 ****
for (;;) {
memcpy(&main_fds, &listenfds, sizeof(fd_set));
! #ifdef SELECT_NEEDS_CAST
! srv = select(listenmaxfd+1, (int*)&main_fds, NULL, NULL, NULL);
! #else
! srv = select(listenmaxfd+1, &main_fds, NULL, NULL, NULL);
! #endif
errsave = errno;
sync_scoreboard_image();
--- 2089,2095 ----
for (;;) {
memcpy(&main_fds, &listenfds, sizeof(fd_set));
! srv = ap_select(listenmaxfd+1, &main_fds, NULL, NULL, NULL);
errsave = errno;
sync_scoreboard_image();
***************
*** 3129,3139 ****
tv.tv_usec = 0;
memcpy(&main_fds, &listenfds, sizeof(fd_set));
! #ifdef SELECT_NEEDS_CAST
! srv = select(listenmaxfd+1, (int*)&main_fds, NULL, NULL, &tv);
! #else
! srv = select(listenmaxfd+1, &main_fds, NULL, NULL, &tv);
! #endif
#ifdef WIN32
if(srv == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR;
--- 3121,3127 ----
tv.tv_usec = 0;
memcpy(&main_fds, &listenfds, sizeof(fd_set));
! srv = ap_select(listenmaxfd+1, &main_fds, NULL, NULL, &tv);
#ifdef WIN32
if(srv == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR;
1.10 +1 -5 apache/src/modules/proxy/proxy_connect.c
Index: proxy_connect.c
===================================================================
RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_connect.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C3 -r1.9 -r1.10
*** proxy_connect.c 1997/06/15 19:22:48 1.9
--- proxy_connect.c 1997/06/29 19:27:23 1.10
***************
*** 178,190 ****
FD_SET(r->connection->client->fd, &fds);
Explain0("Going to sleep (select)");
! i = select((r->connection->client->fd > sock ?
r->connection->client->fd+1 :
- #ifdef HPUX
- sock+1), (int*)&fds, NULL, NULL, NULL);
- #else
sock+1), &fds, NULL, NULL, NULL);
- #endif
Explain1("Woke from select(), i=%d",i);
if (i)
--- 178,186 ----
FD_SET(r->connection->client->fd, &fds);
Explain0("Going to sleep (select)");
! i = ap_select((r->connection->client->fd > sock ?
r->connection->client->fd+1 :
sock+1), &fds, NULL, NULL, NULL);
Explain1("Woke from select(), i=%d",i);
if (i)