apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stri...@apache.org
Subject cvs commit: apr/include apr_portable.h
Date Fri, 24 Oct 2003 16:35:16 GMT
striker     2003/10/24 09:35:16

  Modified:    .        Tag: APR_0_9_BRANCH CHANGES
               file_io/netware Tag: APR_0_9_BRANCH pipe.c
               file_io/os2 Tag: APR_0_9_BRANCH pipe.c
               file_io/unix Tag: APR_0_9_BRANCH pipe.c
               include  Tag: APR_0_9_BRANCH apr_portable.h
  Log:
  Add apr_os_pipe_put_ex(), which allows the caller to tell APR
  to establish a cleanup on the pipe.
  
  Submitted by: Jeff Trawick, Brad Nicholes
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.426.2.5 +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.426.2.4
  retrieving revision 1.426.2.5
  diff -u -r1.426.2.4 -r1.426.2.5
  --- CHANGES	26 Sep 2003 07:25:59 -0000	1.426.2.4
  +++ CHANGES	24 Oct 2003 16:35:15 -0000	1.426.2.5
  @@ -1,5 +1,8 @@
   Changes with APR 0.9.5
   
  +  *) Add apr_os_pipe_put_ex(), which allows the caller to tell APR
  +     to establish a cleanup on the pipe.  [Jeff Trawick, Brad Nicholes]
  +
     *) Fix make_exports.awk to work with apr-iconv.  [Justin Erenkrantz]
   
   Changes with APR 0.9.4
  
  
  
  No                   revision
  No                   revision
  1.18.2.1  +19 -4     apr/file_io/netware/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/pipe.c,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- pipe.c	20 Mar 2003 18:39:53 -0000	1.18
  +++ pipe.c	24 Oct 2003 16:35:15 -0000	1.18.2.1
  @@ -136,9 +136,10 @@
       return APR_EINVAL;
   }
   
  -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  -                                          apr_os_file_t *thefile,
  -                                          apr_pool_t *pool)
  +APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
  +                                             apr_os_file_t *thefile,
  +                                             int register_cleanup,
  +                                             apr_pool_t *pool)
   {
       int *dafile = thefile;
       
  @@ -150,12 +151,26 @@
       (*file)->timeout = -1;
       (*file)->ungetchar = -1; /* no char avail */
       (*file)->filedes = *dafile;
  -    (*file)->flags = APR_FILE_NOCLEANUP;
  +    if (!register_cleanup) {
  +        (*file)->flags = APR_FILE_NOCLEANUP;
  +    }
       (*file)->buffered = 0;
   #if APR_HAS_THREADS
       (*file)->thlock = NULL;
   #endif
  +    if (register_cleanup) {
  +        apr_pool_cleanup_register((*file)->pool, (void *)(*file),
  +                                  apr_unix_file_cleanup,
  +                                  apr_pool_cleanup_null);
  +    }
       return APR_SUCCESS;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  +                                          apr_os_file_t *thefile,
  +                                          apr_pool_t *pool)
  +{
  +    return apr_os_pipe_put_ex(file, thefile, 0, pool);
   }
   
   APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
  
  
  
  No                   revision
  No                   revision
  1.40.2.1  +18 -3     apr/file_io/os2/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/pipe.c,v
  retrieving revision 1.40
  retrieving revision 1.40.2.1
  diff -u -r1.40 -r1.40.2.1
  --- pipe.c	7 Jan 2003 00:52:51 -0000	1.40
  +++ pipe.c	24 Oct 2003 16:35:15 -0000	1.40.2.1
  @@ -184,9 +184,10 @@
   
   
   
  -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  -                                          apr_os_file_t *thefile,
  -                                          apr_pool_t *pool)
  +APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
  +                                             apr_os_file_t *thefile,
  +                                             int register_cleanup,
  +                                             apr_pool_t *pool)
   {
       (*file) = apr_pcalloc(pool, sizeof(apr_file_t));
       (*file)->pool = pool;
  @@ -196,5 +197,19 @@
       (*file)->timeout = -1;
       (*file)->filedes = *thefile;
   
  +    if (register_cleanup) {
  +        apr_pool_cleanup_register(pool, *file, apr_file_cleanup,
  +                                  apr_pool_cleanup_null);
  +    }
  +
       return APR_SUCCESS;
  +}
  +
  +
  +
  +APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  +                                          apr_os_file_t *thefile,
  +                                          apr_pool_t *pool)
  +{
  +    return apr_os_pipe_put_ex(file, thefile, 0, pool);
   }
  
  
  
  No                   revision
  No                   revision
  1.63.2.1  +19 -4     apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/pipe.c,v
  retrieving revision 1.63
  retrieving revision 1.63.2.1
  diff -u -r1.63 -r1.63.2.1
  --- pipe.c	19 Mar 2003 05:32:04 -0000	1.63
  +++ pipe.c	24 Oct 2003 16:35:16 -0000	1.63.2.1
  @@ -171,9 +171,10 @@
       return APR_EINVAL;
   }
   
  -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  -                                          apr_os_file_t *thefile,
  -                                          apr_pool_t *pool)
  +APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
  +                                             apr_os_file_t *thefile,
  +                                             int register_cleanup,
  +                                             apr_pool_t *pool)
   {
       int *dafile = thefile;
       
  @@ -185,12 +186,26 @@
       (*file)->timeout = -1;
       (*file)->ungetchar = -1; /* no char avail */
       (*file)->filedes = *dafile;
  -    (*file)->flags = APR_FILE_NOCLEANUP;
  +    if (!register_cleanup) {
  +        (*file)->flags = APR_FILE_NOCLEANUP;
  +    }
       (*file)->buffered = 0;
   #if APR_HAS_THREADS
       (*file)->thlock = NULL;
   #endif
  +    if (register_cleanup) {
  +        apr_pool_cleanup_register((*file)->pool, (void *)(*file),
  +                                  apr_unix_file_cleanup,
  +                                  apr_pool_cleanup_null);
  +    }
       return APR_SUCCESS;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
  +                                          apr_os_file_t *thefile,
  +                                          apr_pool_t *pool)
  +{
  +    return apr_os_pipe_put_ex(file, thefile, 0, pool);
   }
   
   APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
  
  
  
  No                   revision
  No                   revision
  1.87.2.1  +15 -0     apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_portable.h,v
  retrieving revision 1.87
  retrieving revision 1.87.2.1
  diff -u -r1.87 -r1.87.2.1
  --- apr_portable.h	5 Mar 2003 21:22:26 -0000	1.87
  +++ apr_portable.h	24 Oct 2003 16:35:16 -0000	1.87.2.1
  @@ -391,6 +391,21 @@
                                             apr_pool_t *cont);
   
   /**
  + * convert the file from os specific type to apr type.
  + * @param file The apr file we are converting to.
  + * @param thefile The os specific pipe to convert
  + * @param register_cleanup A cleanup will be registered on the apr_file_t
  + *   to issue apr_file_close().
  + * @param cont The pool to use if it is needed.
  + * @remark On Unix, it is only possible to put a file descriptor into
  + *         an apr file type.
  + */
  +APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
  +                                             apr_os_file_t *thefile,
  +                                             int register_cleanup,
  +                                             apr_pool_t *cont);
  +
  +/**
    * convert the dir from os specific type to apr type.
    * @param dir The apr dir we are converting to.
    * @param thedir The os specific dir to convert
  
  
  

Mime
View raw message