httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/apr/file_io/unix dir.c fileacc.c fileio.h open.c pipe.c readwrite.c
Date Wed, 12 May 1999 19:15:33 GMT
rbb         99/05/12 12:15:33

  Modified:    include  apr_file_io.h
               apr/test testfile.c
               apr/file_io/unix dir.c fileacc.c fileio.h open.c pipe.c
                        readwrite.c
  Log:
  Final commit for portability.  Now, the user only has to include apr_file_io.h.
  
  Revision  Changes    Path
  1.25      +11 -11    apache-apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- apr_file_io.h	1999/05/12 18:02:51	1.24
  +++ apr_file_io.h	1999/05/12 19:15:26	1.25
  @@ -80,25 +80,25 @@
   #define APR_END SEEK_END
   
   /* Permissions flags */
  -#define APR_UREAD     UREAD 
  -#define APR_UWRITE    UWRITE
  -#define APR_UEXECUTE  UEXECUTE
  +#define APR_UREAD     0x400 
  +#define APR_UWRITE    0x200
  +#define APR_UEXECUTE  0x100
   
  -#define APR_GREAD     GREAD
  -#define APR_GWRITE    GWRITE 
  -#define APR_GEXECUTE  GEXECUTE
  +#define APR_GREAD     0x040
  +#define APR_GWRITE    0x020
  +#define APR_GEXECUTE  0x010
   
  -#define APR_WREAD     WREAD   
  -#define APR_WWRITE    WWRITE  
  -#define APR_WEXECUTE  WEXECUTE
  +#define APR_WREAD     0x004
  +#define APR_WWRITE    0x002
  +#define APR_WEXECUTE  0x001
   
   /* should be same as whence type in lseek, POSIZ defines this as int */
   typedef ap_int32_t       ap_seek_where_t;
   
   typedef struct file_t            ap_file_t;
   typedef struct dir_t             ap_dir_t;
  -typedef iovec_t                  ap_iovec_t;
  -typedef fileperms_t              ap_fileperms_t;
  +typedef struct iovec_t           ap_iovec_t;
  +typedef ap_int32_t               ap_fileperms_t;
   
   /*   Function definitions */
   ap_file_t *ap_open(ap_context_t *, char *, ap_int32_t, ap_fileperms_t);
  
  
  
  1.15      +3 -14     apache-apr/apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- testfile.c	1999/05/10 14:36:33	1.14
  +++ testfile.c	1999/05/12 19:15:28	1.15
  @@ -52,7 +52,6 @@
    * project, please see <http://www.apache.org/>.
    *
    */
  -
   #include "apr_file_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -190,7 +189,7 @@
            return APR_FAILURE;
       }
   
  -    if (ap_remove_file(context, thefile->fname) == APR_FAILURE) {
  +    if (ap_remove_file(context, "testdel") == APR_FAILURE) {
           return APR_FAILURE;
       }
   
  @@ -209,7 +208,6 @@
   int testdirs(ap_context_t *context)
   {
       ap_dir_t *temp;  
  -    ap_dirent_t *entry, *entry1;
   
       fprintf(stdout, "Testing Directory functions.\n");
   
  @@ -236,7 +234,7 @@
       }
   
       fprintf(stdout, "\tReading Directory.......");
  -    if ((entry = ap_readdir(context, temp)) == NULL) {
  +    if ((ap_readdir(context, temp)) == APR_FAILURE) {
           fprintf(stderr, "Could not read directory\n");
           return -1;
       }
  @@ -247,16 +245,7 @@
   
       fprintf(stdout, "\tRewinding directory.......");
       ap_rewinddir(context, temp); 
  -   
  -    if ((entry1 = ap_readdir(context, temp)) != NULL) {
  -        if (entry1->d_ino != entry->d_ino) {
  -            fprintf(stderr, "Couldn't rewind directory\n");
  -            return -1;
  -        }
  -        else {
  -            fprintf(stdout, "OK\n");
  -        }
  -    }
  +    fprintf(stdout, "OK\n");
       
       fprintf(stdout, "\tClosing Directory.......");
       if (ap_closedir(context, temp) == APR_FAILURE) {
  
  
  
  1.5       +2 -1      apache-apr/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/dir.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- dir.c	1999/05/12 18:03:08	1.4
  +++ dir.c	1999/05/12 19:15:29	1.5
  @@ -111,8 +111,9 @@
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_make_dir(ap_context_t *cont, const char *path, fileperms_t mode)
  +ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t perm)
   {
  +    mode_t mode = get_fileperms(perm);
       if (mkdir(path, mode) == 0) {
           return APR_SUCCESS;
       }
  
  
  
  1.6       +27 -0     apache-apr/apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/fileacc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- fileacc.c	1999/05/12 18:03:11	1.5
  +++ fileacc.c	1999/05/12 19:15:29	1.6
  @@ -58,6 +58,7 @@
   #include "apr_general.h"
   #include <errno.h>
   #include <string.h>
  +#include <sys/types.h>
   
   /* A file to put ALL of the accessor functions for struct file_t types. */
   
  @@ -71,4 +72,30 @@
       }
   }
   
  +mode_t get_fileperms(ap_fileperms_t mode)
  +{
  +    mode_t rv = 0;
  +
  +    if (mode & APR_UREAD)
  +        rv |= S_IRUSR;
  +    if (mode & APR_UWRITE)
  +        rv |= S_IWUSR;
  +    if (mode & APR_UEXECUTE)
  +        rv |= S_IXUSR;
  +
  +    if (mode & APR_GREAD)
  +        rv |= S_IRGRP;
  +    if (mode & APR_GWRITE)
  +        rv |= S_IWGRP;
  +    if (mode & APR_GEXECUTE)
  +        rv |= S_IXGRP;
   
  +    if (mode & APR_WREAD)
  +        rv |= S_IROTH;
  +    if (mode & APR_WWRITE)
  +        rv |= S_IWOTH;
  +    if (mode & APR_WEXECUTE)
  +        rv |= S_IXOTH;
  +
  +    return rv;
  +}
  
  
  
  1.6       +6 -15     apache-apr/apr/file_io/unix/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/fileio.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- fileio.h	1999/05/12 18:03:14	1.5
  +++ fileio.h	1999/05/12 19:15:30	1.6
  @@ -62,21 +62,10 @@
   #include <time.h>
   #include <dirent.h>
   #include <sys/uio.h>
  +#include "apr_general.h"
  +#include "apr_file_io.h"
   #include "apr_errno.h"
   
  -/* Permissions flags */
  -#define UREAD     S_IRUSR
  -#define UWRITE    S_IWUSR
  -#define UEXECUTE  S_IXUSR
  -
  -#define GREAD     S_IRGRP
  -#define GWRITE    S_IWGRP
  -#define GEXECUTE  S_IXGRP
  -
  -#define WREAD     S_IROTH
  -#define WWRITE    S_IWOTH
  -#define WEXECUTE  S_IXOTH
  -
   struct file_t {
       int filedes;
       char * fname;
  @@ -96,10 +85,12 @@
       struct dirent *entry;
   };
   
  -typedef mode_t            fileperms_t; 
  -typedef struct iovec      iovec_t;
  +struct iovec_t {
  +    struct iovec *iovec;
  +};
   
   ap_status_t file_cleanup(void *);
  +mode_t get_fileperms(ap_fileperms_t);
   
   #endif  /* ! FILE_IO_H */
   
  
  
  
  1.19      +3 -2      apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- open.c	1999/05/12 18:03:19	1.18
  +++ open.c	1999/05/12 19:15:30	1.19
  @@ -73,12 +73,13 @@
       }
   }
   
  -struct file_t *ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  fileperms_t mode)
  +struct file_t *ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  ap_fileperms_t
perm)
   {
       int oflags = 0;
       struct file_t *dafile;
       struct stat info;
  -    
  +    mode_t mode = get_fileperms(perm);    
  +
       dafile = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
   
       if ((flag & APR_READ) && (flag & APR_WRITE)) {
  
  
  
  1.5       +2 -1      apache-apr/apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/pipe.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- pipe.c	1999/05/12 18:03:21	1.4
  +++ pipe.c	1999/05/12 19:15:30	1.5
  @@ -79,9 +79,10 @@
       return APR_SUCCESS;
   }
   
  -char *ap_create_namedpipe(ap_context_t *cont, char *dirpath, fileperms_t mode)
  +char *ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t perm)
   {
       char *tmp;
  +    mode_t mode = get_fileperms(perm);
   
       tmp = tempnam(dirpath, NULL);
       if (mkfifo(tmp, mode) == -1) {
  
  
  
  1.8       +2 -2      apache-apr/apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- readwrite.c	1999/05/12 18:03:24	1.7
  +++ readwrite.c	1999/05/12 19:15:30	1.8
  @@ -96,10 +96,10 @@
       return rv;
   }
   
  -ap_ssize_t ap_writev(ap_context_t *cont, struct file_t *thefile, const iovec_t * vec, ap_ssize_t
iocnt)
  +ap_ssize_t ap_writev(ap_context_t *cont, struct file_t *thefile, const struct iovec_t *vec,
ap_ssize_t iocnt)
   {
       int bytes;
  -    if ((bytes = writev(thefile->filedes, vec, iocnt)) < 0) {
  +    if ((bytes = writev(thefile->filedes, vec->iovec, iocnt)) < 0) {
           return APR_FAILURE;
       }
       else {
  
  
  

Mime
View raw message