apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/include/arch/netware fileio.h
Date Wed, 29 May 2002 21:10:57 GMT
bnicholes    02/05/29 14:10:57

  Modified:    file_io/netware pipe.c
               include/arch/netware fileio.h
  Log:
  Reimplemented apr_file_pipe_create() on NetWare using the standard
  pipe() function.
  
  Revision  Changes    Path
  1.10      +24 -54    apr/file_io/netware/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/pipe.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- pipe.c	11 Apr 2002 20:49:29 -0000	1.9
  +++ pipe.c	29 May 2002 21:10:57 -0000	1.10
  @@ -59,26 +59,6 @@
   #include "fileio.h"
   #include "apr_strings.h"
   
  -apr_status_t apr_netware_pipe_cleanup(void *thefile)
  -{
  -    apr_file_t *file = thefile;
  -    apr_status_t rv = APR_SUCCESS;
  -    int rc;
  -
  -	rc = close(file->filedes);
  -    if (rc == 0) {
  -        file->filedes = -1;
  -        if (file->thlock) {
  -            rv = apr_thread_mutex_destroy(file->thlock);
  -        }
  -    }
  -    else {
  -        /* Are there any error conditions other than EINTR or EBADF? */
  -        rv = errno;
  -    }
  -    return rv;
  -}
  -
   static apr_status_t pipeblock(apr_file_t *thepipe)
   {
   #ifdef USE_FLAGS
  @@ -154,47 +134,37 @@
   
   APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*pool)
   {
  -	char        tname[L_tmpnam+1];
   	int     	filedes[2];
   	int 		err;
   
  -	if (!tmpnam(tname))
  -		return errno;
  +    if (pipe(filedes) == -1) {
  +        return errno;
  +    }
   
  -	if (((filedes[0] = pipe_open(tname, O_RDONLY)) != -1)
  -		&& ((filedes[1] = pipe_open(tname, O_WRONLY)) != -1))
  -	{
  -        (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
  -        (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
  +    (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
  +    (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
   
  -		(*in)->pool     =
  -		(*out)->pool    = pool;
  -		(*in)->filedes   = filedes[0];
  -		(*out)->filedes  = filedes[1];
  -		(*in)->pipe      =
  -		(*out)->pipe     = 1;
  -		(*out)->fname    = apr_pstrdup(pool, tname);
  -		(*in)->fname     = apr_pstrdup(pool, tname);;
  -		(*in)->buffered  =
  -		(*out)->buffered = 0;
  -		(*in)->blocking  =
  -		(*out)->blocking = BLK_ON;
  -		(*in)->timeout   =
  -		(*out)->timeout  = -1;
  -		(*in)->ungetchar = -1;
  -		(*in)->thlock    =
  -		(*out)->thlock   = NULL;
  -	}
  -	else
  -	{
  -		if (filedes[0] != -1)
  -			close(filedes[0]);
  -        return errno;
  -	}
  +    (*in)->pool     =
  +    (*out)->pool    = pool;
  +    (*in)->filedes   = filedes[0];
  +    (*out)->filedes  = filedes[1];
  +    (*in)->pipe      =
  +    (*out)->pipe     = 1;
  +    (*out)->fname    = 
  +    (*in)->fname     = NULL;
  +    (*in)->buffered  =
  +    (*out)->buffered = 0;
  +    (*in)->blocking  =
  +    (*out)->blocking = BLK_ON;
  +    (*in)->timeout   =
  +    (*out)->timeout  = -1;
  +    (*in)->ungetchar = -1;
  +    (*in)->thlock    =
  +    (*out)->thlock   = NULL;
   
  -    apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_netware_pipe_cleanup,
  +    apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
                            apr_pool_cleanup_null);
  -    apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_netware_pipe_cleanup,
  +    apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_unix_file_cleanup,
                            apr_pool_cleanup_null);
   
       return APR_SUCCESS;
  
  
  
  1.7       +0 -1      apr/include/arch/netware/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/netware/fileio.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- fileio.h	20 Mar 2002 08:54:43 -0000	1.6
  +++ fileio.h	29 May 2002 21:10:57 -0000	1.7
  @@ -162,7 +162,6 @@
   apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p);
   
   apr_status_t apr_unix_file_cleanup(void *);
  -apr_status_t apr_netware_pipe_cleanup(void *thefile);
   
   #endif  /* ! FILE_IO_H */
   
  
  
  

Mime
View raw message