You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/05/03 20:12:58 UTC

cvs commit: apache-2.0/src/lib/apr/test occhild.c Makefile.in testoc.c

rbb         00/05/03 11:12:56

  Modified:    src/lib/apr/test Makefile.in testoc.c
  Added:       src/lib/apr/test occhild.c
  Log:
  Improve the other_child test program.
  
  Revision  Changes    Path
  1.21      +5 -0      apache-2.0/src/lib/apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/Makefile.in,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Makefile.in	2000/04/30 17:58:32	1.20
  +++ Makefile.in	2000/05/03 18:12:49	1.21
  @@ -25,6 +25,7 @@
   	testpipe@EXEEXT@ \
   	testdso@EXEEXT@ \
   	testoc@EXEEXT@ \
  +	occhild@EXEEXT@ \
   	mod_test.so
   
   OBJS= testfile.o \
  @@ -37,6 +38,7 @@
   	testmmap.o \
   	testdso.o \
   	testoc.o \
  +	occhild.o \
   	mod_test.o
   
   .c.o:
  @@ -52,6 +54,9 @@
   
   testoc@EXEEXT@: testoc.o
   	$(CC) $(CFLAGS) testoc.o -o testoc@EXEEXT@ $(LDFLAGS) 
  +
  +occhild.so: occhild.o
  +	$(CC) -shared occhild.o -o occhild.so 
   
   mod_test.so: mod_test.o
   	$(CC) -shared mod_test.o -o mod_test.so 
  
  
  
  1.8       +11 -4     apache-2.0/src/lib/apr/test/testoc.c
  
  Index: testoc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testoc.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testoc.c	2000/04/24 21:50:18	1.7
  +++ testoc.c	2000/05/03 18:12:51	1.8
  @@ -90,6 +90,7 @@
       ap_ssize_t nbytes = 0;
       ap_proc_t *newproc = NULL;
       ap_procattr_t *procattr = NULL;
  +    ap_file_t *std = NULL;
       char *args[3];
   
       if (argc > 1) {
  @@ -106,7 +107,7 @@
           exit(-1);
       }
       
  -    args[0] = ap_pstrdup(context, "testoc");
  +    args[0] = ap_pstrdup(context, "occhild");
       args[1] = ap_pstrdup(context, "-X");
       args[2] = NULL;
   
  @@ -116,22 +117,27 @@
           fprintf(stderr, "Could not create attr\n");
           exit(-1);;
       }
  +    else {
  +        ap_setprocattr_io(procattr, APR_FULL_BLOCK, APR_NO_PIPE, APR_NO_PIPE);
  +    }
       fprintf(stdout, "OK\n");
   
       fprintf(stdout, "[PARENT] Starting other child..........");
       fflush(stdout);
  -    if (ap_create_process(&newproc, "../testoc", args, NULL, procattr, context) 
  +    if (ap_create_process(&newproc, "./occhild", args, NULL, procattr, context) 
                             != APR_SUCCESS) {
           fprintf(stderr, "error starting other child\n");
           exit(-1);
       }
       fprintf(stdout, "OK\n");
   
  +    ap_get_childin(&std, newproc);
   
  -    ap_register_other_child(newproc, ocmaint, NULL, -1, context);
  +    ap_register_other_child(newproc, ocmaint, NULL, std, context);
   
       fprintf(stdout, "[PARENT] Sending SIGKILL to child......");
       fflush(stdout);
  +    sleep(1);
       if (ap_kill(newproc, SIGKILL) != APR_SUCCESS) {
           fprintf(stderr,"couldn't send the signal!\n");
           exit(-1);
  @@ -139,7 +145,8 @@
       fprintf(stdout,"OK\n");
       
       /* allow time for things to settle... */
  -    sleep(1);
  +    sleep(3);
  +    ap_probe_writable_fds();
       
       fprintf(stdout, "[PARENT] Checking on children..........\n");
       ap_check_other_child();
  
  
  
  1.1                  apache-2.0/src/lib/apr/test/occhild.c
  
  Index: occhild.c
  ===================================================================
  #include <stdio.h>
  #include <unistd.h>
  #include <stdlib.h>
  
  int main()
  {
      int rc=1;
      char buf[256];
  
      while (rc == 1) {
          read(STDERR_FILENO, buf, 256);
      }
  }