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/modules/proxy proxy_cache.c
Date Mon, 03 Jun 2002 12:28:27 GMT
jim         2002/06/03 05:28:27

  Modified:    src/include ap_config.h
               src/main http_main.c
               src/modules/proxy proxy_cache.c
  Log:
  Attached is a patch for allowing user changes on the cygwin platform
  and a #define wrapper for the timeout singal we use to kill of pending
  open childs that do not react on "usual" signals.
  
  The signalling issue seems to be a problem on the Cygwin platform, but
  it's abstracted, so other platforms may benefit from it. Again,
  nothing else is changed in behaviour.
  
  Changes are:
  
    * src/include/ap_config.h: added the system uid for Cygwin that is
  the "root" user on Cygwin
  
    * src/main/http_main.c: some cygwin specific #defines around
  setpgrp() and getuid() calls. Adding the #define SIG_TIMEOUT_KILL to
  define which singal should be used to kill of timed out childs.
  Defaulting to the know value for all other plaforms.
  
    * src/modules/proxy/proxy_cache.c: cygwin specific #define around
  setpgrp()
  
  Submitted by:	Stipe Tolj <tolj@wapme-systems.de>
  
  Revision  Changes    Path
  1.323     +2 -0      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.322
  retrieving revision 1.323
  diff -u -r1.322 -r1.323
  --- ap_config.h	13 Mar 2002 21:05:29 -0000	1.322
  +++ ap_config.h	3 Jun 2002 12:28:27 -0000	1.323
  @@ -1003,8 +1003,10 @@
   #define NEED_HASHBANG_EMUL
   
   #elif defined(CYGWIN)               /* Cygwin 1.x POSIX layer for Win32 */
  +#define SYSTEM_UID 18
   #define JMP_BUF jmp_buf
   #define NO_KILLPG
  +#define NO_SETSID
   #define USE_LONGJMP
   #define GDBM_STATIC
   #define HAVE_MMAP 1
  
  
  
  1.585     +31 -6     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.584
  retrieving revision 1.585
  diff -u -r1.584 -r1.585
  --- http_main.c	21 May 2002 12:24:59 -0000	1.584
  +++ http_main.c	3 Jun 2002 12:28:27 -0000	1.585
  @@ -3409,6 +3409,13 @@
   #elif defined(MPE)
       /* MPE uses negative pid for process group */
       pgrp = -getpid();
  +#elif defined(CYGWIN)
  +    /* Cygwin does not take any argument for setpgrp() */
  +    if ((pgrp = setpgrp()) == -1) {
  +        perror("setpgrp");
  +        fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0);
  +        exit(1);
  +    }
   #else
       if ((pgrp = setpgrp(getpid(), 0)) == -1) {
   	perror("setpgrp");
  @@ -4225,8 +4232,15 @@
       }
       GETUSERMODE();
   #else
  -    /* Only try to switch if we're running as root */
  +    /* 
  +     * Only try to switch if we're running as root
  +     * In case of Cygwin we have the special super-user named SYSTEM
  +     */
  +#ifdef CYGWIN
  +    if (getuid() == SYSTEM_UID && (
  +#else
       if (!geteuid() && (
  +#endif
   #ifdef _OSD_POSIX
   	os_init_job_environment(server_conf, ap_user_name, one_process) != 0 || 
   #endif
  @@ -4798,13 +4812,16 @@
    * is greater then ap_daemons_max_free. Usually we will use SIGUSR1
    * to gracefully shutdown, but unfortunatly some OS will need other 
    * signals to ensure that the child process is terminated and the 
  - * scoreboard pool is not growing to infinity. This effect has been
  - * seen at least on Cygwin 1.x. -- Stipe Tolj <tolj@wapme-systems.de>
  + * scoreboard pool is not growing to infinity. Also set the signal we
  + * use to kill of childs that exceed timeout. This effect has been
  +* seen at least on Cygwin 1.x. -- Stipe Tolj <tolj@wapme-systems.de>
    */
   #if defined(CYGWIN)
   #define SIG_IDLE_KILL SIGKILL
  +#define SIG_TIMEOUT_KILL SIGUSR2
   #else
   #define SIG_IDLE_KILL SIGUSR1
  +#define SIG_TIMEOUT_KILL SIGALRM
   #endif
   
   static void perform_idle_server_maintenance(void)
  @@ -4876,7 +4893,7 @@
   		else if (ps->last_rtime + ss->timeout_len < now) {
   		    /* no progress, and the timeout length has been exceeded */
   		    ss->timeout_len = 0;
  -		    kill(ps->pid, SIGALRM);
  +		    kill(ps->pid, SIG_TIMEOUT_KILL);
   		}
   	    }
   #endif
  @@ -5492,8 +5509,16 @@
   	}
   	GETUSERMODE();
   #else
  -	/* Only try to switch if we're running as root */
  +    /* 
  +     * Only try to switch if we're running as root
  +     * In case of Cygwin we have the special super-user named SYSTEM
  +     * with a pre-defined uid.
  +     */
  +#ifdef CYGWIN
  +    if ((getuid() == SYSTEM_UID) && setuid(ap_user_id) == -1) {
  +#else
   	if (!geteuid() && setuid(ap_user_id) == -1) {
  +#endif
   	    ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
   			"setuid: unable to change to uid: %ld",
   			(long) ap_user_id);
  @@ -7686,7 +7711,7 @@
   #endif
   
   
  -int ap_main(int argc, char *argv[]); /* Load time linked from libhttpd.dll */
  +int ap_main(int argc, char *argv[]); /* Load time linked from cyghttpd.dll */
   
   int main(int argc, char *argv[])
   {
  
  
  
  1.87      +8 -0      apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- proxy_cache.c	12 Apr 2002 12:34:46 -0000	1.86
  +++ proxy_cache.c	3 Jun 2002 12:28:27 -0000	1.87
  @@ -248,6 +248,14 @@
                           ap_server_argv0);
                   exit(1);
               }
  +#elif defined(CYGWIN)
  +            /* Cygwin does not take any argument for setpgrp() */
  +            if ((pgrp = setpgrp()) == -1) {
  +                perror("setpgrp");
  +                fprintf(stderr, "%S: setpgrp failed\n",
  +                        ap_server_argv0);
  +                exit(1);
  +            }
   #else
               if ((pgrp = setpgrp(getpid(), 0)) == -1) {
                   perror("setpgrp");
  
  
  

Mime
View raw message