dgaudet     97/11/06 13:54:15

  Modified:    src/main alloc.c http_log.c http_main.c httpd.h
               src/modules/standard mod_cgi.c
  Log:
  Commit the RAISE_SIGSTOP debugging support.
  
  Reviewed by:  Jim Jagielski, Martin Kraemer
  
  Revision  Changes    Path
  1.57      +1 -0      apachen/src/main/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/alloc.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- alloc.c   1997/11/01 21:13:20     1.56
  +++ alloc.c   1997/11/06 21:54:07     1.57
  @@ -1361,6 +1361,7 @@
   
       if (!pid) {
        /* Child process */
  +     RAISE_SIGSTOP(SPAWN_CHILD);
   
        if (pipe_out) {
            close(out_fds[0]);
  
  
  
  1.43      +1 -0      apachen/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- http_log.c        1997/10/27 19:09:43     1.42
  +++ http_log.c        1997/11/06 21:54:08     1.43
  @@ -413,6 +413,7 @@
        /* XXX: need to check what open fds the logger is actually passed,
         * XXX: and CGIs for that matter ... cleanup_for_exec *should*
         * XXX: close all the relevant stuff, but hey, it could be broken. */
  +     RAISE_SIGSTOP(PIPED_LOG_SPAWN);
        /* we're now in the child */
        close (STDIN_FILENO);
        dup2 (pl->fds[0], STDIN_FILENO);
  
  
  
  1.246     +12 -1     apachen/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
  retrieving revision 1.245
  retrieving revision 1.246
  diff -u -r1.245 -r1.246
  --- http_main.c       1997/11/06 10:47:01     1.245
  +++ http_main.c       1997/11/06 21:54:10     1.246
  @@ -223,6 +223,10 @@
   
   int one_process = 0;
   
  +#ifdef DEBUG_SIGSTOP
  +int raise_sigstop_flags;
  +#endif
  +
   #ifndef NO_OTHER_CHILD
   /* used to maintain list of children which aren't part of the scoreboard */
   typedef struct other_child_rec other_child_rec;
  @@ -2144,6 +2148,7 @@
        fprintf(stderr, "httpd: unable to fork new process\n");
        exit(1);
       }
  +    RAISE_SIGSTOP(DETACH);
   #endif
   #ifndef NO_SETSID
       if ((pgrp = setsid()) == -1) {
  @@ -2983,6 +2988,7 @@
       }
   
       if (!pid) {
  +     RAISE_SIGSTOP(MAKE_CHILD);
        /* Disable the restart signal handlers and enable the just_die stuff.
         * Note that since restart() just notes that a restart has been
         * requested there's no race condition here.
  @@ -3424,7 +3430,7 @@
   
       setup_prelinked_modules();
   
  -    while ((c = getopt(argc, argv, "Xd:f:vhl")) != -1) {
  +    while ((c = getopt(argc, argv, "Xd:f:vhlZ:")) != -1) {
        switch (c) {
        case 'd':
            strncpy(server_root, optarg, sizeof(server_root) - 1);
  @@ -3446,6 +3452,11 @@
        case 'X':
            ++one_process;      /* Weird debugging mode. */
            break;
  +#ifdef DEBUG_SIGSTOP
  +     case 'Z':
  +         raise_sigstop_flags = atoi(optarg);
  +         break;
  +#endif
        case '?':
            usage(argv[0]);
        }
  
  
  
  1.166     +20 -0     apachen/src/main/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/httpd.h,v
  retrieving revision 1.165
  retrieving revision 1.166
  diff -u -r1.165 -r1.166
  --- httpd.h   1997/10/26 21:57:13     1.165
  +++ httpd.h   1997/11/06 21:54:11     1.166
  @@ -903,3 +903,23 @@
   #if !defined (MULTITHREAD) && (defined (HAVE_MMAP) || defined (HAVE_SHMGET))
   #define OPTIMIZE_TIMEOUTS
   #endif
  +
  +/* A set of flags which indicate places where the server should 
raise(SIGSTOP).
  + * This is useful for debugging, because you can then attach to that process
  + * with gdb and continue.  This is important in cases where one_process
  + * debugging isn't possible.
  + */
  +#define SIGSTOP_DETACH                       1
  +#define SIGSTOP_MAKE_CHILD           2
  +#define SIGSTOP_SPAWN_CHILD          4
  +#define SIGSTOP_PIPED_LOG_SPAWN              8
  +#define SIGSTOP_CGI_CHILD            16
  +
  +#ifdef DEBUG_SIGSTOP
  +extern int raise_sigstop_flags;
  +#define RAISE_SIGSTOP(x)     do { \
  +     if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
  +    } while (0)
  +#else
  +#define RAISE_SIGSTOP(x)
  +#endif
  
  
  
  1.63      +1 -0      apachen/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- mod_cgi.c 1997/10/25 22:35:18     1.62
  +++ mod_cgi.c 1997/11/06 21:54:14     1.63
  @@ -294,6 +294,7 @@
   
       char **env;
   
  +    RAISE_SIGSTOP(CGI_CHILD);
   #ifdef DEBUG_CGI
       fprintf(dbg, "Attempting to exec %s as %sCGI child (argv0 = %s)\n",
            r->filename, nph ? "NPH " : "", argv0);
  
  
  

Reply via email to