apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 open.c
Date Mon, 14 Oct 2002 17:40:10 GMT
wrowe       2002/10/14 10:40:10

  Modified:    include  apr_file_io.h
               file_io/win32 open.c
  Log:
    Allow sendfile semantics to be requested for a given file.  While this
    flag is strictly advisory (and doesn't affect apr_sendrecv sendfile
    support) it allows the library consumer to set and retrieve the flag
    through apr_file_flags_get().
  
  Revision  Changes    Path
  1.131     +5 -2      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- apr_file_io.h	5 Jul 2002 17:58:09 -0000	1.130
  +++ apr_file_io.h	14 Oct 2002 17:40:10 -0000	1.131
  @@ -103,7 +103,8 @@
                                           writes across process/machines */
   #define APR_FILE_NOCLEANUP  2048   /**< Do not register a cleanup when the file
                                           is opened */
  - 
  +#define APR_OPEN_FOR_SENDFILE 4096 /**< Open with appropriate semantics for
  +                                        apr_sendfile operation */ 
   /** @} */
   
   /**
  @@ -184,7 +185,9 @@
    *           APR_FILE_NOCLEANUP   Do not register a cleanup with the pool 
    *                                passed in on the <EM>cont</EM> argument (see
below).
    *                                The apr_os_file_t handle in apr_file_t will not
  - &                                be closed when the pool is destroyed.
  + *                                be closed when the pool is destroyed.
  + *           APR_OPEN_FOR_SENDFILE  Open with appropriate platform semantics
  + *                                for sendfile operations.
    * </PRE>
    * @param perm Access permissions for file.
    * @param cont The pool to use.
  
  
  
  1.109     +17 -2     apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- open.c	17 Jul 2002 03:26:29 -0000	1.108
  +++ open.c	14 Oct 2002 17:40:10 -0000	1.109
  @@ -339,11 +339,19 @@
            */
           attributes |= FILE_FLAG_OVERLAPPED;
       }
  -
   #if APR_HAS_UNICODE_FS
       IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wfname[APR_PATH_MAX];
  +
  +        if (flag & APR_OPEN_FOR_SENDFILE) {    
  +            /* This feature is required to enable sendfile operations
  +             * against the file on Win32. Also implies APR_XTHREAD.
  +             */
  +            flag |= APR_XTHREAD;
  +            attributes |= FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED;
  +        }
  +
           if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
                                                  / sizeof(apr_wchar_t), fname))
               return rv;
  @@ -352,9 +360,16 @@
       }
   #endif
   #if APR_HAS_ANSI_FS
  -    ELSE_WIN_OS_IS_ANSI
  +    ELSE_WIN_OS_IS_ANSI {
           handle = CreateFileA(fname, oflags, sharemode,
                                NULL, createflags, attributes, 0);
  +        if (flag & APR_OPEN_FOR_SENDFILE) {    
  +            /* This feature is not supported on this platform.
  +             */
  +            flag &= ~APR_OPEN_FOR_SENDFILE;
  +        }
  +
  +    }
   #endif
       if (handle == INVALID_HANDLE_VALUE) {
           return apr_get_os_error();
  
  
  

Mime
View raw message