apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/include apr_file_io.h
Date Mon, 16 Jul 2001 20:44:17 GMT
wrowe       01/07/16 13:44:17

  Modified:    file_io/unix open.c filedup.c
               include  apr_file_io.h
  Log:
    This should introduce the APR_INHERIT flag for Unix.
  
  Revision  Changes    Path
  1.78      +7 -1      apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- open.c	2001/06/27 19:40:34	1.77
  +++ open.c	2001/07/16 20:44:16	1.78
  @@ -167,7 +167,8 @@
       (*new)->dataRead = 0;
       (*new)->direction = 0;
       apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), apr_unix_file_cleanup,
  -                        apr_pool_cleanup_null);
  +                              ((*new)->flag & APR_INHERIT) ? apr_pool_cleanup_null

  +                                                           : apr_unix_file_cleanup);
       return APR_SUCCESS;
   }
   
  @@ -223,6 +224,7 @@
       /* buffer already NULL; 
        * don't get a lock (only for buffered files) 
        */
  +    (*file)->inherit = 1;
       return APR_SUCCESS;
   }    
   
  @@ -254,5 +256,9 @@
   
       return apr_os_file_put(thefile, &fd, cont);
   }
  +
  +APR_IMPLEMENT_SET_INHERIT(file, flags, cntxt, apr_unix_file_cleanup)
  +
  +APR_IMPLEMENT_UNSET_INHERIT(file, flags, cntxt, apr_unix_file_cleanup)
   
   APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.31      +4 -2      apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/filedup.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- filedup.c	2001/06/27 19:40:34	1.30
  +++ filedup.c	2001/07/16 20:44:16	1.31
  @@ -87,8 +87,10 @@
       }
       (*new_file)->blocking = old_file->blocking; /* this is the way dup() works */
       (*new_file)->flags = old_file->flags;
  -    apr_pool_cleanup_register((*new_file)->cntxt, (void *)(*new_file), apr_unix_file_cleanup,
  -                        apr_pool_cleanup_null);
  +    apr_pool_cleanup_register((*new_file)->cntxt, (void *)(*new_file), 
  +                              apr_unix_file_cleanup,
  +                              (*new_file)->flags ? apr_pool_cleanup_null 
  +                                                 : apr_unix_file_cleanup);
       return APR_SUCCESS;
   }
   
  
  
  
  1.104     +30 -1     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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- apr_file_io.h	2001/06/27 19:40:46	1.103
  +++ apr_file_io.h	2001/07/16 20:44:17	1.104
  @@ -60,6 +60,7 @@
   #include "apr_time.h"
   #include "apr_errno.h"
   #include "apr_file_info.h"
  +#include "apr_inherit.h"
   
   #define APR_WANT_STDIO          /* for SEEK_* */
   #define APR_WANT_IOVEC
  @@ -89,6 +90,12 @@
   #define APR_SHARELOCK  1024        /* Platform dependent support for higher
                                         level locked read/write access to support
                                         writes across process/machines */
  +#ifndef APR_INHERIT
  +#define APR_INHERIT    (2^24)      /* Create the file inheritable by the child
  +                                      process. fork()ed implementations 
  +                                      automatically register a child cleanup
  +                                      in the _absense_ of this flag. */
  +#endif
   
   /* flags for apr_file_seek */
   #define APR_SET SEEK_SET
  @@ -96,7 +103,7 @@
   #define APR_END SEEK_END
   
   /* should be same as whence type in lseek, POSIX defines this as int */
  -typedef apr_int32_t       apr_seek_where_t;
  +typedef int       apr_seek_where_t;
   
   /**
    * Structure for referencing files.
  @@ -141,6 +148,10 @@
    *           APR_SHARELOCK        Platform dependent support for higher
    *                                level locked read/write access to support
    *                                writes across process/machines
  + *           APR_INHERIT          Create the file inheritable by the child
  + *                                processes.  fork()ed implementations 
  + *                                automatically register a child cleanup
  + *                                in the _absense_ of this flag.
    * </PRE>
    * @param perm Access permissions for file.
    * @param cont The pool to use.
  @@ -568,6 +579,24 @@
    * @deffunc apr_pool_t apr_file_pool_get(apr_file_t *f)
    */
   APR_POOL_DECLARE_ACCESSOR(file);
  +
  +/**
  + * Set a file to be inherited by child processes.
  + * @param file The file to enable inheritance.
  + * @deffunc void apr_file_set_inherit(apr_file_t *file)
  + * @tip Same effect as passing the APR_INHERIT flag to apr_file_open(),
  + * but it is far more efficient to pass the correct value in the first place.
  + */
  +APR_DECLARE_SET_INHERIT(file);
  +
  +/**
  + * Unset a file from being inherited by child processes.
  + * @param file The file to disable inheritance.
  + * @deffunc void apr_file_unset_inherit(apr_file_t *file)
  + * @tip Same effect as omiting the APR_INHERIT flag to apr_file_open(),
  + * but it is far more efficient to pass the correct value in the first place.
  + */
  +APR_DECLARE_UNSET_INHERIT(file);
   
   #ifdef __cplusplus
   }
  
  
  

Mime
View raw message