httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: apache-1.3/src/os/tpf TPFExport os.c os.h
Date Thu, 01 Feb 2001 13:07:37 GMT
jim         01/02/01 05:07:36

  Modified:    src      CHANGES
               src/include ap_config.h
               src/main http_main.c
               src/modules/standard mod_usertrack.c
               src/os/tpf TPFExport os.c os.h
  Log:
  Some TPF maint' fixes, primarily wrt startup and shutdown
  
  Submitted by:	David McCreedy <McCreedy@us.ibm.com>
  
  Revision  Changes    Path
  1.1637    +2 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1636
  retrieving revision 1.1637
  diff -u -r1.1636 -r1.1637
  --- CHANGES	2001/02/01 10:55:35	1.1636
  +++ CHANGES	2001/02/01 13:07:19	1.1637
  @@ -1,5 +1,7 @@
   Changes with Apache 1.3.18
   
  +  *) TPF startup/shutdown fixes. [David McCreedy <McCreedy@us.ibm.com>]
  +
     *) Correct a typo in httpd.conf.
        [Kunihiro Tanaka <tanaka@apache.or.jp>] PR#7154 
   
  
  
  
  1.302     +2 -4      apache-1.3/src/include/ap_config.h
  
  Index: ap_config.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v
  retrieving revision 1.301
  retrieving revision 1.302
  diff -u -r1.301 -r1.302
  --- ap_config.h	2001/01/15 17:04:24	1.301
  +++ ap_config.h	2001/02/01 13:07:24	1.302
  @@ -948,7 +948,6 @@
   #define NEED_STRDUP
   #define NO_DBM_REWRITEMAP
   #define NO_GETTIMEOFDAY
  -#define NO_KILLPG
   #define NO_LINGCLOSE
   #define NO_MMAP
   #define NO_OTHER_CHILD
  @@ -959,11 +958,10 @@
   #define NO_TIMES
   #define NO_USE_SIGACTION
   #define USE_LONGJMP
  -/*#define USE_SHMGET_SCOREBOARD*/
  +#define USE_SHMGET_SCOREBOARD
  +/*#define USE_TPF_SCOREBOARD*/
   #define USE_TPF_ACCEPT
   #define USE_TPF_CORE_SERIALIZED_ACCEPT
  -/*#define USE_TPF_DAEMON*/
  -#define USE_TPF_SCOREBOARD
   #define USE_TPF_SELECT
   #define S_IREAD S_IRUSR
   #define S_IWRITE S_IWUSR
  
  
  
  1.524     +10 -14    apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.523
  retrieving revision 1.524
  diff -u -r1.523 -r1.524
  --- http_main.c	2001/01/24 16:29:00	1.523
  +++ http_main.c	2001/02/01 13:07:26	1.524
  @@ -3665,8 +3665,8 @@
   #ifdef USE_TPF_SCOREBOARD
       printf(" -D USE_TPF_SCOREBOARD\n");
   #endif
  -#ifdef USE_TPF_DAEMON
  -    printf(" -D USE_TPF_DAEMON\n");
  +#ifdef NO_SAWNC
  +    printf(" -D NO_SAWNC\n");
   #endif
   #ifdef USE_OS2_SCOREBOARD
       printf(" -D USE_OS2_SCOREBOARD\n");
  @@ -5006,13 +5006,14 @@
   	STANDALONE_MAIN(argc, argv);
       }
   #else
  +    if (!tpf_child) {
  +        memcpy(tpf_server_name, input_parms.parent.servname,
  +               INETD_SERVNAME_LENGTH);
  +        tpf_server_name[INETD_SERVNAME_LENGTH + 1] = '\0';
  +        ap_open_logs(server_conf, pconf);
  +        ap_tpf_zinet_checks(ap_standalone, tpf_server_name, server_conf);
  +    }
       if (ap_standalone) {
  -        if(!tpf_child) {
  -            memcpy(tpf_server_name, input_parms.parent.servname,
  -                   INETD_SERVNAME_LENGTH);
  -            tpf_server_name[INETD_SERVNAME_LENGTH+1] = '\0';
  -            ap_open_logs(server_conf, pconf);
  -        }
           ap_set_version();
           ap_init_modules(pconf, server_conf);
           version_locked++;
  @@ -5071,12 +5072,7 @@
   	    exit(0);
   	}
   
  -#ifdef TPF
  -/* TPF's Internet Daemon passes the incoming socket nbr (inetd mode only) */
  -    sock_in = sock_out = input_parms.parent.socket;
  -/* TPF also needs a signal set for alarm in inetd mode */
  -    signal(SIGALRM, alrm_handler);
  -#elif defined(MPE)
  +#ifdef MPE
   /* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas
      HPUX inetd passes the incoming socket as stdin (fd 0) and stdout (fd 1).
      Go figure.  SR 5003355016 has been submitted to request that the existing
  
  
  
  1.48      +1 -1      apache-1.3/src/modules/standard/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_usertrack.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- mod_usertrack.c	2001/01/15 17:05:52	1.47
  +++ mod_usertrack.c	2001/02/01 13:07:29	1.48
  @@ -103,7 +103,7 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_core.h"
  -#if !defined(WIN32) && !defined(MPE)
  +#if !defined(WIN32) && !defined(MPE) && !defined(TPF)
   #include <sys/time.h>
   #endif
   
  
  
  
  1.4       +2 -1      apache-1.3/src/os/tpf/TPFExport
  
  Index: TPFExport
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/tpf/TPFExport,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TPFExport	1999/12/08 23:03:11	1.3
  +++ TPFExport	2001/02/01 13:07:32	1.4
  @@ -2,8 +2,9 @@
   echo " Setting TPF/c89 environment variables"
   export _C89_CCMODE=1
   # replace the following with the location of your TPF include files
  -export _C89_INCDIRS="/u/tpf41/currentmaint/include /u/tpf41/currentmaint/include/oco" 
  +export _C89_INCDIRS="/u/tpf41/currentmaint/include"
   export TPF=YES
   export _C89_INCLIBS=""
   export _C89_CSYSLIB=""
  +export _C89_OPTIONS="-W 0,langlvl(extended)"
   echo "Done"
  
  
  
  1.10      +110 -14   apache-1.3/src/os/tpf/os.c
  
  Index: os.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/tpf/os.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- os.c	2001/01/15 17:06:22	1.9
  +++ os.c	2001/02/01 13:07:33	1.10
  @@ -68,12 +68,13 @@
   #include "http_log.h"
   #include "http_conf_globals.h"
   #ifdef __PIPE_
  -#include "ipc.h"
  -#include "shm.h"
  +#include <ipc.h>
  +#include <shm.h>
   static TPF_FD_LIST *tpf_fds = NULL;
   #endif
   
   void *tpf_shm_static_ptr = NULL;
  +unsigned short zinet_model;
   
   static FILE *sock_fp;
   
  @@ -133,7 +134,7 @@
       int no_writes = 0;
       int no_excepts = 0;
       int timeout = 0;
  -    int rv;
  +    int rv = 0;
       
       if(maxfds) {
           if(tv)
  @@ -145,7 +146,29 @@
           sockets[0] = 0;
           
       ap_check_signals();
  -    rv = select(sockets, no_reads, no_writes, no_excepts, timeout);
  +    if ((no_reads + no_writes + no_excepts == 0) &&
  +        (tv) && (tv->tv_sec + tv->tv_usec != 0)) {
  +        /* TPF's select immediately returns if the sum of
  +           no_reads, no_writes, and no_excepts is zero.
  +           This means that the select calls in http_main.c
  +           for shutdown don't actually wait while killing children.
  +           The following code makes TPF's select work a little closer
  +           to everyone else's select:
  +        */
  +#ifndef NO_SAWNC
  +        struct ev0bk evnblock;
  +
  +        timeout = tv->tv_sec;
  +        if (tv->tv_usec) {
  +            timeout++; /* round up to seconds (like TPF's select does) */
  +        }
  +        evnblock.evnpstinf.evnbkc1 = 1; /* nbr of posts needed */
  +        evntc(&evnblock, EVENT_CNT, 'N', timeout, EVNTC_1052);
  +        tpf_sawnc(&evnblock, EVENT_CNT);
  +#endif
  +    } else {
  +        rv = select(sockets, no_reads, no_writes, no_excepts, timeout);
  +    }
       ap_check_signals();
       
       return rv;
  @@ -352,10 +375,10 @@
           ap_log_error(APLOG_MARK, APLOG_CRIT, s,
           "unable to replace stdout with sock device driver");
       input_parms.generation = ap_my_generation;
  -#ifdef SCOREBOARD_FILE
  -    input_parms.scoreboard_fd = scoreboard_fd;
  -#else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */
  +#if defined(USE_TPF_SCOREBOARD) || defined(USE_SHMGET_SCOREBOARD)
       input_parms.scoreboard_heap = ap_scoreboard_image;
  +#else
  +    input_parms.scoreboard_fd = scoreboard_fd;
   #endif
   
       lr = ap_listeners;
  @@ -379,18 +402,69 @@
       return tpf_fork(&fork_input);
   }
   
  +void ap_tpf_zinet_checks(int standalone,
  +                        const char *servername,
  +                        server_rec *s) {
  +
  +    INETD_IDCT_ENTRY_PTR idct;
  +
  +    /* explicitly disallow "ServerType inetd" on TPF */
  +    if (!standalone) {
  +        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
  +                     TPF_SERVERTYPE_MSG);
  +        exit(1); /* abort start-up of server */
  +    }
  +
  +    /* figure out zinet model for our server from the idct slot */
  +    idct = inetd_getServer(servername);
  +    if (idct) {
  +        zinet_model = idct->model;
  +        free(idct);
  +    } else {
  +        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
  +                     TPF_UNABLE_TO_DETERMINE_ZINET_MODEL);
  +        exit(1); /* abort start-up of server */
  +    }
  +
  +    /* check for valid zinet models */
  +    if (zinet_model != INETD_IDCF_MODEL_DAEMON &&
  +        zinet_model != INETD_IDCF_MODEL_NOLISTEN) {
  +        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s,
  +                     TPF_STANDALONE_CONFLICT_MSG);
  +        exit(1); /* abort start-up of server */
  +    }
  +
  +#ifdef TPF_NOLISTEN_WARNING
  +/* nag about switching to DAEMON model */
  +    if (zinet_model == INETD_IDCF_MODEL_NOLISTEN) {
  +        ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, s,
  +                     TPF_NOLISTEN_WARNING);
  +    }
  +#endif
  +
  +}
  +
   int os_check_server(char *server) {
  -    #ifndef USE_TPF_DAEMON
  -    int rv;
       int *current_acn;
  -    if((rv = inetd_getServerStatus(server)) == INETD_SERVER_STATUS_INACTIVE)
  -        return 1;
  -    else {
  +
  +    if (zinet_model == INETD_IDCF_MODEL_NOLISTEN) {
  +        /* if NOLISTEN model, check with ZINET for status */
  +        if (inetd_getServerStatus(server) == INETD_SERVER_STATUS_INACTIVE) {
  +            return 1;
  +        }
  +        /* and check that program activation number hasn't changed */
           current_acn = (int *)cinfc_fast(CINFC_CMMACNUM);
  -        if(ecbp2()->ce2acn != *current_acn)
  +        if (ecbp2()->ce2acn != *current_acn) {
               return 1;
  +        }
  +
  +    } else {
  +        /* if DAEMON model, just make sure parent is still around */
  +        if (getppid() == 1) {
  +            return 1;
  +        }
       }
  -    #endif
  +
       return 0;
   }
   
  @@ -662,4 +736,26 @@
       }
       else
            return (0);
  +}
  +
  +/*
  +   This function serves as an interim killpg for Apache shutdown purposes.
  +   TPF won't have an actual killpg for a very long time, if ever.
  +   (And kill with a negative pid doesn't work on TPF either.)
  +*/
  +int killpg(pid_t pgrp, int sig)
  +{
  +    int i;
  +
  +    ap_sync_scoreboard_image();
  +
  +    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
  +        int pid = ap_scoreboard_image->parent[i].pid;
  +        /* the pgrp check is so that we don't kill ourself: */
  +        if (pid && pid != pgrp) {
  +            kill(pid, sig);
  +        }
  +    }
  +
  +    return(0);
   }
  
  
  
  1.11      +29 -1     apache-1.3/src/os/tpf/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/tpf/os.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- os.h	1999/09/20 20:47:08	1.10
  +++ os.h	2001/02/01 13:07:34	1.11
  @@ -11,7 +11,7 @@
   #endif
   
   /*
  - * This file in included in all Apache source code. It contains definitions
  + * This file is included in all Apache source code. It contains definitions
    * of facilities available on _this_ operating system (HAVE_* macros),
    * and prototypes of OS specific functions defined in os.c or os-inline.c
    */
  @@ -124,8 +124,12 @@
   
   struct server_rec;
   pid_t os_fork(struct server_rec *s, int slot);
  +void ap_tpf_zinet_checks(int standalone,
  +                         const char *servername,
  +                         struct server_rec *s);
   int os_check_server(char *server);
   char *getpass(const char *prompt);
  +int killpg(pid_t pgrp, int sig);
   extern char *ap_server_argv0;
   extern int scoreboard_fd;
   #include <signal.h>
  @@ -135,4 +139,28 @@
   #ifdef NSIG
   #undef NSIG
   #endif
  +
  +/* various #defines for ServerType/ZINET model checks: */
  +
  +#define TPF_SERVERTYPE_MSG \
  +        "ServerType inetd is not supported on TPF" \
  +        " -- Apache startup aborted"
  +
  +#ifdef INETD_IDCF_MODEL_DAEMON
  +#define TPF_STANDALONE_CONFLICT_MSG \
  +        "ServerType standalone requires ZINET model DAEMON or NOLISTEN" \
  +        " -- Apache startup aborted"
  +#define TPF_NOLISTEN_WARNING \
  +        "ZINET model DAEMON is preferred over model NOLISTEN"
  +#else
  +#define INETD_IDCF_MODEL_DAEMON -1
  +#define TPF_STANDALONE_CONFLICT_MSG \
  +        "ServerType standalone requires ZINET model NOLISTEN" \
  +        " -- Apache startup aborted"
  +#endif
  +
  +#define TPF_UNABLE_TO_DETERMINE_ZINET_MODEL \
  +        "Unable to determine ZINET model: inetd_getServer call failed" \
  +        " -- Apache startup aborted"
  +
   #endif /*! APACHE_OS_H*/
  
  
  

Mime
View raw message