cvs commit: apache-2.0/mpm/src/os/unix unixd.c unixd.h
manoj 99/08/13 14:55:19 Modified:mpm/src/modules/mpm/dexter dexter.c mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c mpm/src/modules/mpm/prefork prefork.c mpm/src/os/unix unixd.c unixd.h Log: Move the ap_sys_siglist code from the Unix MPMs to unixd.[ch] Revision ChangesPath 1.24 +1 -132apache-2.0/mpm/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -u -r1.23 -r1.24 --- dexter.c 1999/08/13 19:47:01 1.23 +++ dexter.c 1999/08/13 21:49:57 1.24 @@ -424,137 +424,6 @@ return -1; } -#if defined(NSIG) -#define NumSIG NSIG -#elif defined(_NSIG) -#define NumSIG _NSIG -#elif defined(__NSIG) -#define NumSIG __NSIG -#else -#define NumSIG 32 /* for 1998's unixes, this is still a good assumption */ -#endif - -#ifdef SYS_SIGLIST /* platform has sys_siglist[] */ -#define INIT_SIGLIST() /*nothing*/ -#else /* platform has no sys_siglist[], define our own */ -#define SYS_SIGLIST ap_sys_siglist -#define INIT_SIGLIST() siglist_init(); - -const char *ap_sys_siglist[NumSIG]; - -static void siglist_init(void) -{ -int sig; - -ap_sys_siglist[0] = Signal 0; -#ifdef SIGHUP -ap_sys_siglist[SIGHUP] = Hangup; -#endif -#ifdef SIGINT -ap_sys_siglist[SIGINT] = Interrupt; -#endif -#ifdef SIGQUIT -ap_sys_siglist[SIGQUIT] = Quit; -#endif -#ifdef SIGILL -ap_sys_siglist[SIGILL] = Illegal instruction; -#endif -#ifdef SIGTRAP -ap_sys_siglist[SIGTRAP] = Trace/BPT trap; -#endif -#ifdef SIGIOT -ap_sys_siglist[SIGIOT] = IOT instruction; -#endif -#ifdef SIGABRT -ap_sys_siglist[SIGABRT] = Abort; -#endif -#ifdef SIGEMT -ap_sys_siglist[SIGEMT] = Emulator trap; -#endif -#ifdef SIGFPE -ap_sys_siglist[SIGFPE] = Arithmetic exception; -#endif -#ifdef SIGKILL -ap_sys_siglist[SIGKILL] = Killed; -#endif -#ifdef SIGBUS -ap_sys_siglist[SIGBUS] = Bus error; -#endif -#ifdef SIGSEGV -ap_sys_siglist[SIGSEGV] = Segmentation fault; -#endif -#ifdef SIGSYS -ap_sys_siglist[SIGSYS] = Bad system call; -#endif -#ifdef SIGPIPE -ap_sys_siglist[SIGPIPE] = Broken pipe; -#endif -#ifdef SIGALRM -ap_sys_siglist[SIGALRM] = Alarm clock; -#endif -#ifdef SIGTERM -ap_sys_siglist[SIGTERM] = Terminated; -#endif -#ifdef SIGUSR1 -ap_sys_siglist[SIGUSR1] = User defined signal 1; -#endif -#ifdef SIGUSR2 -ap_sys_siglist[SIGUSR2] = User defined signal 2; -#endif -#ifdef SIGCLD -ap_sys_siglist[SIGCLD] = Child status change; -#endif -#ifdef SIGCHLD -ap_sys_siglist[SIGCHLD] = Child status change; -#endif -#ifdef SIGPWR -ap_sys_siglist[SIGPWR] = Power-fail restart; -#endif -#ifdef SIGWINCH -ap_sys_siglist[SIGWINCH] = Window changed; -#endif -#ifdef SIGURG -ap_sys_siglist[SIGURG] = urgent socket condition; -#endif -#ifdef SIGPOLL -ap_sys_siglist[SIGPOLL] = Pollable event occurred; -#endif -#ifdef SIGIO -ap_sys_siglist[SIGIO] = socket I/O possible; -#endif -#ifdef SIGSTOP -ap_sys_siglist[SIGSTOP] = Stopped (signal); -#endif -#ifdef SIGTSTP -ap_sys_siglist[SIGTSTP] = Stopped; -#endif -#ifdef SIGCONT -ap_sys_siglist[SIGCONT] = Continued; -#endif -#ifdef SIGTTIN -ap_sys_siglist[SIGTTIN] = Stopped (tty input); -#endif -#ifdef SIGTTOU -ap_sys_siglist[SIGTTOU] = Stopped (tty output); -#endif -#ifdef SIGVTALRM -ap_sys_siglist[SIGVTALRM] = virtual timer expired; -#endif -#ifdef SIGPROF -ap_sys_siglist[SIGPROF] = profiling timer expired; -#endif -#ifdef SIGXCPU -ap_sys_siglist[SIGXCPU] = exceeded cpu limit; -#endif -#ifdef SIGXFSZ -ap_sys_siglist[SIGXFSZ] = exceeded file size limit; -#endif -for (sig=0; sig sizeof(ap_sys_siglist)/sizeof(ap_sys_siglist[0]); ++sig) -if (ap_sys_siglist[sig] == NULL) -ap_sys_siglist[sig] = ; -} -#endif /* platform has sys_siglist[] */ - /* handle all varieties of core dumping signals */ static void sig_coredump(int sig) { @@ -794,7 +663,7 @@ } } } - + static int setup_listeners(pool *pconf, server_rec *s) { ap_listen_rec *lr; 1.27 +1 -132 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -u -r1.26 -r1.27 --- mpmt_pthread.c1999/08/13 06:57:52 1.26 +++ mpmt_pthread.c1999/08/13 21:50:55 1.27 @@
cvs commit: apache-2.0/mpm/src/os/unix unixd.c unixd.h Makefile.tmpl
dgaudet 99/06/20 15:59:53 Modified:mpm/src CHANGES mpm/src/include http_config.h mpm/src/main mpm_prefork.c mpm/src/os/unix Makefile.tmpl Added: mpm/src/os/unix unixd.c unixd.h Log: detach, set_group_privs, and such... these will be common amongst the unix MPMs, so split them off into os/unix/unixd.[ch]. Revision ChangesPath 1.8 +3 -0 apache-2.0/mpm/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/mpm/src/CHANGES,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CHANGES 1999/06/20 21:46:11 1.7 +++ CHANGES 1999/06/20 22:59:49 1.8 @@ -1,5 +1,8 @@ Changes with MPM +* os/unix/unixd.[ch]: detach, setuid, setgid, stuff which will be common + amongst the unix MPMs + * mpm_prefork: throw away all the alarm/timeout crud; and clean up the signal handling for the new world order. [Dean Gaudet] 1.2 +13 -13apache-2.0/mpm/src/include/http_config.h Index: http_config.h === RCS file: /home/cvs/apache-2.0/mpm/src/include/http_config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- http_config.h 1999/06/18 18:39:28 1.1 +++ http_config.h 1999/06/20 22:59:50 1.2 @@ -311,6 +311,19 @@ /* for implementing subconfigs and customized config files */ API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config); +/* ap_check_cmd_context() definitions: */ +API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden); + +/* ap_check_cmd_context(): Forbidden in: */ +#define NOT_IN_VIRTUALHOST 0x01 /* Virtualhost */ +#define NOT_IN_LIMIT 0x02 /* Limit */ +#define NOT_IN_DIRECTORY 0x04 /* Directory */ +#define NOT_IN_LOCATION0x08 /* Location */ +#define NOT_IN_FILES 0x10 /* Files */ +#define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* Directory/Location/Files*/ +#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) + + #ifdef CORE_PRIVATE extern API_VAR_EXPORT module *top_module; @@ -349,19 +362,6 @@ CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname, server_rec *main_server, server_rec **); void ap_process_resource_config(server_rec *s, const char *fname, pool *p, pool *ptemp); - -/* ap_check_cmd_context() definitions: */ -API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden); - -/* ap_check_cmd_context(): Forbidden in: */ -#define NOT_IN_VIRTUALHOST 0x01 /* Virtualhost */ -#define NOT_IN_LIMIT 0x02 /* Limit */ -#define NOT_IN_DIRECTORY 0x04 /* Directory */ -#define NOT_IN_LOCATION0x08 /* Location */ -#define NOT_IN_FILES 0x10 /* Files */ -#define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* Directory/Location/Files*/ -#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) - /* Module-method dispatchers, also for http_request.c */ 1.6 +13 -218 apache-2.0/mpm/src/main/mpm_prefork.c Index: mpm_prefork.c === RCS file: /home/cvs/apache-2.0/mpm/src/main/mpm_prefork.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- mpm_prefork.c 1999/06/20 21:46:13 1.5 +++ mpm_prefork.c 1999/06/20 22:59:51 1.6 @@ -96,6 +96,7 @@ #include http_connection.h #include scoreboard_prefork.h #include ap_mpm.h +#include unixd.h #ifdef USE_SHMGET_SCOREBOARD #include sys/types.h #include sys/ipc.h @@ -108,12 +109,6 @@ /* config globals */ -static uid_t ap_user_id=0; -static char *ap_user_name=NULL; -static gid_t ap_group_id=0; -#ifdef MULTIPLE_GROUPS -static gid_t group_id_list[NGROUPS_MAX]; -#endif static int ap_max_requests_per_child=0; static char *ap_pid_fname=NULL; static char *ap_scoreboard_fname=NULL; @@ -163,7 +158,6 @@ static int sd; static fd_set listenfds; static int listenmaxfd; -static pid_t pgrp; /* one_process --- debugging mode variable; can be set from the command line * with the -X flag. If set, this gets you the child_main loop running @@ -502,8 +496,8 @@ /* restrict it to use only by the appropriate user_id ... not that this * stops CGIs from acquiring it and dinking around with it. */ - buf.sem_perm.uid = ap_user_id; - buf.sem_perm.gid = ap_group_id; + buf.sem_perm.uid = unixd_config.user_id; + buf.sem_perm.gid =