httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/apr/threadproc/unix proc.c
Date Fri, 23 Apr 1999 20:16:05 GMT
rbb         99/04/23 13:16:05

  Modified:    apr/test testproc.c
               apr/threadproc/unix proc.c
  Log:
  More testing for process control.  Arguments for programs passed to
  create_process aren't working yet, so this test program isn't portable.
  I am hoping to fix this problem later tonight.  This also fixes a bug in
  create_process
  
  Revision  Changes    Path
  1.2       +25 -1     apache-apr/apr/test/testproc.c
  
  Index: testproc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/testproc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testproc.c	1999/04/23 17:59:52	1.1
  +++ testproc.c	1999/04/23 20:16:03	1.2
  @@ -57,15 +57,19 @@
   #include "apr_errno.h"
   #include "apr_general.h"
   #include "errno.h"
  +#include <unistd.h>
   #include <stdio.h>
  +#include <signal.h>
   
   int test_filedel(void);
   int testdirs(void);
   
  -int main()
  +int main(int argc, char *argv[])
   {
       apr_proc_t *newproc;
       apr_procattr_t *attr;
  +    apr_file_t *testfile;
  +    char buf[256];
   
       fprintf(stdout, "Creating procattr.......");
       attr = apr_createprocattr_init();
  @@ -95,5 +99,25 @@
           exit(-1);
       }
       fprintf(stdout, "OK.\n");
  +    
  +    fprintf(stdout, "Createing a new process.......");
  +    if ((newproc = apr_create_process("a.out", NULL, NULL, attr)) == NULL) {
  +        fprintf(stderr, "Could not create the new process\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout, "OK.\n");
  +
  +    fprintf(stdout, "Grabbing child's stdout.......");
  +    if ((testfile = apr_get_childout(newproc)) == NULL) {
  +        fprintf(stderr, "Could not get child's stdout\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout, "OK.\n");
  +    
  +    fprintf(stdout, "Checking the data read from pipe to child.......");
  +    apr_read(testfile, buf, 256);
  +    if (!strcmp(buf, "Hello, World\n"))
  +        fprintf(stdout,"OK\n");
  +    else fprintf(stderr, "Uh-Oh\n");
   }
   
  
  
  
  1.2       +1 -0      apache-apr/apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/proc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- proc.c	1999/04/23 17:59:56	1.1
  +++ proc.c	1999/04/23 20:16:04	1.2
  @@ -184,6 +184,7 @@
       }
       
       new->attr = attr;
  +    return new;
   }
   
   apr_file_t *apr_get_childin(apr_proc_t *proc)
  
  
  

Mime
View raw message