You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Moenich <mo...@us.ibm.com> on 1998/10/12 18:30:31 UTC

[PATCH] TPF buff.c

TPF implementation of select, force processing of signals and typecast
ebcdic2ascii for TPF.

Index: buff.c
===================================================================
RCS file: /apache/apache/src/main/buff.c,v
retrieving revision 1.1.1.1
diff -a -b -C3 -r1.1.1.1 buff.c
*** buff.c      1998/10/12 09:15:41     1.1.1.1
--- buff.c      1998/10/12 09:18:10
***************
*** 259,264 ****
--- 259,279 ----
      }
      else
        rv = ap_read(fb, buf, nbyte);
+ #elif defined (TPF)
+     tpf_process_signals();
+     if (fb->flags & B_SOCKET) {
+         alarm(rv = alarm(0));
+         if (rv) {   /* add one second unless alarm was zero */
+             rv++;
+         }
+         rv *= 1000; /* alarm uses seconds, select uses milliseconds */
+         rv = ap_select(&fb->fd_in, 1, 0, 0, rv)
+         if (rv < 1) {
+             tpf_process_signals();
+             return(rv);
+         }
+     }
+     rv = ap_read(fb, buf, nbyte);
  #else
      rv = ap_read(fb, buf, nbyte);
  #endif /* WIN32 */
***************
*** 570,575 ****
--- 585,604 ----
  API_EXPORT(void) ap_bhalfduplex(BUFF *fb)
  {
      int rv;
+
+ #ifdef TPF
+     if (fb->incnt > 0 || fb->outcnt == 0) {
+     return;
+     }
+     /* test for a block */
+     do {
+         rv = ap_select(&fb->fd_in, 1, 0, 0, 0);
+     } while (rv < 0 && errno == EINTR);
+     /* treat any error as if it would block as well */
+     if (rv != 1) {
+     ap_bflush(fb);
+     }
+ #else
      fd_set fds;
      struct timeval tv;

***************
*** 593,598 ****
--- 622,628 ----
      if (rv != 1) {
        ap_bflush(fb);
      }
+ #endif /* TPF */
  }

  static ap_inline int saferead_guts(BUFF *fb, void *buf, int nbyte)
***************
*** 1107,1113 ****
--- 1137,1147 ----
      ap_snprintf(chunksize, sizeof(chunksize), "%x\015\012", nbyte);
  #ifdef CHARSET_EBCDIC
      /* Chunks are an HTTP/1.1 Protocol feature. They must ALWAYS be in ASCII
+ #ifdef TPF
+     ebcdic2ascii((unsigned char *)chunksize, (unsigned char *)chunksize, strl
+ #else
      ebcdic2ascii(chunksize, chunksize, strlen(chunksize));
+ #endif /* TPF */
  #endif /*CHARSET_EBCDIC*/
      if (write_it_all(fb, chunksize, strlen(chunksize)) == -1)
        return -1;

Joe Moenich
moenich@us.ibm.com
303 773-5483
tie-line 656-7487