apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/file_io/netware pipe.c
Date Thu, 11 Apr 2002 20:49:29 GMT
bnicholes    02/04/11 13:49:29

  Modified:    threadproc/netware proc.c
               file_io/netware pipe.c
  Log:
  Still working on the spawning process and wiring up the pipes.  Changed
  apr_proc_create so that the parent side of the pipes are opened first.
  
  Revision  Changes    Path
  1.12      +27 -16    apr/threadproc/netware/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/netware/proc.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- proc.c	4 Apr 2002 16:55:19 -0000	1.11
  +++ proc.c	11 Apr 2002 20:49:29 -0000	1.12
  @@ -347,12 +347,18 @@
           envSpec.esStdin.ssPath = attr->child_in->fname;
           apr_file_close(attr->child_in);
           if (attr->parent_in) {
  -            apr_file_close(attr->parent_in);
  +            close(attr->parent_in->filedes);
  +    	    attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_WRONLY);
  +            /* XXX take this out when pipe blocking is fixed */
  +    		fcntl(attr->parent_in->filedes, F_SETFL, 0);
           }
       }
       else if (attr->parent_in) {
           envSpec.esStdin.ssPath = attr->parent_in->fname;
  -        apr_file_close(attr->parent_in);
  +        close(attr->parent_in->filedes);
  +    	attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_WRONLY);
  +        /* XXX take this out when pipe blocking is fixed */
  +  		fcntl(attr->parent_in->filedes, F_SETFL, 0);
       }
       else {
           envSpec.esStdin.ssPath = NULL;
  @@ -367,12 +373,18 @@
           envSpec.esStdout.ssPath = attr->child_out->fname;
           apr_file_close(attr->child_out);
           if (attr->parent_out) {
  -            apr_file_close(attr->parent_out);
  +            close(attr->parent_out->filedes);
  +    	    attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_RDONLY);
  +            /* XXX take this out when pipe blocking is fixed */
  +            fcntl(attr->parent_out->filedes, F_SETFL, 0);
           }
       }
       else if (attr->parent_out) {
           envSpec.esStdout.ssPath = attr->parent_out->fname;
  -        apr_file_close(attr->parent_out);
  +        close(attr->parent_out->filedes);
  +    	attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_RDONLY);
  +        /* XXX take this out when pipe blocking is fixed */
  +        fcntl(attr->parent_out->filedes, F_SETFL, 0);
       }
       else {
           envSpec.esStdout.ssPath = NULL;
  @@ -387,12 +399,18 @@
           envSpec.esStderr.ssPath = attr->child_err->fname;
           apr_file_close(attr->child_err);
           if (attr->parent_err) {
  -            apr_file_close(attr->parent_err);
  +            close(attr->parent_err->filedes);
  +    	    attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
  +            /* XXX take this out when pipe blocking is fixed */
  +            fcntl(attr->parent_err->filedes, F_SETFL, 0);
           }
       }
       else if (attr->parent_err) {
           envSpec.esStderr.ssPath = attr->parent_err->fname;
  -        apr_file_close(attr->parent_err);
  +        close(attr->parent_err->filedes);
  +    	attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
  +        /* XXX take this out when pipe blocking is fixed */
  +        fcntl(attr->parent_err->filedes, F_SETFL, 0);
       }
       else {
           envSpec.esStderr.ssPath = NULL;
  @@ -406,20 +424,13 @@
       newproc->err = attr->parent_err;
       newproc->out = attr->parent_out;
       if (NXVmSpawn(&nameSpec, &envSpec, flags, &newVM) != 0) {
  +        apr_file_close(attr->parent_in);
  +        apr_file_close(attr->parent_out);
  +        apr_file_close(attr->parent_err);
           return errno;
       }
       else { 
           newproc->pid = newVM;
  -        if (attr->parent_out) {
  -    	    attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_WRONLY);
  -        }
  -        if (attr->parent_in) {
  -    	    attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_RDONLY);
  -        }
  -        if (attr->parent_err) {
  -    	    attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
  -        }
  -
           apr_pool_cleanup_register(pool, (void *)newproc, apr_netware_proc_cleanup,
                            apr_pool_cleanup_null);
       }
  
  
  
  1.9       +9 -1      apr/file_io/netware/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/pipe.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- pipe.c	4 Apr 2002 16:55:50 -0000	1.8
  +++ pipe.c	11 Apr 2002 20:49:29 -0000	1.9
  @@ -81,7 +81,8 @@
   
   static apr_status_t pipeblock(apr_file_t *thepipe)
   {
  -	int				err;
  +#ifdef USE_FLAGS
  +    int				err;
   	unsigned long	flags;
   
   	if (fcntl(thepipe->filedes, F_GETFL, &flags) != -1)
  @@ -89,6 +90,9 @@
   		flags &= ~FNDELAY;
   		fcntl(thepipe->filedes, F_SETFL, flags);
   	}
  +#else
  +		fcntl(thepipe->filedes, F_SETFL, FNDELAY);
  +#endif
   
       if (errno)
           return errno;
  @@ -99,6 +103,7 @@
   
   static apr_status_t pipenonblock(apr_file_t *thepipe)
   {
  +#ifdef USE_FLAGS
   	int				err;
   	unsigned long	flags;
   
  @@ -108,6 +113,9 @@
   		flags |= FNDELAY;
   		fcntl(thepipe->filedes, F_SETFL, flags);
   	}
  +#else
  +		fcntl(thepipe->filedes, F_SETFL, 0);
  +#endif
   
       if (errno)
           return errno;
  
  
  

Mime
View raw message