apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: apr-util/buckets apr_buckets_file.c
Date Sat, 11 May 2002 23:10:24 GMT
brianp      02/05/11 16:10:24

  Modified:    .        CHANGES
               include  apr_buckets.h
               buckets  apr_buckets_file.c
  Log:
  Added a mechanism to prevent mmap of file buckets
  
  Revision  Changes    Path
  1.65      +9 -0      apr-util/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr-util/CHANGES,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- CHANGES	9 May 2002 16:37:38 -0000	1.64
  +++ CHANGES	11 May 2002 23:10:24 -0000	1.65
  @@ -1,5 +1,14 @@
   Changes with APR-util b1  
   
  +  *) Added apr_bucket_file_enable_mmap() function to the bucket
  +     API to let an application control whether a file bucket may
  +     be turned into an mmap bucket upon read.  (The default remains
  +     to do the mmap, but this function lets the app prevent the
  +     mmap in contexts where mmap would be a bad idea.  Examples
  +     include multiprocessors where mmap doesn't scale well and
  +     NFS-mounted filesystems where a bus error can result if
  +     a memory-mapped file is removed or truncated.) [Brian Pane]
  +
     *) Added string-matching API (apr_strmatch.h)  [Brian Pane]
   
     *) Rearrange INCLUDES so that APRUTIL_PRIV_INCLUDES is always
  
  
  
  1.136     +16 -0     apr-util/include/apr_buckets.h
  
  Index: apr_buckets.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
  retrieving revision 1.135
  retrieving revision 1.136
  diff -u -r1.135 -r1.136
  --- apr_buckets.h	1 Apr 2002 05:41:39 -0000	1.135
  +++ apr_buckets.h	11 May 2002 23:10:24 -0000	1.136
  @@ -612,6 +612,11 @@
       /** The pool into which any needed structures should
        *  be created while reading from this file bucket */
       apr_pool_t *readpool;
  +#if APR_HAS_MMAP
  +    /** Whether this bucket should be memory-mapped if
  +     *  a caller tries to read from it */
  +    int can_mmap;
  +#endif /* APR_HAS_MMAP */
   };
   
   typedef union apr_bucket_structs apr_bucket_structs;
  @@ -1374,6 +1379,17 @@
   APU_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
                                                  apr_off_t offset,
                                                  apr_size_t len, apr_pool_t *p);
  +
  +#if APR_HAS_MMAP
  +/**
  + * Enable or disable memory-mapping for a FILE bucket (default is enabled)
  + * @param b The bucket
  + * @param enable Whether memory-mapping should be enabled
  + * @return APR_SUCCESS normally, or an error code if the operation fails
  + */
  +APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
  +                                                      int enabled);
  +#endif /* APR_HAS_MMAP */
   
   /** @} */
   #ifdef __cplusplus
  
  
  
  1.69      +13 -1     apr-util/buckets/apr_buckets_file.c
  
  Index: apr_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- apr_buckets_file.c	18 Apr 2002 18:34:27 -0000	1.68
  +++ apr_buckets_file.c	11 May 2002 23:10:24 -0000	1.69
  @@ -122,7 +122,8 @@
   #endif
   
   #if APR_HAS_MMAP
  -    if (file_make_mmap(e, filelength, fileoffset, a->readpool)) {
  +    if (a->can_mmap &&
  +        file_make_mmap(e, filelength, fileoffset, a->readpool)) {
           return apr_bucket_read(e, str, len, block);
       }
   #endif
  @@ -216,6 +217,17 @@
       b->list = list;
       return apr_bucket_file_make(b, fd, offset, len, p);
   }
  +
  +#if APR_HAS_MMAP
  +APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *e,
  +                                                      int enabled)
  +{
  +    apr_bucket_file *a = e->data;
  +    a->can_mmap = enabled;
  +    return APR_SUCCESS;
  +}
  +#endif /* APR_HAS_MMAP */
  +
   
   static apr_status_t file_bucket_setaside(apr_bucket *data, apr_pool_t *reqpool)
   {
  
  
  

Mime
View raw message