You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/06/06 21:30:53 UTC
cvs commit: apache-1.3/src/main http_main.c http_protocol.c util.c
dgaudet 98/06/06 12:30:53
Modified: src CHANGES Configure
src/include conf.h
src/main http_main.c http_protocol.c util.c
Log:
Updated support for UTS 2.1.2.
PR: 2320
Submitted by: Dave Dykstra <dw...@bell-labs.com>
Revision Changes Path
1.890 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.889
retrieving revision 1.890
diff -u -r1.889 -r1.890
--- CHANGES 1998/06/06 19:21:20 1.889
+++ CHANGES 1998/06/06 19:30:38 1.890
@@ -1,5 +1,8 @@
Changes with Apache 1.3.1
+ *) PORT: Updated support for UTS 2.1.2.
+ [Dave Dykstra <dw...@bell-labs.com>] PR#2320
+
*) Fix symbol export list (src/support/httpd.exp) after recent
API changes in the child spawning area.
[Jens-Uwe Mager <ju...@helios.de>]
1.263 +2 -1 apache-1.3/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -r1.262 -r1.263
--- Configure 1998/06/04 20:13:12 1.262
+++ Configure 1998/06/06 19:30:39 1.263
@@ -629,8 +629,9 @@
;;
*-uts*)
OS='Amdahl UTS'
- CFLAGS="$CFLAGS -Xa -eft -DUTS21"
+ CFLAGS="$CFLAGS -Xa -eft -DUTS21 -DUSEBCOPY"
LIBS="$LIBS -lsocket -lbsd -la"
+ DEF_WANTHSREGEX=yes
;;
*-ultrix)
OS='ULTRIX'
1.215 +12 -1 apache-1.3/src/include/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/conf.h,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -r1.214 -r1.215
--- conf.h 1998/06/04 20:13:17 1.214
+++ conf.h 1998/06/06 19:30:46 1.215
@@ -573,13 +573,24 @@
#undef NO_KILLPG
#define NO_SETSID
#define NEED_WAITPID
-#define NO_OTHER_CHILD
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define HAVE_SYSLOG 1
+#define USE_LONGJMP
+#define JMP_BUF jmp_buf
+#define NO_USE_SIGACTION
+#define NEED_STRERROR
+#define NEED_STRSTR
+#define NEED_HASHBANG_EMUL
+#define NDELAY_PIPE_RETURNS_ZERO
+#define NO_DATA NO_ADDRESS
+#define ap_wait_t union wait
+#define WEXITSTATUS(status) (int)((status).w_retcode)
+#define WTERMSIG(status) (int)((status).w_termsig)
#define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
#include <sys/types.h>
+#include <sys/time.h>
#elif defined(APOLLO)
#undef HAVE_GMTOFF
1.359 +17 -15 apache-1.3/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -r1.358 -r1.359
--- http_main.c 1998/06/04 20:13:19 1.358
+++ http_main.c 1998/06/06 19:30:47 1.359
@@ -2129,29 +2129,26 @@
}
-#if defined(BROKEN_WAIT) || defined(NEED_WAITPID)
+#if defined(NEED_WAITPID)
/*
- Some systems appear to fail to deliver dead children to wait() at times.
- This sorts them out. In fact, this may have been caused by a race condition
- in wait_or_timeout(). But this routine is still useful for systems with no
- waitpid().
+ Systems without a real waitpid sometimes lose a child's exit while waiting
+ for another. Search through the scoreboard for missing children.
*/
-int reap_children(void)
+int reap_children(ap_wait_t *status)
{
- int status, n;
- int ret = 0;
+ int n, pid;
for (n = 0; n < max_daemons_limit; ++n) {
- if (ap_scoreboard_image->servers[n].status != SERVER_DEAD
- && waitpid(ap_scoreboard_image->parent[n].pid, &status, WNOHANG)
- == -1
- && errno == ECHILD) {
- ap_sync_scoreboard_image();
+ ap_sync_scoreboard_image();
+ if (ap_scoreboard_image->servers[n].status != SERVER_DEAD &&
+ kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) {
ap_update_child_status(n, SERVER_DEAD, NULL);
- ret = 1;
+ /* just mark it as having a successful exit status */
+ *status = 0;
+ return(pid);
}
}
- return ret;
+ return 0;
}
#endif
@@ -2214,6 +2211,11 @@
if (ret > 0) {
return ret;
}
+#ifdef NEED_WAITPID
+ if ((ret = reap_children(status)) > 0) {
+ return ret;
+ }
+#endif
tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
ap_select(0, NULL, NULL, NULL, &tv);
1.218 +20 -1 apache-1.3/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -r1.217 -r1.218
--- http_protocol.c 1998/05/27 22:55:59 1.217
+++ http_protocol.c 1998/06/06 19:30:48 1.218
@@ -1721,6 +1721,15 @@
FD_ZERO(&fds);
while (!r->connection->aborted) {
+#ifdef NDELAY_PIPE_RETURNS_ZERO
+ /* Contributed by dwd@bell-labs.com for UTS 2.1.2, where the fcntl */
+ /* O_NDELAY flag causes read to return 0 when there's nothing */
+ /* available when reading from a pipe. That makes it tricky */
+ /* to detect end-of-file :-(. This stupid bug is even documented */
+ /* in the read(2) man page where it says that everything but */
+ /* pipes return -1 and EAGAIN. That makes it a feature, right? */
+ int afterselect = 0;
+#endif
if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length)
len = length - total_bytes_sent;
else
@@ -1728,8 +1737,15 @@
do {
n = ap_bread(fb, buf, len);
- if (n >= 0 || r->connection->aborted)
+#ifdef NDELAY_PIPE_RETURNS_ZERO
+ if ((n > 0) || (n == 0 && afterselect))
+ break;
+#else
+ if (n >= 0)
break;
+#endif
+ if (r->connection->aborted)
+ break;
if (n < 0 && errno != EAGAIN)
break;
/* we need to block, so flush the output first */
@@ -1742,6 +1758,9 @@
* around and try another read
*/
ap_select(fd + 1, &fds, NULL, NULL, NULL);
+#ifdef NDELAY_PIPE_RETURNS_ZERO
+ afterselect = 1;
+#endif
} while (!r->connection->aborted);
if (n < 1 || r->connection->aborted) {
1.119 +34 -3 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- util.c 1998/06/01 18:20:30 1.118
+++ util.c 1998/06/06 19:30:48 1.119
@@ -1397,7 +1397,35 @@
}
#endif
-
+/* The following routine was donated for UTS21 by dwd@bell-labs.com */
+#ifdef NEED_STRSTR
+char *strstr(char *s1, char *s2)
+{
+ char *p1, *p2;
+ if (*s2 == '\0') {
+ /* an empty s2 */
+ return(s1);
+ }
+ while((s1 = strchr(s1, *s2)) != NULL) {
+ /* found first character of s2, see if the rest matches */
+ p1 = s1;
+ p2 = s2;
+ while (*++p1 == *++p2) {
+ if (*p1 == '\0') {
+ /* both strings ended together */
+ return(s1);
+ }
+ }
+ if (*p2 == '\0') {
+ /* second string ended, a match */
+ break;
+ }
+ /* didn't find a match here, try starting at next character in s1 */
+ s1++;
+ }
+ return(s1);
+}
+#endif
#ifdef NEED_INITGROUPS
int initgroups(const char *name, gid_t basegid)
@@ -1433,7 +1461,8 @@
#ifdef NEED_WAITPID
/* From ikluft@amdahl.com
* this is not ideal but it works for SVR3 variants
- * httpd does not use the options so this doesn't implement them
+ * Modified by dwd@bell-labs.com to call wait3 instead of wait because
+ * apache started to use the WNOHANG option.
*/
int waitpid(pid_t pid, int *statusp, int options)
{
@@ -1442,7 +1471,9 @@
errno = ECHILD;
return -1;
}
- while (((tmp_pid = wait(statusp)) != pid) && (tmp_pid != -1));
+ while (((tmp_pid = wait3(statusp, options, 0)) != pid) &&
+ (tmp_pid != -1) && (tmp_pid != 0) && (pid != -1))
+ ;
return tmp_pid;
}
#endif