You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/04/07 01:25:07 UTC

cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

rbb         00/04/06 16:25:07

  Modified:    src/lib/apr/file_io/unix filedup.c fileio.h filestat.c
                        open.c pipe.c readwrite.c seek.c
               src/lib/apr/include apr_file_io.h
               src/lib/apr/mmap/unix mmap.c
  Log:
  Remove all the buffered I/O code from APR.  APR supports buffered I/O only
  on platforms that only support FILE *'s, not ints.  Of course, this is
  only true on POSIX systems.  Other systems can do what they want.
  
  Revision  Changes    Path
  1.15      +3 -25     apache-2.0/src/lib/apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filedup.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- filedup.c	2000/04/03 19:44:30	1.14
  +++ filedup.c	2000/04/06 23:25:05	1.15
  @@ -80,35 +80,13 @@
       }
       
       (*new_file)->cntxt = old_file->cntxt; 
  -    if (old_file->buffered) {
  -        switch (old_file->oflags) {
  -            case O_RDONLY:
  -                buf_oflags = "r";
  -                break;
  -            case O_WRONLY:
  -                buf_oflags = "w";
  -                break;
  -            case O_RDWR:
  -                buf_oflags = "r+";
  -                break;
  -	    default:
  -		return APR_BADARG;
  -        }
  -        (*new_file)->filehand = freopen(old_file->fname, buf_oflags, 
  -                                        old_file->filehand); 
  -	if ((*new_file)->filehand == NULL)
  -	    return errno;
  +    if (have_file) {
  +        dup2(old_file->filedes, (*new_file)->filedes);
       }
       else {
  -        if (have_file) {
  -            dup2(old_file->filedes, (*new_file)->filedes);
  -        }
  -        else {
  -            (*new_file)->filedes = dup(old_file->filedes); 
  -        }
  +        (*new_file)->filedes = dup(old_file->filedes); 
       }
       (*new_file)->fname = ap_pstrdup(old_file->cntxt, old_file->fname);
  -    (*new_file)->buffered = old_file->buffered;
       ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup,
                           ap_null_cleanup);
       return APR_SUCCESS;
  
  
  
  1.14      +0 -2      apache-2.0/src/lib/apr/file_io/unix/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileio.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- fileio.h	2000/04/06 21:38:04	1.13
  +++ fileio.h	2000/04/06 23:25:05	1.14
  @@ -103,10 +103,8 @@
   struct ap_file_t {
       ap_context_t *cntxt;
       int filedes;
  -    FILE *filehand;
       char * fname;
       int oflags;
  -    int buffered;
       int eof_hit;
       int pipe;
       int timeout;
  
  
  
  1.21      +1 -7      apache-2.0/src/lib/apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filestat.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- filestat.c	2000/04/06 16:11:33	1.20
  +++ filestat.c	2000/04/06 23:25:05	1.21
  @@ -94,13 +94,7 @@
       if (finfo == NULL || thefile == NULL)
           return APR_EBADARG;
   
  -    if (thefile->filehand == NULL) {
  -        rv = fstat(thefile->filedes, &info);
  -    } else {
  -        rv = stat(thefile->fname, &info);
  -    }
  -
  -    if (rv == 0) {
  +    if ((rv = fstat(thefile->filedes, &info)) == 0) {
           finfo->protection = info.st_mode;
           finfo->filetype = filetype_from_mode(info.st_mode);
           finfo->user = info.st_uid;
  
  
  
  1.41      +11 -53    apache-2.0/src/lib/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- open.c	2000/04/06 21:38:05	1.40
  +++ open.c	2000/04/06 23:25:05	1.41
  @@ -60,16 +60,10 @@
       ap_file_t *file = thefile;
       int rv;
   
  -    if (file->buffered) {
  -        rv = fclose(file->filehand);
  -    }
  -    else {
  -        rv = close(file->filedes);
  -    }
  +    rv = close(file->filedes);
   
       if (rv == 0) {
           file->filedes = -1;
  -        file->filehand = NULL;
           return APR_SUCCESS;
       }
       else {
  @@ -115,31 +109,20 @@
       (*new)->cntxt = cont;
       (*new)->oflags = oflags;
       (*new)->filedes = -1;
  -    (*new)->filehand = NULL;
  -    (*new)->ungetchar = -1;
   
       if ((flag & APR_READ) && (flag & APR_WRITE)) {
  -        buf_oflags = ap_pstrdup(cont, "r+");
           oflags = O_RDWR;
       }
       else if (flag & APR_READ) {
  -        buf_oflags = ap_pstrdup(cont, "r");
           oflags = O_RDONLY;
       }
       else if (flag & APR_WRITE) {
  -        buf_oflags = ap_pstrdup(cont, "w");
           oflags = O_WRONLY;
       }
       else {
           return APR_EACCES; 
       }
   
  -    if (flag & APR_BUFFERED) {
  -        (*new)->buffered = TRUE;
  -    }
  -    else {
  -        (*new)->buffered = FALSE;
  -    }
       (*new)->fname = ap_pstrdup(cont, fname);
   
       if (flag & APR_CREATE) {
  @@ -153,26 +136,20 @@
       }   
   
       if (flag & APR_APPEND) {
  -        buf_oflags[0] = 'a';
           oflags |= O_APPEND;
       }
       if (flag & APR_TRUNCATE) {
           oflags |= O_TRUNC;
       }
       
  -    if ((*new)->buffered) {
  -        (*new)->filehand = fopen(fname, buf_oflags);
  +    if (perm == APR_OS_DEFAULT) {
  +        (*new)->filedes = open(fname, oflags, 0777);
       }
  -    else { 
  -        if (perm == APR_OS_DEFAULT) {
  -            (*new)->filedes = open(fname, oflags, 0777);
  -        }
  -        else {
  -            (*new)->filedes = open(fname, oflags, get_fileperms(perm));
  -        }    
  -    }
  +    else {
  +        (*new)->filedes = open(fname, oflags, get_fileperms(perm));
  +    }    
   
  -    if ((*new)->filedes < 0 && (*new)->filehand == NULL) {
  +    if ((*new)->filedes < 0) {
          (*new)->filedes = -1;
          (*new)->eof_hit = 1;
          return errno;
  @@ -243,12 +220,7 @@
           return APR_ENOFILE;
       }
   
  -    if (file->buffered) {
  -        *thefile = fileno(file->filehand);
  -    }
  -    else {
  -        *thefile = file->filedes;
  -    }
  +    *thefile = file->filedes;
       return APR_SUCCESS;
   }
   
  @@ -274,11 +246,6 @@
           (*file) = ap_pcalloc(cont, sizeof(ap_file_t));
           (*file)->cntxt = cont;
       }
  -    /* if we are putting in a new file descriptor, then we don't really
  -     * have any of this information.
  -     * We don't allow put'ing buffered files, so we can set that value.
  -     */
  -    (*file)->buffered = 0;
       (*file)->eof_hit = 0;
       (*file)->timeout = -1;
       (*file)->filedes = *dafile;
  @@ -296,12 +263,6 @@
       if (fptr == NULL)
           return APR_EBADARG;
   
  -    if (fptr->buffered) {
  -        if (feof(fptr->filehand) == 0) {
  -            return APR_SUCCESS;
  -        }
  -        return APR_EOF;
  -    }
       if (fptr->eof_hit == 1) {
           return APR_EOF;
       }
  @@ -316,13 +277,12 @@
    */
   ap_status_t ap_ferror(ap_file_t *fptr)
   {
  +/* Thist function should be removed ASAP.  It is next on my list once
  + * I am sure nobody is using it.
  + */
       if (fptr == NULL)
           return APR_EBADARG;
   
  -    if (ferror(fptr->filehand)) {
  -        return (-1);
  -    }
  -
       return APR_SUCCESS;
   }   
   
  @@ -344,8 +304,6 @@
       (*thefile)->filedes = STDERR_FILENO;
       (*thefile)->cntxt = cont;
       (*thefile)->fname = NULL;
  -    (*thefile)->filehand = NULL;
  -    (*thefile)->buffered = 0;
       (*thefile)->eof_hit = 0;
   
       return APR_SUCCESS;
  
  
  
  1.22      +0 -2      apache-2.0/src/lib/apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/pipe.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- pipe.c	2000/04/06 16:11:33	1.21
  +++ pipe.c	2000/04/06 23:25:05	1.22
  @@ -118,7 +118,6 @@
       (*in) = (ap_file_t *)ap_palloc(cont, sizeof(ap_file_t));
       (*in)->cntxt = cont;
       (*in)->filedes = filedes[0];
  -    (*in)->buffered = 0;
       (*in)->pipe = 1;
       (*in)->fname = ap_pstrdup(cont, "PIPE");
       (*in)->timeout = -1;
  @@ -126,7 +125,6 @@
       (*out) = (ap_file_t *)ap_palloc(cont, sizeof(ap_file_t));
       (*out)->cntxt = cont;
       (*out)->filedes = filedes[1];
  -    (*out)->buffered = 0;
       (*out)->pipe = 1;
       (*out)->fname = ap_pstrdup(cont, "PIPE");
       (*out)->timeout = -1;
  
  
  
  1.34      +48 -116   apache-2.0/src/lib/apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- readwrite.c	2000/04/06 21:38:05	1.33
  +++ readwrite.c	2000/04/06 23:25:05	1.34
  @@ -101,50 +101,39 @@
       if(thefile == NULL || nbytes == NULL || (buf == NULL && *nbytes != 0))
           return APR_EBADARG;
   
  -    if (thefile->filedes < 0 && !thefile->buffered) {
  -        *nbytes = 0;
  -        return APR_EBADF;
  -    }
  -    
       if(*nbytes <= 0) {
           *nbytes = 0;
   	return APR_SUCCESS;
       }
   
  -    if (thefile->buffered) {
  -        rv = fread(buf, 1, *nbytes, thefile->filehand);
  +    if (thefile->ungetchar != -1) {
  +        used_unget = TRUE;
  +        *(char *)buf++ = (char)thefile->ungetchar;
  +        (*nbytes)--;
  +        thefile->ungetchar == -1;
       }
  -    else {
  -        if(thefile->ungetchar != -1){
  -	  used_unget = TRUE;
  -	  *(char *)buf++ = (char)thefile->ungetchar;
  -	  (*nbytes)--;
  -          thefile->ungetchar == -1;
  -	}
   	  
  -        do {
  -            rv = read(thefile->filedes, buf, *nbytes);
  -        } while (rv == -1 && errno == EINTR);
  -
  -        if (rv == -1 && errno == EAGAIN && thefile->timeout != 0) {
  -            ap_status_t arv = wait_for_io_or_timeout(thefile, 1);
  -            if (arv != APR_SUCCESS) {
  -                *nbytes = 0;
  -                return arv;
  -            }
  -            else {
  -                do {
  -                    rv = read(thefile->filedes, buf, *nbytes);
  -                } while (rv == -1 && errno == EINTR);
  -            }
  -        }  
  -    }  /* buffered? */
  -
  +    do {
  +        rv = read(thefile->filedes, buf, *nbytes);
  +    } while (rv == -1 && errno == EINTR);
  +
  +    if (rv == -1 && errno == EAGAIN && thefile->timeout != 0) {
  +        ap_status_t arv = wait_for_io_or_timeout(thefile, 1);
  +        if (arv != APR_SUCCESS) {
  +            *nbytes = 0;
  +            return arv;
  +        }
  +        else {
  +            do {
  +                rv = read(thefile->filedes, buf, *nbytes);
  +            } while (rv == -1 && errno == EINTR);
  +        }
  +    }  
       /* getting less data than requested does not signify an EOF when
          dealing with a pipe.
        */
       if ((*nbytes != rv) && ((errno == EPIPE && thefile->pipe == 1)
  -        || (errno != EINTR && !thefile->buffered && thefile->pipe == 0 ))) {
  +        || (errno != EINTR && thefile->pipe == 0 ))) {
           thefile->eof_hit = 1;
       }
       if (rv == -1) {
  @@ -152,9 +141,9 @@
           return errno;
       }
       *nbytes = rv;
  -    if(used_unget){
  -      thefile->ungetchar = -1;
  -      *nbytes += 1;
  +    if (used_unget) {
  +        thefile->ungetchar = -1;
  +        *nbytes += 1;
       }
       return APR_SUCCESS;
   }
  @@ -176,33 +165,23 @@
   
       if(thefile == NULL || nbytes == NULL || (buf == NULL && *nbytes != 0))
           return APR_EBADARG;
  -
  -    if (thefile->filedes < 0 && !thefile->buffered) {
  -        *nbytes = 0;
  -        return APR_EBADF;
  -    }
   
  -    if (thefile->buffered) {
  -        rv = fwrite(buf, *nbytes, 1, thefile->filehand);
  -    }
  -    else {
  -        do {
  -            rv = write(thefile->filedes, buf, *nbytes);
  -        } while (rv == -1 && errno == EINTR);
  -
  -        if (rv == -1 && errno == EAGAIN && thefile->timeout != 0) {
  -            ap_status_t arv = wait_for_io_or_timeout(thefile, 0);
  -            if (arv != APR_SUCCESS) {
  -                *nbytes = 0;
  -                return arv;
  -            }
  -            else {
  -                do {
  -                    rv = write(thefile->filedes, buf, *nbytes);
  -                } while (rv == -1 && errno == EINTR);
  -            }
  -        }  
  -    }   /* BUFFERED ?? */
  +    do {
  +        rv = write(thefile->filedes, buf, *nbytes);
  +    } while (rv == -1 && errno == EINTR);
  +
  +    if (rv == -1 && errno == EAGAIN && thefile->timeout != 0) {
  +        ap_status_t arv = wait_for_io_or_timeout(thefile, 0);
  +        if (arv != APR_SUCCESS) {
  +            *nbytes = 0;
  +            return arv;
  +        }
  +        else {
  +            do {
  +                rv = write(thefile->filedes, buf, *nbytes);
  +            } while (rv == -1 && errno == EINTR);
  +        }
  +    }  
   
       if (rv == -1) {
           (*nbytes) = 0;
  @@ -254,12 +233,6 @@
       if(thefile == NULL)
           return APR_EBADARG;
   
  -    if (thefile->buffered) {
  -        if (fputc(ch, thefile->filehand) == ch) {
  -            return APR_SUCCESS;
  -        }
  -        return errno;
  -    }
       if (write(thefile->filedes, &ch, 1) != 1) {
           return errno;
       }
  @@ -277,14 +250,7 @@
       if(thefile == NULL)
           return APR_EBADARG;
   
  -    if (thefile->buffered) {
  -        if (ungetc(ch, thefile->filehand) == ch) {
  -            return APR_SUCCESS;
  -        }
  -        return errno;
  -    } else {
  -        thefile->ungetchar = (unsigned char)ch;
  -    }
  +    thefile->ungetchar = (unsigned char)ch;
       return APR_SUCCESS; 
   }
   
  @@ -301,22 +267,7 @@
       if(thefile == NULL || ch == NULL)
           return APR_EBADARG;
   
  -    if (thefile->buffered) {
  -        int r;
  -
  -	r=fgetc(thefile->filehand);
  -	if(r != EOF)
  -	    {
  -	    *ch=(char)r;
  -	    return APR_SUCCESS;
  -	    }
  -        if (feof(thefile->filehand)) {
  -            return APR_EOF;
  -        }
  -        return errno;
  -    }
  -    
  -    if(thefile->ungetchar != -1){
  +    if (thefile->ungetchar != -1) {
           *ch = (char) thefile->ungetchar;
           thefile->ungetchar = -1;
           return APR_SUCCESS;
  @@ -346,12 +297,6 @@
       if(thefile == NULL || str == NULL)
           return APR_EBADARG;
   
  -    if (thefile->buffered) {
  -        if (fputs(str, thefile->filehand)) {
  -            return APR_SUCCESS;
  -        }
  -        return errno;
  -    }
       len = strlen(str);
       rv = write(thefile->filedes, str, len); 
       if (rv != len) {
  @@ -367,15 +312,12 @@
    */
   ap_status_t ap_flush(ap_file_t *thefile)
   {
  +/* Another function to get rid of once we finish removing buffered I/O
  + * and we are sure nobody is using it.
  + */
       if(thefile == NULL)
           return APR_EBADARG;
   
  -    if (thefile->buffered) {
  -        if (!fflush(thefile->filehand)) {
  -            return APR_SUCCESS;
  -        }
  -        return errno;
  -    }
       /* There isn't anything to do if we aren't buffering the output
        * so just return success.
        */
  @@ -400,16 +342,6 @@
       if(len <= 1)  /* as per fgets() */
           return APR_SUCCESS;
   
  -    if (thefile->buffered) {
  -        if (fgets(str, len, thefile->filehand)) {
  -            return APR_SUCCESS;
  -        }
  -        if (feof(thefile->filehand)) {
  -            return APR_EOF;
  -        }
  -        return errno;
  -    }
  -
       if(thefile->ungetchar != -1){
           str[0] = thefile->ungetchar;
   	used_unget = TRUE;
  @@ -436,8 +368,8 @@
           if (str[i] == '\n' || str[i] == '\r')
               break;
       }
  -    if(i < len-1)
  -      str[i+1] = '\0';
  +    if (i < len-1)
  +        str[i+1] = '\0';
       return APR_SUCCESS; 
   }
   
  
  
  
  1.9       +1 -6      apache-2.0/src/lib/apr/file_io/unix/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/seek.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- seek.c	2000/04/03 19:44:31	1.8
  +++ seek.c	2000/04/06 23:25:05	1.9
  @@ -70,12 +70,7 @@
   ap_status_t ap_seek(ap_file_t *thefile, ap_seek_where_t where, ap_off_t *offset)
   {
       ap_off_t rv;
  -    if (thefile->buffered) {
  -        rv = fseek(thefile->filehand, *offset, where);
  -    }
  -    else {
  -        rv = lseek(thefile->filedes, *offset, where);
  -    }
  +    rv = lseek(thefile->filedes, *offset, where);
       if (rv == -1) {
           *offset = -1;
           return errno;
  
  
  
  1.39      +1 -2      apache-2.0/src/lib/apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- apr_file_io.h	2000/04/03 18:37:05	1.38
  +++ apr_file_io.h	2000/04/06 23:25:06	1.39
  @@ -76,8 +76,7 @@
   #define APR_APPEND     8           /* Append to the end of the file */
   #define APR_TRUNCATE   16          /* Open the file and truncate to 0 length */
   #define APR_BINARY     32          /* Open the file in binary mode */
  -#define APR_BUFFERED   64          /* Buffer the data when reading or writing */
  -#define APR_EXCL       128         /* Open should fail if APR_CREATE and file
  +#define APR_EXCL       64          /* Open should fail if APR_CREATE and file
   				    exists. */
   #define APR_DELONCLOSE 256         /* Delete the file after close */
   
  
  
  
  1.15      +1 -1      apache-2.0/src/lib/apr/mmap/unix/mmap.c
  
  Index: mmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/mmap.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- mmap.c	2000/04/03 19:45:01	1.14
  +++ mmap.c	2000/04/06 23:25:07	1.15
  @@ -90,7 +90,7 @@
   {
       caddr_t mm;
      
  -    if (file == NULL || file->buffered || file->filedes == -1)
  +    if (file == NULL || file->filedes == -1)
           return APR_EBADF;
   
       (*new) = (ap_mmap_t *)ap_palloc(cont, sizeof(ap_mmap_t));
  
  
  

Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Ben Laurie <be...@algroup.co.uk>.
dean gaudet wrote:
> 
> On Fri, 7 Apr 2000 rbb@apache.org wrote:
> 
> > I just can't see a good reason to support buffering in multiple places in
> > Apache/APR.  If we have everything use BUFF's, then we can remove a lot of
> > the ugly read/write code in APR, and we have a common usable way to
> > read/write files/networks/foo in the server.
> 
> in apache-nspr everything used BUFF, and FILE * was verboten.
> 
> given that FILE * sucks on solaris this is the only stance which makes
> sense.  (unsigned char for fd limits FILE * to 256 fds on solaris)
> 
> On Fri, 7 Apr 2000, Rodent of Unusual Size wrote:
> 
> > So if some other APR client needs buffering, *two* projects get
> > affected: APR and the HTTP server.  Oh, well.
> 
> unfortunately, the BUFF layer knows about chunking, and you can't pull
> that out of it easily at all.

Hmm. So both APR and HTTP have to implement it. Would sfio(-style) stuff
help?

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by dean gaudet <dg...@arctic.org>.
On Fri, 7 Apr 2000 rbb@apache.org wrote:

> I just can't see a good reason to support buffering in multiple places in
> Apache/APR.  If we have everything use BUFF's, then we can remove a lot of
> the ugly read/write code in APR, and we have a common usable way to
> read/write files/networks/foo in the server.

in apache-nspr everything used BUFF, and FILE * was verboten.

given that FILE * sucks on solaris this is the only stance which makes
sense.  (unsigned char for fd limits FILE * to 256 fds on solaris)

On Fri, 7 Apr 2000, Rodent of Unusual Size wrote:

> So if some other APR client needs buffering, *two* projects get
> affected: APR and the HTTP server.  Oh, well.

unfortunately, the BUFF layer knows about chunking, and you can't pull
that out of it easily at all.

-dean


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by rb...@apache.org.
On Fri, 7 Apr 2000, Rodent of Unusual Size wrote:

> rbb@apache.org wrote:
> > 
> > No, but if you review the thread about removing the buffering from
> > APR, then you'll see that Greg proposed removing it, and if somebody
> > needed buffering later, we could move the BUFF stuff to APR later.
> 
> So if some other APR client needs buffering, *two* projects get
> affected: APR and the HTTP server.  Oh, well.

Better that we buffer in multiple places?  Would you rather we moved the
buffering down to APR now?

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
rbb@apache.org wrote:
> 
> No, but if you review the thread about removing the buffering from
> APR, then you'll see that Greg proposed removing it, and if somebody
> needed buffering later, we could move the BUFF stuff to APR later.

So if some other APR client needs buffering, *two* projects get
affected: APR and the HTTP server.  Oh, well.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Ben Laurie <be...@algroup.co.uk>.
rbb@apache.org wrote:
> 
> On Fri, 7 Apr 2000, Rodent of Unusual Size wrote:
> 
> > rbb@apache.org wrote:
> > >
> > > I just can't see a good reason to support buffering in multiple
> > > places in Apache/APR.
> >
> > Ah, so APR is just a minion of the HTTP server again, eh?
> 
> No, but if you review the thread about removing the buffering from APR,
> then you'll see that Greg proposed removing it, and if somebody needed
> buffering later, we could move the BUFF stuff to APR later.

Seems to me that buffering is clearly a common requirement. There's no
point saying "if somebody needed buffering later". Everyone needs it.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by rb...@apache.org.
On Fri, 7 Apr 2000, Rodent of Unusual Size wrote:

> rbb@apache.org wrote:
> > 
> > I just can't see a good reason to support buffering in multiple
> > places in Apache/APR.
> 
> Ah, so APR is just a minion of the HTTP server again, eh?

No, but if you review the thread about removing the buffering from APR,
then you'll see that Greg proposed removing it, and if somebody needed
buffering later, we could move the BUFF stuff to APR later.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
rbb@apache.org wrote:
> 
> I just can't see a good reason to support buffering in multiple
> places in Apache/APR.

Ah, so APR is just a minion of the HTTP server again, eh?
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

[Patch] Build 2.0 cleanups (very short)

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
Not too long so I tossed these inline, here are the incomplete thoughts to
cleanup from recent patches.  Mostly missing declaration emits, but a few
like ap_file_t -> ap_finfo_t bugs and a leftover ap_slack declaration as
well.

Bill

Index: apache-2.0/src/lib/apr/aprlib.def
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/aprlib.def,v
retrieving revision 1.17
diff -u -r1.17 aprlib.def
--- aprlib.def	2000/04/07 02:16:55	1.17
+++ aprlib.def	2000/04/07 14:24:14
@@ -241,3 +241,5 @@
         ap_dso_unload @220
         ap_dso_sym @221
         ap_dso_init @222
+	ap_month_snames @223
+	ap_day_snames @224
Index: apache-2.0/src/lib/apr/file_io/win32/filestat.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/file_io/win32/filestat.c,v
retrieving revision 1.12
diff -u -r1.12 filestat.c
--- filestat.c	2000/04/05 03:55:57	1.12
+++ filestat.c	2000/04/07 14:24:16
@@ -117,9 +117,9 @@
         finfo->group = info.st_gid;
         finfo->size = info.st_size;
         finfo->inode = info.st_ino;
-        ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
-        ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
-        ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
+        finfo->atime = info.st_atime;
+        finfo->mtime = info.st_mtime;
+        finfo->ctime = info.st_ctime;
         return APR_SUCCESS;
     }
     else {
Index: apache-2.0/src/lib/apr/include/apr_lib.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/include/apr_lib.h,v
retrieving revision 1.24
diff -u -r1.24 apr_lib.h
--- apr_lib.h	2000/04/03 18:37:07	1.24
+++ apr_lib.h	2000/04/07 14:24:18
@@ -132,7 +132,6 @@
                                     char *arg_str, char ***argv_out);
 API_EXPORT(const char *) ap_filename_of_pathname(const char *pathname);
 /*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/
-API_EXPORT(int) ap_slack(int l, int h);
 API_EXPORT_NONSTD(ap_status_t) ap_execle(const char *c, const char *a,
...);
 API_EXPORT_NONSTD(ap_status_t) ap_execve(const char *c, const char *argv[],
 				  const char *envp[]);
Index: apache-2.0/src/include/http_config.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/include/http_config.h,v
retrieving revision 1.11
diff -u -r1.11 http_config.h
--- http_config.h	2000/03/31 07:18:56	1.11
+++ http_config.h	2000/04/07 14:24:12
@@ -341,6 +341,7 @@
 void ap_child_init_hook(ap_context_t *pchild, server_rec *s);
 void ap_register_hooks(module *m);
 void ap_hook_deregister_all(void);
+void run_pre_config(ap_context_t *p, ap_context_t *plog, ap_context_t
*ptemp);
-
 /* For http_request.c... */

 void *ap_create_request_config(ap_context_t *p);Index:
apache-2.0/src/lib/apr/lib/apr_pools.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/lib/apr_pools.c,v
retrieving revision 1.41
diff -u -r1.41 apr_pools.c
--- apr_pools.c	2000/04/03 19:44:44	1.41
+++ apr_pools.c	2000/04/07 14:24:25
@@ -65,6 +65,7 @@
 #include "apr_pools.h"
 #include "apr_lib.h"
 #include "apr_lock.h"
+#include "apr_portable.h"
 #include "misc.h"

 #ifdef HAVE_SYS_STAT_H
@@ -166,9 +167,6 @@
 #define BLOCK_MINFREE	0
 #define BLOCK_MINALLOC	0
 #endif /* ALLOC_USE_MALLOC */
-
-#define AP_SLACK_LOW    1
-#define AP_SLACK_HIGH   2


 /*****************************************************************
Index: apache-2.0/src/lib/apr/misc/win32/start.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/misc/win32/start.c,v
retrieving revision 1.19
diff -u -r1.19 start.c
--- start.c	2000/04/07 03:07:50	1.19
+++ start.c	2000/04/07 14:24:26
@@ -60,6 +60,7 @@
 #include "apr_lib.h"
 #include <string.h>
 #include <process.h>
+#include <stdlib.h>

 ap_status_t clean_cont(void *data)
 {
Index: apache-2.0/src/modules/standard/mod_speling.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_speling.c,v
retrieving revision 1.11
diff -u -r1.11 mod_speling.c
--- mod_speling.c	2000/03/31 09:05:18	1.11
+++ mod_speling.c	2000/04/07 14:25:05
@@ -64,6 +64,7 @@
 #include "http_request.h"
 #include "http_log.h"
 #include "apr_file_io.h"
+#include <stdlib.h>

 /* mod_speling.c - by Alexei Kosut <ak...@organic.com> June, 1996
  *
Index: apache-2.0/src/modules/standard/mod_usertrack.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_usertrack.c,v
retrieving revision 1.12
diff -u -r1.12 mod_usertrack.c
--- mod_usertrack.c	2000/03/31 09:05:19	1.12
+++ mod_usertrack.c	2000/04/07 14:25:07
@@ -104,6 +104,7 @@
 #include "http_config.h"
 #include "http_core.h"
 #include "http_request.h"
+#include <stdlib.h>

 module MODULE_VAR_EXPORT usertrack_module;



Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by rb...@covalent.net.
On Sun, 9 Apr 2000, Greg Stein wrote:

> Ryan -- you've been going nuts lately, identifying a whole ton of issues.
> I'm losing track :-). Any chance that you could also put your ideas into
> the STATUS file? Other people may want to jump in one some of the things
> that you've identified.

Good thought.  I'll put some stuff in the STATUS file tomorrow.  I'm busy
relaxing and NOT coding today.  :-)

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Greg Stein <gs...@lyra.org>.
Ryan -- you've been going nuts lately, identifying a whole ton of issues.
I'm losing track :-). Any chance that you could also put your ideas into
the STATUS file? Other people may want to jump in one some of the things
that you've identified.

Cheers,
-g

On Fri, 7 Apr 2000 rbb@apache.org wrote:
> > >The general feeling was that Apache is doing the buffering with the BUFF
> > >code, and we don't need to do buffering twice in Apache (once in Apache
> > >and once in APR).
> > 
> > Yes, BUFF is used for files being served but ap_fgets is used for things
> > like reading config files & without buffering you end up with a read()
> > syscall or the platform equivalent for every individual byte. This may or
> > may not have a noticable impact on performance in Apache (mod_auth may),
> > you'd have to do some benchmarking to find out.
> 
> I know this is an issue.  I have plans to get rid of this and use ap_read
> and ap_write instead of ap_fgets and ap_fgetch.  This may take a few days
> to finish though.
> 
> I just can't see a good reason to support buffering in multiple places in
> Apache/APR.  If we have everything use BUFF's, then we can remove a lot of
> the ugly read/write code in APR, and we have a common usable way to
> read/write files/networks/foo in the server.
> 
> Ryan
> 
> 
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
> 

-- 
Greg Stein, http://www.lyra.org/


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by rb...@apache.org.
> >The general feeling was that Apache is doing the buffering with the BUFF
> >code, and we don't need to do buffering twice in Apache (once in Apache
> >and once in APR).
> 
> Yes, BUFF is used for files being served but ap_fgets is used for things
> like reading config files & without buffering you end up with a read()
> syscall or the platform equivalent for every individual byte. This may or
> may not have a noticable impact on performance in Apache (mod_auth may),
> you'd have to do some benchmarking to find out.

I know this is an issue.  I have plans to get rid of this and use ap_read
and ap_write instead of ap_fgets and ap_fgetch.  This may take a few days
to finish though.

I just can't see a good reason to support buffering in multiple places in
Apache/APR.  If we have everything use BUFF's, then we can remove a lot of
the ugly read/write code in APR, and we have a common usable way to
read/write files/networks/foo in the server.

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Fri, 7 Apr 2000 00:34:33 -0400 (EDT), rbb@apache.org wrote:

>> For OS/2 I implemented buffered I/O entirely within APR, not using FILE *.
>> The same approach would work on other platforms. You could even just use
>> the same code & switch the OS/2 API calls to whatever's best on each
>> platform.
>> 
>> If you like I can do this for unix & Win32. Note that the code I used was
>> derived from a C++ class I've been using in my own projects for several
>> years so it should be fairly solid (though I could have broken something in
>> the C++->C conversion...).
>
>The general feeling was that Apache is doing the buffering with the BUFF
>code, and we don't need to do buffering twice in Apache (once in Apache
>and once in APR).

Yes, BUFF is used for files being served but ap_fgets is used for things
like reading config files & without buffering you end up with a read()
syscall or the platform equivalent for every individual byte. This may or
may not have a noticable impact on performance in Apache (mod_auth may),
you'd have to do some benchmarking to find out.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by rb...@apache.org.
> >rbb         00/04/06 16:25:07
> >
> >  Modified:    src/lib/apr/file_io/unix filedup.c fileio.h filestat.c
> >                        open.c pipe.c readwrite.c seek.c
> >               src/lib/apr/include apr_file_io.h
> >               src/lib/apr/mmap/unix mmap.c
> >  Log:
> >  Remove all the buffered I/O code from APR.  APR supports buffered I/O only
> >  on platforms that only support FILE *'s, not ints.  Of course, this is
> >  only true on POSIX systems.  Other systems can do what they want.
> 
> For OS/2 I implemented buffered I/O entirely within APR, not using FILE *.
> The same approach would work on other platforms. You could even just use
> the same code & switch the OS/2 API calls to whatever's best on each
> platform.
> 
> If you like I can do this for unix & Win32. Note that the code I used was
> derived from a C++ class I've been using in my own projects for several
> years so it should be fairly solid (though I could have broken something in
> the C++->C conversion...).

The general feeling was that Apache is doing the buffering with the BUFF
code, and we don't need to do buffering twice in Apache (once in Apache
and once in APR).

I personally would like to just get buffering out of APR all together.  It
messes up the code, and I don't think we need it.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix mmap.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On 6 Apr 2000 23:25:07 -0000, rbb@locus.apache.org wrote:

>rbb         00/04/06 16:25:07
>
>  Modified:    src/lib/apr/file_io/unix filedup.c fileio.h filestat.c
>                        open.c pipe.c readwrite.c seek.c
>               src/lib/apr/include apr_file_io.h
>               src/lib/apr/mmap/unix mmap.c
>  Log:
>  Remove all the buffered I/O code from APR.  APR supports buffered I/O only
>  on platforms that only support FILE *'s, not ints.  Of course, this is
>  only true on POSIX systems.  Other systems can do what they want.

For OS/2 I implemented buffered I/O entirely within APR, not using FILE *.
The same approach would work on other platforms. You could even just use
the same code & switch the OS/2 API calls to whatever's best on each
platform.

If you like I can do this for unix & Win32. Note that the code I used was
derived from a C++ class I've been using in my own projects for several
years so it should be fairly solid (though I could have broken something in
the C++->C conversion...).

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------