httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodent of Unusual Size <Ken.C...@Golux.Com>
Subject [PATCH] to fix UTS (PR#2320)
Date Sat, 30 May 1998 01:45:33 GMT
PR#2320 supplied a set of patches to fix 1.3b7 on UTS
(whatever that is).  They didn't apply with total smoothness
against HEAD, so I've fixed the problems and re-generated
them.

I have not done anything with the F_NDELAY versus O_NDELAY
issue mentioned in PR#2313.

I've got to leave, so can someone verify that these don't
break any other platforms, at least not obviously?  Yes, I
know it's a cop-out - but I really don't have time
to verify this.

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Index: src/CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.878
diff -u -r1.878 CHANGES
--- CHANGES	1998/05/29 20:45:53	1.878
+++ CHANGES	1998/05/30 01:27:50
@@ -1,5 +1,8 @@
 Changes with Apache 1.3b8
 
+  *) PORT: Fix brokenness (i.e., make it work) on UTS 2.1.2.
+     [Dave Dykstra <dwd@bell-labs.com>, Ken Coar] PR#2320
+
   *) Avoid problems with braindead Awks by additionally searching for gawk 
      and nawk in APACI's configure script.
      [Dave Dykstra <dwd@bell-labs.com>, Ralf S. Engelschall] PR#2319
Index: src/Configure
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.261
diff -u -r1.261 Configure
--- Configure	1998/05/12 12:13:50	1.261
+++ Configure	1998/05/30 01:27:51
@@ -620,8 +620,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'
Index: src/include/conf.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/conf.h,v
retrieving revision 1.212
diff -u -r1.212 conf.h
--- conf.h	1998/05/29 00:15:56	1.212
+++ conf.h	1998/05/30 01:27:52
@@ -567,13 +567,22 @@
 #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_POUND_BANG
+#define NEED_UNION_WAIT
+#define NDELAYPIPERETURNSZERO
+#define NO_DATA NO_ADDRESS
 #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
 #include <sys/types.h>
+#include <sys/time.h>     
 
 #elif defined(APOLLO)
 #undef HAVE_GMTOFF
Index: src/main/http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.357
diff -u -r1.357 http_main.c
--- http_main.c	1998/05/29 08:18:49	1.357
+++ http_main.c	1998/05/30 01:27:57
@@ -2213,7 +2213,17 @@
     }
     if (ret > 0) {
 	return ret;
+#ifdef NEED_WAITPID
+    if ((ret = reap_children(status)) > 0) {
+      return ret;
     }
+#endif
+    }
+#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);
Index: src/main/http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.217
diff -u -r1.217 http_protocol.c
--- http_protocol.c	1998/05/27 22:55:59	1.217
+++ http_protocol.c	1998/05/30 01:27:59
@@ -1721,6 +1721,15 @@
 
     FD_ZERO(&fds);
     while (!r->connection->aborted) {
+#ifdef NDELAYPIPERETURNSZERO
+      /* 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 NDELAYPIPERETURNSZERO
+          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 NDELAYPIPERETURNSZERO
+          afterselect = 1;
+#endif
         } while (!r->connection->aborted);
 
         if (n < 1 || r->connection->aborted) {
Index: src/main/util.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.117
diff -u -r1.117 util.c
--- util.c	1998/05/28 19:57:11	1.117
+++ util.c	1998/05/30 01:28:01
@@ -1393,7 +1393,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)
@@ -1429,7 +1457,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)
 {
@@ -1438,7 +1467,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

Mime
View raw message