httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@hyperreal.org
Subject cvs commit: apache-2.0/src/os/win32 os.h
Date Mon, 17 Jan 2000 19:37:56 GMT
stoddard    00/01/17 11:37:56

  Modified:    src      ApacheCore.def
               src/lib/apr/file_io/win32 fileacc.c filestat.c
               src/lib/apr/include apr_time.h apr_win.h
               src/main http_protocol.c
               src/os/win32 os.h
  Log:
  Update Windows port to new file_io and time specs
  
  Revision  Changes    Path
  1.10      +6 -6      apache-2.0/src/ApacheCore.def
  
  Index: ApacheCore.def
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ApacheCore.def,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApacheCore.def	1999/12/20 19:52:44	1.9
  +++ ApacheCore.def	2000/01/17 19:37:51	1.10
  @@ -100,7 +100,7 @@
   	ap_find_token   @93
   	ap_get_basic_auth_pw   @94
   	ap_get_client_block   @95
  -	ap_get_gmtoff   @96
  +;	ap_get_gmtoff   @96
   	ap_get_limit_req_body   @97
   	ap_get_remote_host   @98
   	ap_get_remote_logname   @99
  @@ -108,7 +108,7 @@
   	ap_get_server_name   @101
   	ap_get_server_port   @102
   	;ap_get_server_version   @103
  -	ap_get_time   @104
  +;	ap_get_time   @104
   	ap_get_token   @105
   	ap_getparents   @106
   	ap_getword   @107
  @@ -119,7 +119,7 @@
   	ap_getword_nulls_nc   @112
   	ap_getword_white   @113
   	ap_getword_white_nc   @114
  -	ap_gm_timestr_822   @115
  +;	ap_gm_timestr_822   @115
   	ap_gname2id   @116
   	ap_handle_command   @117
   	;ap_hard_timeout   @118
  @@ -250,7 +250,7 @@
   ;	ap_table_set   @243
   ;	ap_table_setn   @244
   ;	ap_table_unset   @245
  -	ap_tm2sec   @246
  +;	ap_tm2sec   @246
   	ap_uname2id   @247
   	;ap_unblock_alarms   @248
   	ap_unescape_url   @249
  @@ -274,14 +274,14 @@
   	alias_module   @267
   	ap_bprintf   @268
   	ap_bvputs   @269
  -	ap_day_snames @270  
  +;	ap_day_snames @270  
   	;ap_extended_status  @271   
   	ap_limit_section   @272
   	ap_loaded_modules   @273
   	ap_log_error   @274
   	ap_log_printf   @275
   	ap_log_rerror   @276
  -	ap_month_snames  @277
  +;	ap_month_snames  @277
   ;	ap_null_cleanup   @278
   ;	ap_psprintf   @279
   ;	ap_pstrcat   @280
  
  
  
  1.10      +1 -66     apache-2.0/src/lib/apr/file_io/win32/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/fileacc.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- fileacc.c	1999/11/02 14:24:56	1.9
  +++ fileacc.c	2000/01/17 19:37:52	1.10
  @@ -103,20 +103,7 @@
       return rv;
   }*/
   
  -ap_status_t ap_get_filesize(ap_ssize_t *size, struct file_t *file)
  -{
  -    if (file != NULL) {
  -        if (!file->stated) {
  -            ap_getfileinfo(file);
  -        }
  -        *size = file->size;
  -        return APR_SUCCESS;
  -    }
  -    else {
  -        *size = -1;
  -        return APR_ENOFILE;
  -    }
  -}
  +
   /*
   ap_status_t ap_get_fileperms(ap_fileperms_t *perm, struct file_t *file)
   {
  @@ -130,59 +117,7 @@
       }
   }
   */
  -ap_status_t ap_get_fileatime(time_t *time, struct file_t *file)
  -{    
  -    if (file != NULL) {
  -        *time = file->atime;
  -        return APR_SUCCESS;
  -    }
  -    else {
  -        *time = -1;
  -        return APR_ENOFILE;
  -    }
  -}
   
  -ap_status_t ap_get_filectime(time_t *time, struct file_t *file)
  -{    
  -    if (file != NULL) {
  -        *time = file->ctime;
  -        return APR_SUCCESS;
  -    }
  -    else {
  -        *time = -1;
  -        return APR_ENOFILE;
  -    }
  -}
  -
  -ap_status_t ap_get_filemtime(time_t *time, struct file_t *file)
  -{    
  -    if (file != NULL) {
  -        *time = file->mtime;
  -        return APR_SUCCESS;
  -    }
  -    else {
  -        *time = -1;
  -        return APR_ENOFILE;
  -    }
  -}
  -ap_status_t ap_get_filetype(ap_filetype_e *type, struct file_t *file)
  -{    
  -    if (file != NULL) {
  -        if (!file->stated) {
  -            ap_getfileinfo(file);
  -        }
  -        if (file->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  -            *type = APR_DIR;
  -        else
  -            *type = APR_REG;
  -
  -        return APR_SUCCESS;
  -    }
  -    else {
  -        *type = APR_REG;
  -        return APR_ENOFILE;
  -    }
  -}
   ap_status_t ap_get_filedata(void **data, char *key, struct file_t *file)
   {    
       if (file != NULL) {
  
  
  
  1.4       +66 -11    apache-2.0/src/lib/apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filestat.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- filestat.c	1999/12/09 21:00:08	1.3
  +++ filestat.c	2000/01/17 19:37:52	1.4
  @@ -58,19 +58,74 @@
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_errno.h"
  -/* TODO: Handle the case when the file has not been opened */
  -ap_status_t ap_getfileinfo(struct file_t *thefile)
  +#include <sys/stat.h>
  +
  +#define S_ISLNK(m) (0)
  +#ifndef S_ISREG
  +#define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
  +#endif
  +#ifndef S_ISDIR
  +#define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR)
  +#endif
  +
  +static ap_filetype_e filetype_from_mode(int mode)
   {
  -    BY_HANDLE_FILE_INFORMATION info;
  -    GetFileInformationByHandle(thefile->filehand, &info);
  -    thefile->dwFileAttributes = info.dwFileAttributes;
  -    thefile->size = info.nFileSizeLow; /* This is broken for files > ?? */
  -    thefile->atime = WinTimeToUnixTime(&info.ftLastAccessTime);
  -    thefile->ctime = WinTimeToUnixTime(&info.ftCreationTime);
  -    thefile->mtime = WinTimeToUnixTime(&info.ftLastWriteTime);
  -    thefile->stated = 1; 
  +    ap_filetype_e type = APR_NOFILE;
   
  -    return APR_SUCCESS;
  +    if (S_ISREG(mode))
  +        type = APR_REG;
  +    if (S_ISDIR(mode))
  +        type = APR_DIR;
  +    if (S_ISLNK(mode))
  +        type = APR_LNK;
  +
  +    return type;
   }
   
  +ap_status_t ap_getfileinfo(ap_finfo_t *finfo, struct file_t *thefile)
  +{
  +    /* TODO: 
  +     * Windows should call GetFileInformationByHandle(), which is similar 
  +     * to fstat(), for the best performance. Then we would need to map the 
  +     * BY_HANDLE_FILE_INFORMATION to ap_finfo_t. 
  +     */
  +    struct stat info;
  +    int rv = stat(thefile->fname, &info);
  +
  +    if (rv == 0) {
  +        finfo->protection = info.st_mode;
  +        finfo->filetype = filetype_from_mode(info.st_mode);
  +        finfo->user = info.st_uid;
  +        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);
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        return APR_ENOSTAT;
  +    }
  +}
  +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont)
  +{
  +    struct stat info;
  +    int rv = stat(fname, &info);
  +    if (rv == 0) {
  +        finfo->protection = info.st_mode;
  +        finfo->filetype = filetype_from_mode(info.st_mode);
  +        finfo->user = info.st_uid;
  +        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);
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        return APR_ENOSTAT;
  +    }
  +}
   
  
  
  
  1.12      +4 -0      apache-2.0/src/lib/apr/include/apr_time.h
  
  Index: apr_time.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_time.h	2000/01/09 05:18:19	1.11
  +++ apr_time.h	2000/01/17 19:37:53	1.12
  @@ -69,7 +69,11 @@
   /* number of microseconds since 00:00:00 january 1, 1970 UTC */
   typedef ap_int64_t ap_time_t;
   
  +#ifdef WIN32
  +#define AP_USEC_PER_SEC ((LONGLONG) 1000000)
  +#else
   #define AP_USEC_PER_SEC (1000000LL)
  +#endif
   
   /* the time right now */
   ap_time_t ap_now(void);
  
  
  
  1.11      +3 -1      apache-2.0/src/lib/apr/include/apr_win.h
  
  Index: apr_win.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_win.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- apr_win.h	2000/01/03 16:16:24	1.10
  +++ apr_win.h	2000/01/17 19:37:53	1.11
  @@ -120,14 +120,16 @@
   typedef  int         ap_ssize_t;
   typedef  _off_t      ap_off_t;
   typedef  int         pid_t;
  +typedef  int         uid_t;
  +typedef  int         gid_t;
   
  -
   /* Definitions that APR programs need to work properly. */
   #define APR_SSIZE_T_FMT          "d"
   #define API_THREAD_FUNC          __stdcall
   #define API_EXPORT(type)         type
   #define API_EXPORT_NONSTD(type)  type
   #define API_VAR_IMPORT           extern _declspec(dllimport)
  +#define API_VAR_EXPORT
   
   /* struct iovec is needed to emulate Unix writev */
   struct iovec {
  
  
  
  1.48      +1 -6      apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- http_protocol.c	2000/01/12 18:20:43	1.47
  +++ http_protocol.c	2000/01/17 19:37:54	1.48
  @@ -2014,15 +2014,10 @@
    */
   API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r)
   {
  -    long len;
  +    long len = r->finfo.size;
   #ifdef HAVE_SENDFILE
       if (!r->chunked) {
           ap_bflush(r->connection->client);
  -        if (ap_get_filesize(&len, fd) != APR_SUCCESS) {
  -            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  -                          "ap_send_fd: ap_get_filesize failed.");
  -            return 0;
  -        }
           if (iol_sendfile(r->connection->client->iol, fd, len,
                            NULL, 0, 0) != APR_SUCCESS) {
               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
  
  
  
  1.12      +5 -0      apache-2.0/src/os/win32/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/win32/os.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- os.h	1999/11/30 05:56:14	1.11
  +++ os.h	2000/01/17 19:37:55	1.12
  @@ -105,6 +105,7 @@
   #define HAVE_CANONICAL_FILENAME
   #define HAVE_DRIVE_LETTERS
   #define HAVE_SENDFILE
  +
   typedef int uid_t;
   typedef int gid_t;
   typedef int pid_t;
  @@ -138,9 +139,13 @@
   #ifndef S_ISDIR
   #define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR)
   #endif
  +
  +#if 0
   #ifndef S_ISREG
   #define S_ISREG(m)      (((m)&(S_IFREG)) == (S_IFREG))
   #endif
  +#endif
  +
   #define STDIN_FILENO  0
   #define STDOUT_FILENO 1
   #define STDERR_FILENO 2
  
  
  

Mime
View raw message