rbb         99/05/20 11:01:46

  Modified:    include  apr_network_io.h
               apr/test Makefile.in ab_apr.c
  Log:
  Correct mistake in apr_network_io.h, which would stop programs which needed 
both
  file and network def's to not compile.  Also finished bringing ab_apr.c up
  to the current apr level.
  
  Revision  Changes    Path
  1.20      +3 -3      apache-apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- apr_network_io.h  1999/05/19 15:17:16     1.19
  +++ apr_network_io.h  1999/05/20 18:01:34     1.20
  @@ -53,8 +53,8 @@
    *
    */
   
  -#ifndef APR_FILE_IO_H
  -#define APR_FILE_IO_H
  +#ifndef APR_NETWORK_IO_H
  +#define APR_NETWORK_IO_H
   
   #include "apr_general.h"
   #include "apr_errno.h"
  @@ -122,5 +122,5 @@
   }
   #endif
   
  -#endif  /* ! APR_FILE_IO_H */
  +#endif  /* ! APR_NETWORK_IO_H */
   
  
  
  
  1.6       +22 -16    apache-apr/apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/Makefile.in,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile.in       1999/05/19 16:37:56     1.5
  +++ Makefile.in       1999/05/20 18:01:39     1.6
  @@ -9,8 +9,8 @@
   CFLAGS=-DLINUX=20 -g -O2 
   LDLIBS= -ldl -lm -lpthread -L../network_io -lnetwork -L../threadproc 
-lthreadproc -L../file_io -lfile -L../misc -lmisc -L../lib -lapr -L../time 
-ltime -L../locks -llock
   LDFLAGS= $(LDLIBS)
  -INCDIR=../../include
  -INCDIR1=../../../include
  +INCDIR=../include
  +INCDIR1=../../include
   INCLUDES=-I$(INCDIR) -I$(INCDIR1) 
   
   TARGETS= testfile \
  @@ -75,17 +75,23 @@
            && rm Makefile.new
   
   # DO NOT REMOVE
  -ab_apr.o: ab_apr.c $(INCDIR)/apr_network_io.h \
  - $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h
  -client.o: client.c $(INCDIR)/apr_network_io.h \
  - $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h
  -server.o: server.c $(INCDIR)/apr_network_io.h \
  - $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h
  -testfile.o: testfile.c $(INCDIR)/apr_file_io.h \
  - $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h
  -testproc.o: testproc.c $(INCDIR)/apr_thread_proc.h \
  - $(INCDIR)/apr_file_io.h $(INCDIR)/apr_general.h \
  - $(INCDIR)/apr_errno.h
  -testsock.o: testsock.c $(INCDIR)/apr_thread_proc.h \
  - $(INCDIR)/apr_file_io.h $(INCDIR)/apr_general.h \
  - $(INCDIR)/apr_errno.h
  +ab_apr.o: ab_apr.c ../../include/apr_network_io.h \
  + ../../include/apr_general.h ../../include/apr_errno.h \
  + ../../include/apr_file_io.h
  +client.o: client.c ../../include/apr_network_io.h \
  + ../../include/apr_general.h ../../include/apr_errno.h
  +server.o: server.c ../../include/apr_network_io.h \
  + ../../include/apr_general.h ../../include/apr_errno.h
  +testfile.o: testfile.c ../../include/apr_file_io.h \
  + ../../include/apr_general.h ../../include/apr_errno.h
  +testproc.o: testproc.c ../../include/apr_thread_proc.h \
  + ../../include/apr_file_io.h ../../include/apr_general.h \
  + ../../include/apr_errno.h
  +testsock.o: testsock.c ../../include/apr_thread_proc.h \
  + ../../include/apr_file_io.h ../../include/apr_general.h \
  + ../../include/apr_errno.h
  +testthread.o: testthread.c ../../include/apr_thread_proc.h \
  + ../../include/apr_file_io.h ../../include/apr_general.h \
  + ../../include/apr_errno.h ../../include/apr_lock.h
  +testtime.o: testtime.c ../../include/apr_time.h \
  + ../../include/apr_general.h ../../include/apr_errno.h
  
  
  
  1.8       +14 -31    apache-apr/apr/test/ab_apr.c
  
  Index: ab_apr.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/ab_apr.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ab_apr.c  1999/05/19 16:37:56     1.7
  +++ ab_apr.c  1999/05/20 18:01:41     1.8
  @@ -103,27 +103,21 @@
   /* affects include files on Solaris */
   #define BSD_COMP
   
  +#include "apr_network_io.h"
  +#include "apr_file_io.h"
  +
   #include <sys/time.h>
   #include <sys/ioctl.h>
   #include <sys/stat.h>
  -#include <unistd.h>
   #include <stdlib.h>
   #include <stdio.h>
   #include <fcntl.h>
   /*#include <netinet/in.h> */
   #include <netdb.h>
  -#include <errno.h>
   #include <sys/ioctl.h>
   #include <string.h>
   
  -#include "apr_network_io.h"
   
  -/*#define ap_select       select */
  -/*#else  (!)NO_APACHE_INCLUDES */
  -/*#include "apr_config.h" */
  -/*#include <fcntl.h> */
  -/*#include <sys/time.h> */
  -/*#endif  NO_APACHE_INCLUDES */
   /* ------------------- DEFINITIONS -------------------------- */
   
   /* maximum number of requests on a time limited test */
  @@ -172,7 +166,7 @@
   char path[1024];             /* path name */
   char postfile[1024];         /* name of file containing post data */
   char *postdata;                      /* *buffer containing data from 
postfile */
  -int postlen = 0;             /* length of data to be POSTed */
  +ap_ssize_t postlen = 0;              /* length of data to be POSTed */
   char content_type[1024];     /* content type to put in POST header */
   int port = 80;                       /* port number */
   time_t aprtimeout = 30000;   /* timeout value... */
  @@ -245,17 +239,6 @@
   }
   
           /* --------------------------------------------------------- */
  -
  -        /* make an fd non blocking */
  -
  -static void nonblock(ap_socket_t * sock)
  -{
  -    int i = 1;
  -    /*ap_setsocketopt(sock, APR_SO_NONBLOCK, i); */
  -}
  -
  -        /* --------------------------------------------------------- */
  -
           /* returns the time in ms between two timevals */
   
   static int timedif(struct timeval a, struct timeval b)
  @@ -484,7 +467,6 @@
       if (ap_setport(cntxt, c->aprsock, port) == APR_FAILURE) {
           err("Port:");
       }
  -    nonblock(c->aprsock);
       gettimeofday(&c->start, 0);
       if (ap_connect(cntxt, c->aprsock, hostname) == APR_FAILURE) {
           if (errno == EINPROGRESS) {
  @@ -879,27 +861,28 @@
   
   static int open_postfile(char *pfile)
   {
  -    int postfd, status;
  +    ap_file_t *postfd;
  +    int status;
       struct stat postfilestat;
  +    ap_fileperms_t mode;
   
  -    if ((postfd = open(pfile, O_RDONLY)) == -1) {
  +    if ((postfd = ap_open(cntxt, pfile, APR_READ, mode)) == NULL) {
           printf("Invalid postfile name (%s)\n", pfile);
           return errno;
       }
  -    if ((status = fstat(postfd, &postfilestat)) == -1) {
  -        perror("Can\'t stat postfile\n");
  -        return status;
  -    }
  -    postdata = malloc(postfilestat.st_size);
  +
  +    /* No need to perform stat here, the apr_open will do it for us.  */  
  +
  +    postlen = ap_get_filesize(cntxt, postfd);
  +    postdata = malloc(postlen);
       if (!postdata) {
           printf("Can\'t alloc postfile buffer\n");
           return ENOMEM;
       }
  -    if (read(postfd, postdata, postfilestat.st_size) != 
postfilestat.st_size) {
  +    if (ap_read(cntxt, postfd, postdata, postlen) != postlen) {
           printf("error reading postfilen");
           return EIO;
       }
  -    postlen = postfilestat.st_size;
       return 0;
   }
   
  
  
  

Reply via email to