apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/file_io/unix pipe.c
Date Thu, 03 Oct 2002 17:55:42 GMT
trawick     2002/10/03 10:55:42

  Modified:    include  apr_portable.h
               file_io/unix pipe.c
  Log:
  add a way to create an apr_file_t from an apr_os_file_t which
  results in something that APR will treat as a pipe
  
  Revision  Changes    Path
  1.81      +12 -0     apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_portable.h,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- apr_portable.h	17 Jul 2002 04:11:32 -0000	1.80
  +++ apr_portable.h	3 Oct 2002 17:55:42 -0000	1.81
  @@ -364,6 +364,18 @@
                                             apr_int32_t flags, 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 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(apr_file_t **file,
  +                                          apr_os_file_t *thefile,
  +                                          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
  
  
  
  1.58      +23 -0     apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/pipe.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- pipe.c	11 Jul 2002 22:15:26 -0000	1.57
  +++ pipe.c	3 Oct 2002 17:55:42 -0000	1.58
  @@ -54,6 +54,7 @@
   
   #include "fileio.h"
   #include "apr_strings.h"
  +#include "apr_portable.h"
   
   /* Figure out how to get pipe block/nonblock on BeOS...
    * Basically, BONE7 changed things again so that ioctl didn't work,
  @@ -166,6 +167,28 @@
           return APR_SUCCESS;
       }
       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)
  +{
  +    int *dafile = thefile;
  +    
  +    (*file) = apr_pcalloc(pool, sizeof(apr_file_t));
  +    (*file)->pool = pool;
  +    (*file)->eof_hit = 0;
  +    (*file)->is_pipe = 1;
  +    (*file)->blocking = BLK_UNKNOWN; /* app needs to make a timeout call */
  +    (*file)->timeout = -1;
  +    (*file)->ungetchar = -1; /* no char avail */
  +    (*file)->filedes = *dafile;
  +    (*file)->flags = 0;
  +    (*file)->buffered = 0;
  +#if APR_HAS_THREADS
  +    (*file)->thlock = NULL;
  +#endif
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
  
  
  

Mime
View raw message