From: David McCreedy Date: Tue, 10 Sep 2002 22:51:15 +0000 (+0000) Subject: Change TPF's mutex mechanism. Add additional info to TPF diagnostic msg. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4970989d42419c2a0a62b342fb31e8f2cfa2042;p=thirdparty%2Fapache%2Fhttpd.git Change TPF's mutex mechanism. Add additional info to TPF diagnostic msg. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@96755 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/main/http_main.c b/src/main/http_main.c index c14faece679..db3e04b898d 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -384,6 +384,7 @@ static int my_child_num; #ifdef TPF int tpf_child = 0; char tpf_server_name[INETD_SERVNAME_LENGTH+1]; +char tpf_mutex_key[TPF_MUTEX_KEY_SIZE]; #endif /* TPF */ scoreboard *ap_scoreboard_image = NULL; @@ -1080,7 +1081,7 @@ static int tpf_core_held; static void accept_mutex_cleanup_tpfcore(void *foo) { if(tpf_core_held) - coruc(RESOURCE_KEY); + deqc(tpf_mutex_key, QUAL_S); } #define accept_mutex_init_tpfcore(x) @@ -1093,14 +1094,14 @@ static void accept_mutex_child_init_tpfcore(pool *p) static void accept_mutex_on_tpfcore(void) { - corhc(RESOURCE_KEY); + enqc(tpf_mutex_key, ENQ_WAIT, 0, QUAL_S); tpf_core_held = 1; ap_check_signals(); } static void accept_mutex_off_tpfcore(void) { - coruc(RESOURCE_KEY); + deqc(tpf_mutex_key, QUAL_S); tpf_core_held = 0; ap_check_signals(); } @@ -5456,6 +5457,7 @@ int REALMAIN(int argc, char *argv[]) memcpy(tpf_server_name, input_parms.parent.servname, INETD_SERVNAME_LENGTH); tpf_server_name[INETD_SERVNAME_LENGTH + 1] = '\0'; + sprintf(tpf_mutex_key, "%.*x", TPF_MUTEX_KEY_SIZE - 1, getpid()); ap_open_logs(server_conf, plog); ap_tpf_zinet_checks(ap_standalone, tpf_server_name, server_conf); ap_tpf_save_argv(argc, argv); /* save argv parms for children */ diff --git a/src/os/tpf/os.c b/src/os/tpf/os.c index b7aefc19e1a..fb65ae89ca4 100644 --- a/src/os/tpf/os.c +++ b/src/os/tpf/os.c @@ -423,7 +423,7 @@ void ap_tpf_zinet_checks(int standalone, free(idct); } else { ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, s, - TPF_UNABLE_TO_DETERMINE_ZINET_MODEL); + TPF_UNABLE_TO_DETERMINE_ZINET_MODEL, servername); exit(1); /* abort start-up of server */ } @@ -498,11 +498,14 @@ void ap_tpf_save_argv(int argc, char **argv) { } void os_tpf_child(APACHE_TPF_INPUT *input_parms) { + extern char tpf_mutex_key[TPF_MUTEX_KEY_SIZE]; + tpf_child = 1; ap_my_generation = input_parms->generation; ap_restart_time = input_parms->restart_time; tpf_fds = input_parms->tpf_fds; tpf_shm_static_ptr = input_parms->shm_static_ptr; + sprintf(tpf_mutex_key, "%.*x", TPF_MUTEX_KEY_SIZE - 1, getppid()); } #ifndef __PIPE_ diff --git a/src/os/tpf/os.h b/src/os/tpf/os.h index 37f42d40a0d..32f7c7f495a 100644 --- a/src/os/tpf/os.h +++ b/src/os/tpf/os.h @@ -125,7 +125,7 @@ typedef struct fd_set { #define FD_SET(n, p) (0) #endif -#define RESOURCE_KEY ((void*) 0xC1C2C1C3) +#define TPF_MUTEX_KEY_SIZE (sizeof(pid_t)*2+1) /* TPF doesn't have, or need, tzset (it is used in mod_expires.c) */ #define tzset() @@ -219,7 +219,7 @@ void ap_tpf_save_argv(int argc, char **argv); #endif #define TPF_UNABLE_TO_DETERMINE_ZINET_MODEL \ - "Unable to determine ZINET model: inetd_getServer call failed" \ - " -- Apache startup aborted" + "Unable to determine ZINET model: inetd_getServer(\"%s\") " \ + "call failed -- Apache startup aborted" #endif /*! APACHE_OS_H*/