costin 01/12/01 17:05:25 Modified: jk/native2/common jk_ajp14_worker.c jk_channel_socket.c jk_env.c jk_handler_discovery.c jk_handler_logon.c jk_jni_worker.c jk_lb_worker.c jk_msg_buff.c jk_registry.c jk_uriMap.c jk_util.c Log: Update to use the now logger style. Revision Changes Path 1.2 +21 -15 jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c Index: jk_ajp14_worker.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_ajp14_worker.c 2001/12/01 22:37:29 1.1 +++ jk_ajp14_worker.c 2001/12/02 01:05:25 1.2 @@ -96,7 +96,7 @@ secret_key = jk_get_worker_secret_key(props, aw->name); if ((!secret_key) || (!strlen(secret_key))) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "No secretkey, defaulting to unauthenticated AJP13\n"); proto=AJP13_PROTO; aw->proto= AJP13_PROTO; @@ -106,7 +106,7 @@ if (ajp_validate(pThis, props, we, l, proto) == JK_FALSE) return JK_FALSE; - /* jk_log(l, JK_LOG_DEBUG, + /* l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:validate - secret_key=%s\n", secret_key); */ return JK_TRUE; } @@ -161,7 +161,7 @@ aw->login->web_server_name = strdup(we->server_name); if (aw->login->web_server_name == NULL) { - jk_log(l, JK_LOG_ERROR, "can't malloc web_server_name\n"); + l->jkLog(l, JK_LOG_ERROR, "can't malloc web_server_name\n"); return JK_FALSE; } @@ -214,18 +214,18 @@ char *type, char *name) { jk_logger_t *l=env->logger; - jk_worker_t **w=result; + jk_worker_t *w=(jk_worker_t *)malloc(sizeof(jk_worker_t)); ajp_worker_t *aw = (ajp_worker_t *)malloc(sizeof(ajp_worker_t)); - jk_log(l, JK_LOG_DEBUG, "Into ajp14_worker_factory\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_worker_factory\n"); if (name == NULL || w == NULL) { - jk_log(l, JK_LOG_ERROR, "In ajp14_worker_factory, NULL parameters\n"); + l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, NULL parameters\n"); return JK_FALSE; } if (! aw) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, malloc of private data failed\n"); return JK_FALSE; } @@ -234,7 +234,7 @@ if (! aw->name) { free(aw); - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, malloc failed for name\n"); return JK_FALSE; } @@ -244,7 +244,7 @@ aw->login= (jk_login_service_t *)malloc(sizeof(jk_login_service_t)); if (aw->login == NULL) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, malloc failed for login area\n"); return JK_FALSE; } @@ -258,14 +258,20 @@ aw->ep_cache_sz= 0; aw->ep_cache= NULL; aw->connect_retry_attempts= AJP_DEF_RETRY_ATTEMPTS; - aw->worker.worker_private= aw; + + aw->worker=w; + + w->worker_private= aw; + w->channel= NULL; - aw->worker.validate= validate; - aw->worker.init= init; - aw->worker.get_endpoint= get_endpoint; - aw->worker.destroy=destroy; + w->validate= validate; + w->init= init; + w->get_endpoint= get_endpoint; + w->destroy=destroy; + aw->logon= logon; + + *result = w; - *w = &aw->worker; return JK_TRUE; } 1.2 +26 -19 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_channel_socket.c 2001/12/01 22:38:39 1.1 +++ jk_channel_socket.c 2001/12/02 01:05:25 1.2 @@ -141,7 +141,7 @@ jk_worker_t *worker, jk_logger_t *l ) { - int err=jk_log(l, JK_LOG_DEBUG, "Into jk_channel_socket_init\n"); + int err=l->jkLog(l, JK_LOG_DEBUG, "Into jk_channel_socket_init\n"); jk_channel_socket_private_t *socketInfo= (jk_channel_socket_private_t *)(_this->_privatePtr); @@ -158,10 +158,10 @@ err=jk_channel_socket_resolve( host, port, rc ); if( err!= JK_TRUE ) { - jk_log(l, JK_LOG_ERROR, "jk_channel_socket_init: " + l->jkLog(l, JK_LOG_ERROR, "jk_channel_socket_init: " "can't resolve %s:%d errno=%d\n", host, port, errno ); } - jk_log(l, JK_LOG_DEBUG, "jk_channel_socket_init: ok " + l->jkLog(l, JK_LOG_DEBUG, "jk_channel_socket_init: ok " " %s:%d\n", host, port ); return err; @@ -202,13 +202,29 @@ return JK_TRUE; } +static int jk_close_socket(int s) +{ +#ifdef WIN32 + if(INVALID_SOCKET != s) { + return closesocket(s) ? -1 : 0; + } +#else + if(-1 != s) { + return close(s); + } +#endif + + return -1; +} + + /** connect to Tomcat (jk_open_socket) */ static int JK_METHOD jk_channel_socket_open(jk_channel_t *_this, jk_endpoint_t *endpoint) { jk_logger_t *l=_this->logger; - int err=jk_log(l, JK_LOG_DEBUG, "Into jk_channel_socket_open\n"); + int err=l->jkLog(l, JK_LOG_DEBUG, "Into jk_channel_socket_open\n"); jk_channel_socket_private_t *socketInfo= (jk_channel_socket_private_t *)(_this->_privatePtr); @@ -222,7 +238,7 @@ int ret; /* Tries to connect to JServ (continues trying while error is EINTR) */ do { - jk_log(l, JK_LOG_DEBUG, "jk_open_socket, try to connect socket = %d\n", sock); + l->jkLog(l, JK_LOG_DEBUG, "jk_open_socket, try to connect socket = %d\n", sock); ret = connect(sock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)); @@ -231,7 +247,7 @@ errno = WSAGetLastError() - WSABASEERR; } #endif /* WIN32 */ - jk_log(l, JK_LOG_DEBUG, "jk_open_socket, after connect ret = %d\n", ret); + l->jkLog(l, JK_LOG_DEBUG, "jk_open_socket, after connect ret = %d\n", ret); } while (-1 == ret && EINTR == errno); /* Check if we connected */ @@ -239,7 +255,7 @@ if(ndelay) { int set = 1; - jk_log(l, JK_LOG_DEBUG, "jk_open_socket, set TCP_NODELAY to on\n"); + l->jkLog(l, JK_LOG_DEBUG, "jk_open_socket, set TCP_NODELAY to on\n"); setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, @@ -247,7 +263,7 @@ sizeof(set)); } - jk_log(l, JK_LOG_DEBUG, "jk_open_socket, return, sd = %d\n", sock); + l->jkLog(l, JK_LOG_DEBUG, "jk_open_socket, return, sd = %d\n", sock); { jk_channel_socket_data_t *sd=endpoint->channelData; if( sd==NULL ) { @@ -266,7 +282,7 @@ #endif /* WIN32 */ } - jk_log(l, JK_LOG_ERROR, "jk_open_socket, connect() failed errno = %d %s\n", + l->jkLog(l, JK_LOG_ERROR, "jk_open_socket, connect() failed errno = %d %s\n", errno, strerror( errno ) ); return -1; @@ -284,16 +300,7 @@ return JK_FALSE; sd=chD->sock; -#ifdef WIN32 - if(INVALID_SOCKET != sd) { - return closesocket(sd) ? JK_FALSE : JK_TRUE;; - } -#else - if(-1 != sd) { - return close(sd); - } -#endif - return JK_FALSE; + return jk_close_socket(sd); } /** send a long message 1.2 +6 -2 jakarta-tomcat-connectors/jk/native2/common/jk_env.c Index: jk_env.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_env.c 2001/12/01 22:38:39 1.1 +++ jk_env.c 2001/12/02 01:05:25 1.2 @@ -108,13 +108,17 @@ fac=_this->getFactory( _this, type, name); if( fac==NULL ) { - jk_log(_this->logger, JK_LOG_ERROR,"Error getting factory for %s:%s\n", type, name); + if( _this->logger ) + _this->logger->jkLog(_this->logger, JK_LOG_ERROR, + "Error getting factory for %s:%s\n", type, name); return NULL; } fac( _this, &result, type, name ); if( result==NULL ) { - jk_log(_this->logger, JK_LOG_ERROR,"Error getting instance for %s:%s\n", type, name); + if( _this->logger ) + _this->logger->jkLog(_this->logger, JK_LOG_ERROR, + "Error getting instance for %s:%s\n", type, name); return NULL; } 1.2 +32 -32 jakarta-tomcat-connectors/jk/native2/common/jk_handler_discovery.c Index: jk_handler_discovery.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_discovery.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_handler_discovery.c 2001/12/01 22:38:39 1.1 +++ jk_handler_discovery.c 2001/12/02 01:05:25 1.2 @@ -58,7 +58,7 @@ /** * Description: AJP14 Discovery handler * Author: Henri Gomez <[EMAIL PROTECTED]> - * Version: $Revision: 1.1 $ + * Version: $Revision: 1.2 $ */ #include "jk_global.h" @@ -98,12 +98,12 @@ ajp14_marshal_context_query_into_msgb(msg, we->virtual, l); - jk_log(l, JK_LOG_DEBUG, "Into ajp14:discovery - send query\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:discovery - send query\n"); if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) return JK_FALSE; - jk_log(l, JK_LOG_DEBUG, "Into ajp14:discovery - wait context reply\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:discovery - wait context reply\n"); jk_b_reset(msg); @@ -111,30 +111,30 @@ return JK_FALSE; if ((cmd = jk_b_get_byte(msg)) != AJP14_CONTEXT_INFO_CMD) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14:discovery - awaited command %d, received %d\n", AJP14_CONTEXT_INFO_CMD, cmd); return JK_FALSE; } if (context_alloc(&c, we->virtual) != JK_TRUE) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14:discovery - can't allocate context room\n"); return JK_FALSE; } if (ajp14_unmarshal_context_info(msg, c, l) != JK_TRUE) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14:discovery - can't get context reply\n"); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, "Into ajp14:discovery - received context\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:discovery - received context\n"); buf = malloc(MAX_URI_SIZE); /* Really a very long URI */ if (! buf) { - jk_log(l, JK_LOG_ERROR, "Error ajp14:discovery - can't alloc buf\n"); + l->jkLog(l, JK_LOG_ERROR, "Error ajp14:discovery - can't alloc buf\n"); return JK_FALSE; } @@ -148,7 +148,7 @@ sprintf(buf, "/%s/%s", ci->cbase, ci->uris[j]); #endif - jk_log(l, JK_LOG_INFO, + l->jkLog(l, JK_LOG_INFO, "Into ajp14:discovery " "- worker %s will handle uri %s in context %s [%s]\n", ae->worker->name, ci->uris[j], ci->cbase, buf); @@ -184,7 +184,7 @@ jk_msg_buf_t *msg; int rc; - jk_log(l, JK_LOG_DEBUG, "Into ajp14:discovery\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:discovery\n"); msg = jk_b_new(p); jk_b_set_buffer_size(msg, DEF_BUFFER_SZ); @@ -209,7 +209,7 @@ char *virtual, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_context_query_into_msgb\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_marshal_context_query_into_msgb\n"); /* To be on the safe side */ jk_b_reset(msg); @@ -224,7 +224,7 @@ * VIRTUAL HOST CSTRING */ if (jk_b_append_string(msg, virtual)) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_context_query_into_msgb " "- Error appending the virtual host string\n"); return JK_FALSE; @@ -259,12 +259,12 @@ vname = (char *)jk_b_get_string(msg); - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "ajp14_unmarshal_context_info - get virtual %s for virtual %s\n", vname, c->virtual); if (! vname) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info " "- can't get virtual hostname\n"); return JK_FALSE; @@ -277,7 +277,7 @@ /* set the virtual name, better to add to a virtual list ? */ if (context_set_virtual(c, vname) == JK_FALSE) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info " "- can't malloc virtual hostname\n"); return JK_FALSE; @@ -289,12 +289,12 @@ cname = (char *)jk_b_get_string(msg); if (! cname) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info - can't get context\n"); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, "ajp14_unmarshal_context_info " + l->jkLog(l, JK_LOG_DEBUG, "ajp14_unmarshal_context_info " "- get context %s for virtual %s\n", cname, vname); /* grab all contexts up to empty one which indicate end of contexts */ @@ -304,7 +304,7 @@ /* create new context base (if needed) */ if (context_add_base(c, cname) == JK_FALSE) { - jk_log(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info" + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info" "- can't add/set context %s\n", cname); return JK_FALSE; } @@ -314,22 +314,22 @@ uri = (char *)jk_b_get_string(msg); if (!uri) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info - can't get URI\n"); return JK_FALSE; } if (! strlen(uri)) { - jk_log(l, JK_LOG_DEBUG, "No more URI for context %s", cname); + l->jkLog(l, JK_LOG_DEBUG, "No more URI for context %s", cname); break; } - jk_log(l, JK_LOG_INFO, + l->jkLog(l, JK_LOG_INFO, "Got URI (%s) for virtualhost %s and context %s\n", uri, vname, cname); if (context_add_uri(c, cname, uri) == JK_FALSE) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_info - " "can't add/set uri (%s) for context %s\n", uri, cname); return JK_FALSE; @@ -361,7 +361,7 @@ jk_context_item_t *ci; int i; - jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_context_state_into_msgb\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_marshal_context_state_into_msgb\n"); /* To be on the safe side */ jk_b_reset(msg); @@ -376,7 +376,7 @@ * VIRTUAL HOST CSTRING */ if (jk_b_append_string(msg, c->virtual)) { - jk_log(l, JK_LOG_ERROR, "Error ajp14_marshal_context_state_into_msgb" + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_context_state_into_msgb" "- Error appending the virtual host string\n"); return JK_FALSE; } @@ -386,7 +386,7 @@ ci = context_find_base(c, cname); if (! ci) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Warning ajp14_marshal_context_state_into_msgb" "- unknown context %s\n", cname); return JK_FALSE; @@ -397,7 +397,7 @@ */ if (jk_b_append_string(msg, cname )) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_context_state_into_msgb" "- Error appending the context string %s\n", cname); return JK_FALSE; @@ -408,7 +408,7 @@ * CONTEXT CSTRING */ if (jk_b_append_string(msg, c->contexts[i]->cbase )) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_context_state_into_msgb " "- Error appending the context string\n"); return JK_FALSE; @@ -419,7 +419,7 @@ /* End of context list, an empty string */ if (jk_b_append_string(msg, "")) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_context_state_into_msgb " "- Error appending end of contexts\n"); return JK_FALSE; @@ -454,7 +454,7 @@ vname = (char *)jk_b_get_string(msg); if (! vname) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_state_reply " "- can't get virtual hostname\n"); return JK_FALSE; @@ -462,7 +462,7 @@ /* Check if we speak about the correct virtual */ if (strcmp(c->virtual, vname)) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_state_reply" "- incorrect virtual %s instead of %s\n", vname, c->virtual); @@ -474,7 +474,7 @@ cname = (char *)jk_b_get_string(msg); if (! cname) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_state_reply" "- can't get context\n"); return JK_FALSE; @@ -486,7 +486,7 @@ ci = context_find_base(c, cname); if (! ci) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_context_state_reply " "- unknow context %s for virtual %s\n", cname, vname); @@ -495,7 +495,7 @@ ci->status = jk_b_get_int(msg); - jk_log(l, JK_LOG_DEBUG, "ajp14_unmarshal_context_state_reply " + l->jkLog(l, JK_LOG_DEBUG, "ajp14_unmarshal_context_state_reply " "- updated context %s to state %d\n", cname, ci->status); } 1.2 +19 -19 jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c Index: jk_handler_logon.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_handler_logon.c 2001/12/01 22:38:39 1.1 +++ jk_handler_logon.c 2001/12/02 01:05:25 1.2 @@ -58,7 +58,7 @@ /** * Description: AJP14 Login handler * Author: Henri Gomez <[EMAIL PROTECTED]> - * Version: $Revision: 1.1 $ + * Version: $Revision: 1.2 $ */ #include "jk_global.h" @@ -140,12 +140,12 @@ ajp14_marshal_login_init_into_msgb(msg, jl, l); - jk_log(l, JK_LOG_DEBUG, "Into ajp14:logon - send init\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:logon - send init\n"); if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) return JK_FALSE; - jk_log(l, JK_LOG_DEBUG, "Into ajp14:logon - wait init reply\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:logon - wait init reply\n"); jk_b_reset(msg); @@ -153,7 +153,7 @@ return JK_FALSE; if ((cmd = jk_b_get_byte(msg)) != AJP14_LOGSEED_CMD) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14:logon: awaited command %d, received %d\n", AJP14_LOGSEED_CMD, cmd); return JK_FALSE; @@ -162,7 +162,7 @@ if (ajp14_unmarshal_login_seed(msg, jl, l) != JK_TRUE) return JK_FALSE; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:logon - received entropy %s\n", jl->entropy); ajp14_compute_md5(jl, l); @@ -182,7 +182,7 @@ case AJP14_LOGOK_CMD : if (ajp14_unmarshal_log_ok(msg, jl, l) == JK_TRUE) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Successfully connected to servlet-engine %s\n", jl->servlet_engine_name); return JK_TRUE; @@ -204,7 +204,7 @@ jk_msg_buf_t *msg; int rc; - jk_log(l, JK_LOG_DEBUG, "Into ajp14:logon\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14:logon\n"); msg = jk_b_new(p); jk_b_set_buffer_size(msg, DEF_BUFFER_SZ); @@ -226,7 +226,7 @@ jk_md5((const unsigned char *)s->entropy, (const unsigned char *)s->secret_key, s->computed_key); - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_compute_md5 (%s/%s) -> (%s)\n", s->entropy, s->secret_key, s->computed_key); } @@ -244,7 +244,7 @@ jk_login_service_t *s, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_init_into_msgb\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_init_into_msgb\n"); /* To be on the safe side */ jk_b_reset(msg); @@ -265,7 +265,7 @@ * WEB-SERVER NAME */ if (jk_b_append_string(msg, s->web_server_name)) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_login_init_into_msgb " "- Error appending the web_server_name string\n"); return JK_FALSE; @@ -289,7 +289,7 @@ { if (jk_b_get_bytes(msg, (unsigned char *)s->entropy, AJP14_ENTROPY_SEED_LEN) < 0) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_login_seed - can't get seed\n"); return JK_FALSE; } @@ -310,7 +310,7 @@ jk_login_service_t *s, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_comp_into_msgb\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_comp_into_msgb\n"); /* To be on the safe side */ jk_b_reset(msg); @@ -326,7 +326,7 @@ */ if (jk_b_append_bytes(msg, (const unsigned char *)s->computed_key, AJP14_COMPUTED_KEY_LEN)) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_marshal_login_comp_into_msgb " " - Error appending the COMPUTED MD5 bytes\n"); return JK_FALSE; @@ -354,7 +354,7 @@ nego = jk_b_get_long(msg); if (nego == 0xFFFFFFFF) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_log_ok - can't get negociated data\n"); return JK_FALSE; } @@ -362,7 +362,7 @@ sname = (char *)jk_b_get_string(msg); if (! sname) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_log_ok - " "can't get servlet engine name\n"); return JK_FALSE; @@ -375,7 +375,7 @@ s->servlet_engine_name = strdup(sname); if (! s->servlet_engine_name) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_log_ok - " " can't malloc servlet engine name\n"); return JK_FALSE; @@ -399,17 +399,17 @@ { unsigned long status; - jk_log(l, JK_LOG_DEBUG, "Into ajp14_unmarshal_log_nok\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_unmarshal_log_nok\n"); status = jk_b_get_long(msg); if (status == 0xFFFFFFFF) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "Error ajp14_unmarshal_log_nok - can't get failure code\n"); return JK_FALSE; } - jk_log(l, JK_LOG_INFO, + l->jkLog(l, JK_LOG_INFO, "Can't Log with servlet engine - code %08lx", status); return JK_TRUE; } 1.2 +88 -88 jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c Index: jk_jni_worker.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_jni_worker.c 2001/12/01 22:37:29 1.1 +++ jk_jni_worker.c 2001/12/02 01:05:25 1.2 @@ -59,7 +59,7 @@ * Description: In process JNI worker * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Based on: * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ #if !defined(WIN32) && !defined(NETWARE) @@ -264,9 +264,9 @@ jni_endpoint_t *p; jint rc; - jk_log(l, JK_LOG_DEBUG, "Into service\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into service\n"); if(!e || !e->endpoint_private || !s) { - jk_log(l, JK_LOG_EMERG, "In service, assert failed - invalid parameters\n"); + l->jkLog(l, JK_LOG_EMERG, "In service, assert failed - invalid parameters\n"); return JK_FALSE; } @@ -279,7 +279,7 @@ if(!p->attached) { /* Try to attach */ if(!(p->env = attach_to_jvm(p->worker, l))) { - jk_log(l, JK_LOG_EMERG, "Attach failed\n"); + l->jkLog(l, JK_LOG_EMERG, "Attach failed\n"); /* Is it recoverable ?? */ *is_recoverable_error = JK_TRUE; return JK_FALSE; @@ -295,7 +295,7 @@ */ *is_recoverable_error = JK_FALSE; - jk_log(l, JK_LOG_DEBUG, "In service, calling Tomcat...\n"); + l->jkLog(l, JK_LOG_DEBUG, "In service, calling Tomcat...\n"); rc = (*(p->env))->CallIntMethod(p->env, p->worker->jk_java_bridge_object, @@ -307,11 +307,11 @@ /* [V] Righ now JNIEndpoint::service() only returns 1 or 0 */ if(rc) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In service, Tomcat returned OK, done\n"); return JK_TRUE; } else { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In service, Tomcat FAILED!\n"); return JK_FALSE; } @@ -322,9 +322,9 @@ { jni_endpoint_t *p; - jk_log(l, JK_LOG_DEBUG, "Into done\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into done\n"); if(!e || !*e || !(*e)->endpoint_private) { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "In done, assert failed - invalid parameters\n"); return JK_FALSE; } @@ -337,7 +337,7 @@ free(p); *e = NULL; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Done ok\n"); return JK_TRUE; } @@ -352,17 +352,17 @@ char *str_config = NULL; JNIEnv *env; - jk_log(l, JK_LOG_DEBUG, "Into validate\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into validate\n"); if(! pThis || ! pThis->worker_private) { - jk_log(l, JK_LOG_EMERG, "In validate, assert failed - invalid parameters\n"); + l->jkLog(l, JK_LOG_EMERG, "In validate, assert failed - invalid parameters\n"); return JK_FALSE; } p = pThis->worker_private; if(p->was_verified) { - jk_log(l, JK_LOG_DEBUG, "validate, been here before, done\n"); + l->jkLog(l, JK_LOG_DEBUG, "validate, been here before, done\n"); return JK_TRUE; } @@ -379,7 +379,7 @@ } if(!p->tomcat_classpath) { - jk_log(l, JK_LOG_EMERG, "Fail-> no classpath\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> no classpath\n"); return JK_FALSE; } @@ -388,7 +388,7 @@ } if(!p->jvm_dll_path || !jk_file_exists(p->jvm_dll_path)) { - jk_log(l, JK_LOG_EMERG, "Fail-> no jvm_dll_path\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> no jvm_dll_path\n"); return JK_FALSE; } @@ -410,7 +410,7 @@ #ifdef JNI_VERSION_1_2 if(jk_get_worker_str_prop(props, p->name, "java2opts", &str_config)) { - /* jk_log(l, JK_LOG_DEBUG, "Got opts: %s\n", str_config); */ + /* l->jkLog(l, JK_LOG_DEBUG, "Got opts: %s\n", str_config); */ p->java2opts = jk_parse_sysprops(&p->p, str_config); } if(jk_get_worker_int_prop(props, p->name, "java2lax", &mem_config)) { @@ -423,26 +423,26 @@ } if(!load_jvm_dll(p, l)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't load jvm dll\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't load jvm dll\n"); /* [V] no detach needed here */ return JK_FALSE; } if(!open_jvm(p, &env, l)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't open jvm\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't open jvm\n"); /* [V] no detach needed here */ return JK_FALSE; } if(!get_bridge_object(p, env, l)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't get bridge object\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't get bridge object\n"); /* [V] the detach here may segfault on 1.1 JVM... */ detach_from_jvm(p, l); return JK_FALSE; } if(!get_method_ids(p, env, l)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't get method ids\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't get method ids\n"); /* [V] the detach here may segfault on 1.1 JVM... */ detach_from_jvm(p, l); return JK_FALSE; @@ -451,7 +451,7 @@ p->was_verified = JK_TRUE; p->tmp_env = env; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Done validate\n"); return JK_TRUE; @@ -465,17 +465,17 @@ jni_worker_t *p; JNIEnv *env; - jk_log(l, JK_LOG_DEBUG, "Into init\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into init\n"); if(! pThis || ! pThis->worker_private) { - jk_log(l, JK_LOG_EMERG, "In init, assert failed - invalid parameters\n"); + l->jkLog(l, JK_LOG_EMERG, "In init, assert failed - invalid parameters\n"); return JK_FALSE; } p = pThis->worker_private; if(p->was_initialized) { - jk_log(l, JK_LOG_DEBUG, "init, done (been here!)\n"); + l->jkLog(l, JK_LOG_DEBUG, "init, done (been here!)\n"); return JK_TRUE; } @@ -484,7 +484,7 @@ !p->jk_service_method || !p->jk_startup_method || !p->jk_shutdown_method) { - jk_log(l, JK_LOG_EMERG, "Fail-> worker not set completely\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> worker not set completely\n"); return JK_FALSE; } @@ -508,7 +508,7 @@ stderr_name = (*env)->NewStringUTF(env, p->stderr_name); } - jk_log(l, JK_LOG_DEBUG, "In init, calling Tomcat to intialize itself...\n"); + l->jkLog(l, JK_LOG_DEBUG, "In init, calling Tomcat to intialize itself...\n"); rc = (*env)->CallIntMethod(env, p->jk_java_bridge_object, p->jk_startup_method, @@ -520,16 +520,16 @@ if(rc) { p->was_initialized = JK_TRUE; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In init, Tomcat initialized OK, done\n"); return JK_TRUE; } else { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Fail-> could not initialize Tomcat\n"); return JK_FALSE; } } else { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In init, FIXME: init didn't gen env from validate!\n"); return JK_FALSE; } @@ -542,11 +542,11 @@ /* [V] This slow, needs replacement */ jni_endpoint_t *p = (jni_endpoint_t *)malloc(sizeof(jni_endpoint_t)); - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into get_endpoint\n"); if(!pThis || ! pThis->worker_private || !pend) { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "In get_endpoint, assert failed - invalid parameters\n"); return JK_FALSE; } @@ -563,7 +563,7 @@ return JK_TRUE; } else { - jk_log(l, JK_LOG_ERROR, "In get_endpoint, could not allocate endpoint\n"); + l->jkLog(l, JK_LOG_ERROR, "In get_endpoint, could not allocate endpoint\n"); return JK_FALSE; } } @@ -574,28 +574,28 @@ jni_worker_t *p; JNIEnv *env; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into destroy\n"); if(!pThis || !*pThis || ! (*pThis)->worker_private) { - jk_log(l, JK_LOG_EMERG, "In destroy, assert failed - invalid parameters\n"); + l->jkLog(l, JK_LOG_EMERG, "In destroy, assert failed - invalid parameters\n"); return JK_FALSE; } p = (*pThis)->worker_private; if(!p->jvm) { - jk_log(l, JK_LOG_DEBUG, "In destroy, JVM not intantiated\n"); + l->jkLog(l, JK_LOG_DEBUG, "In destroy, JVM not intantiated\n"); return JK_FALSE; } if(!p->jk_java_bridge_object || ! p->jk_shutdown_method) { - jk_log(l, JK_LOG_DEBUG, "In destroy, Tomcat not intantiated\n"); + l->jkLog(l, JK_LOG_DEBUG, "In destroy, Tomcat not intantiated\n"); return JK_FALSE; } if((env = attach_to_jvm(p,l))) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In destroy, shutting down Tomcat...\n"); (*env)->CallVoidMethod(env, p->jk_java_bridge_object, @@ -606,7 +606,7 @@ jk_close_pool(&p->p); free(p); - jk_log(l, JK_LOG_DEBUG, "Done destroy\n"); + l->jkLog(l, JK_LOG_DEBUG, "Done destroy\n"); return JK_TRUE; } @@ -618,16 +618,16 @@ jk_worker_t **w=result; jni_worker_t *private_data; - jk_log(l, JK_LOG_DEBUG, "Into jni_worker_factory\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into jni_worker_factory\n"); if(!name || !w) { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "In jni_worker_factory, assert failed - invalid parameters\n"); return JK_FALSE; } if(the_singleton_jni_worker) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In jni_worker_factory, instance already created\n"); *w = the_singleton_jni_worker; return JK_TRUE; @@ -636,7 +636,7 @@ private_data = (jni_worker_t *)malloc(sizeof(jni_worker_t )); if(!private_data) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jni_worker_factory, memory allocation error\n"); return JK_FALSE; } @@ -648,7 +648,7 @@ private_data->name = jk_pool_strdup(&private_data->p, name); if(!private_data->name) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jni_worker_factory, memory allocation error\n"); jk_close_pool(&private_data->p); free(private_data); @@ -686,7 +686,7 @@ *w = &private_data->worker; the_singleton_jni_worker = &private_data->worker; - jk_log(l, JK_LOG_DEBUG, "Done jni_worker_factory\n"); + l->jkLog(l, JK_LOG_DEBUG, "Done jni_worker_factory\n"); return JK_TRUE; } @@ -705,7 +705,7 @@ (FARPROC)jni_get_default_java_vm_init_args = GetProcAddress(hInst, "JNI_GetDefaultJavaVMInitArgs"); - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Loaded all JNI procs\n"); if(jni_create_java_vm && jni_get_default_java_vm_init_args && jni_get_created_java_vms) { @@ -736,13 +736,13 @@ } #else void *handle; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into load_jvm_dll, load %s\n", p->jvm_dll_path); handle = dlopen(p->jvm_dll_path, RTLD_NOW | RTLD_GLOBAL); if(!handle) { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Can't load native library %s : %s\n", p->jvm_dll_path, dlerror()); } else { @@ -750,11 +750,11 @@ jni_get_default_java_vm_init_args = dlsym(handle, "JNI_GetDefaultJavaVMInitArgs"); if(jni_create_java_vm && jni_get_default_java_vm_init_args) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In load_jvm_dll, symbols resolved, done\n"); return JK_TRUE; } - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Can't resolve JNI_CreateJavaVM or JNI_GetDefaultJavaVMInitArgs\n"); dlclose(handle); } @@ -795,16 +795,16 @@ int err; *env = NULL; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into open_jvm1\n"); vm_args.version = JNI_VERSION_1_1; if(0 != jni_get_default_java_vm_init_args(&vm_args)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n"); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm_dll, got default jvm args\n"); if(vm_args.classpath) { @@ -819,7 +819,7 @@ vm_args.classpath); p->tomcat_classpath = tmp; } else { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Fail-> allocation error for classpath\n"); return JK_FALSE; } @@ -838,15 +838,15 @@ vm_args.properties = p->sysprops; } - jk_log(l, JK_LOG_DEBUG, "In open_jvm1, about to create JVM...\n"); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm1, about to create JVM...\n"); if((err=jni_create_java_vm(&(p->jvm), &penv, &vm_args)) != 0) { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Fail-> could not create JVM, code: %d \n", err); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm1, JVM created, done\n"); *env = penv; @@ -860,7 +860,7 @@ JNIEnv *env = NULL; JDK1_1InitArgs vm_args; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into detect_jvm_version\n"); /* [V] Idea: ask for 1.2. If the JVM is 1.1 it will return 1.1 instead */ @@ -868,10 +868,10 @@ vm_args.version = JNI_VERSION_1_2; if(0 != jni_get_default_java_vm_init_args(&vm_args)) { - jk_log(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n"); + l->jkLog(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n"); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In detect_jvm_version, found: %X, done\n", vm_args.version); return vm_args.version; @@ -891,7 +891,7 @@ sprintf(tmp, "%s%s", opt_name, opt_value); return tmp; } else { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Fail-> build_opt_str allocation error for %s\n", opt_name); return NULL; } @@ -911,7 +911,7 @@ sprintf(tmp, "%s%d", opt_name, opt_value); return tmp; } else { - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Fail-> build_opt_int allocation error for %s\n", opt_name); return NULL; } @@ -929,28 +929,28 @@ *env = NULL; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into open_jvm2\n"); vm_args.version = JNI_VERSION_1_2; vm_args.options = options; if(p->tomcat_classpath) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, setting classpath to %s\n", p->tomcat_classpath); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting classpath to %s\n", p->tomcat_classpath); tmp = build_opt_str(&p->p, "-Djava.class.path=", p->tomcat_classpath, l); null_check(tmp); options[optn++].optionString = tmp; } if(p->tomcat_mx) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, setting max heap to %d\n", p->tomcat_mx); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting max heap to %d\n", p->tomcat_mx); tmp = build_opt_int(&p->p, "-Xmx", p->tomcat_mx, l); null_check(tmp); options[optn++].optionString = tmp; } if(p->tomcat_ms) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, setting start heap to %d\n", p->tomcat_ms); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting start heap to %d\n", p->tomcat_ms); tmp = build_opt_int(&p->p, "-Xms", p->tomcat_ms, l); null_check(tmp); options[optn++].optionString = tmp; @@ -959,7 +959,7 @@ if(p->sysprops) { int i = 0; while(p->sysprops[i]) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, setting %s\n", p->sysprops[i]); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting %s\n", p->sysprops[i]); tmp = build_opt_str(&p->p, "-D", p->sysprops[i], l); null_check(tmp); options[optn++].optionString = tmp; @@ -971,7 +971,7 @@ int i=0; while(p->java2opts[i]) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, using option: %s\n", p->java2opts[i]); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, using option: %s\n", p->java2opts[i]); /* Pass it "as is" */ options[optn++].optionString = p->java2opts[i++]; } @@ -980,20 +980,20 @@ vm_args.nOptions = optn; if(p->java2lax) { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, the JVM will ignore unknown options\n"); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, the JVM will ignore unknown options\n"); vm_args.ignoreUnrecognized = JNI_TRUE; } else { - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, the JVM will FAIL if it finds unknown options\n"); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, the JVM will FAIL if it finds unknown options\n"); vm_args.ignoreUnrecognized = JNI_FALSE; } - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, about to create JVM...\n"); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, about to create JVM...\n"); if((err=jni_create_java_vm(&(p->jvm), &penv, &vm_args)) != 0) { - jk_log(l, JK_LOG_EMERG, "Fail-> could not create JVM, code: %d \n", err); + l->jkLog(l, JK_LOG_EMERG, "Fail-> could not create JVM, code: %d \n", err); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, "In open_jvm2, JVM created, done\n"); + l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, JVM created, done\n"); *env = penv; @@ -1007,15 +1007,15 @@ { jmethodID constructor_method_id; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into get_bridge_object\n"); p->jk_java_bridge_class = (*env)->FindClass(env, JAVA_BRIDGE_CLASS_NAME); if(!p->jk_java_bridge_class) { - jk_log(l, JK_LOG_EMERG, "Can't find class %s\n", JAVA_BRIDGE_CLASS_NAME); + l->jkLog(l, JK_LOG_EMERG, "Can't find class %s\n", JAVA_BRIDGE_CLASS_NAME); return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In get_bridge_object, loaded %s bridge class\n", JAVA_BRIDGE_CLASS_NAME); constructor_method_id = (*env)->GetMethodID(env, @@ -1024,7 +1024,7 @@ "()V"); /* method sign */ if(!constructor_method_id) { p->jk_java_bridge_class = NULL; - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Can't find constructor\n"); return JK_FALSE; } @@ -1034,20 +1034,20 @@ constructor_method_id); if(! p->jk_java_bridge_object) { p->jk_java_bridge_class = NULL; - jk_log(l, JK_LOG_EMERG, + l->jkLog(l, JK_LOG_EMERG, "Can't create new bridge object\n"); return JK_FALSE; } p->jk_java_bridge_object = (jobject)(*env)->NewGlobalRef(env, p->jk_java_bridge_object); if(! p->jk_java_bridge_object) { - jk_log(l, JK_LOG_EMERG, "Can't create global ref to bridge object\n"); + l->jkLog(l, JK_LOG_EMERG, "Can't create global ref to bridge object\n"); p->jk_java_bridge_class = NULL; p->jk_java_bridge_object = NULL; return JK_FALSE; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In get_bridge_object, bridge built, done\n"); return JK_TRUE; } @@ -1061,7 +1061,7 @@ "startup", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I"); if(!p->jk_startup_method) { - jk_log(l, JK_LOG_EMERG, "Can't find startup()\n"); + l->jkLog(l, JK_LOG_EMERG, "Can't find startup()\n"); return JK_FALSE; } @@ -1070,7 +1070,7 @@ "service", "(JJ)I"); if(!p->jk_service_method) { - jk_log(l, JK_LOG_EMERG, "Can't find service()\n"); + l->jkLog(l, JK_LOG_EMERG, "Can't find service()\n"); return JK_FALSE; } @@ -1079,7 +1079,7 @@ "shutdown", "()V"); if(!p->jk_shutdown_method) { - jk_log(l, JK_LOG_EMERG, "Can't find shutdown()\n"); + l->jkLog(l, JK_LOG_EMERG, "Can't find shutdown()\n"); return JK_FALSE; } @@ -1091,7 +1091,7 @@ JNIEnv *rc = NULL; /* [V] This message is important. If there are signal mask issues, * * the JVM usually hangs when a new thread tries to attach to it */ - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into attach_to_jvm\n"); #if defined LINUX && defined APACHE2_SIGHACK @@ -1104,11 +1104,11 @@ #endif &rc, NULL)) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In attach_to_jvm, attached ok\n"); return rc; } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In attach_to_jvm, cannot attach thread to JVM.\n"); return NULL; } @@ -1138,15 +1138,15 @@ jk_logger_t *l) { if(!p->jvm || !(*(p->jvm))) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In detach_from_jvm, cannot detach from NULL JVM.\n"); } if(0 == (*(p->jvm))->DetachCurrentThread(p->jvm)) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In detach_from_jvm, detached ok\n"); } else { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In detach_from_jvm, cannot detach from JVM.\n"); } } 1.2 +20 -20 jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c Index: jk_lb_worker.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_lb_worker.c 2001/12/01 22:37:29 1.1 +++ jk_lb_worker.c 2001/12/02 01:05:25 1.2 @@ -60,7 +60,7 @@ * several workers. * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Based on: * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ #include "jk_pool.h" @@ -305,7 +305,7 @@ jk_logger_t *l, int *is_recoverable_error) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into jk_endpoint_t::service\n"); if(e && e->endpoint_private && s && is_recoverable_error) { @@ -354,7 +354,7 @@ /* * Error is not recoverable - break with an error. */ - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_endpoint_t::service, none recoverable error...\n"); break; } @@ -363,18 +363,18 @@ * Error is recoverable by submitting the request to * another worker... Lets try to do that. */ - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "In jk_endpoint_t::service, recoverable error... will try to recover on other host\n"); } else { /* NULL record, no more workers left ... */ - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_endpoint_t::service, No more workers left, can not submit the request\n"); break; } } } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_endpoint_t::service: NULL Parameters\n"); return JK_FALSE; @@ -383,7 +383,7 @@ static int JK_METHOD done(jk_endpoint_t **e, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into jk_endpoint_t::done\n"); if(e && *e && (*e)->endpoint_private) { @@ -398,7 +398,7 @@ return JK_TRUE; } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_endpoint_t::done: NULL Parameters\n"); return JK_FALSE; @@ -410,7 +410,7 @@ jk_logger_t *l) { int err; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into jk_worker_t::validate\n"); if(pThis && pThis->worker_private) { @@ -458,7 +458,7 @@ if(i != num_of_workers) { close_workers(p, i, l); - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_worker_t::validate: Failed to create worker %s\n", p->lb_workers[i].name); @@ -469,7 +469,7 @@ } } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_worker_t::validate: NULL Parameters\n"); return JK_FALSE; @@ -488,7 +488,7 @@ jk_endpoint_t **pend, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into jk_worker_t::get_endpoint\n"); if(pThis && pThis->worker_private && pend) { @@ -504,10 +504,10 @@ return JK_TRUE; } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_worker_t::get_endpoint, malloc failed\n"); } else { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_worker_t::get_endpoint, NULL parameters\n"); } @@ -517,7 +517,7 @@ static int JK_METHOD destroy(jk_worker_t **pThis, jk_logger_t *l) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "Into jk_worker_t::destroy\n"); if(pThis && *pThis && (*pThis)->worker_private) { @@ -533,7 +533,7 @@ return JK_TRUE; } - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "In jk_worker_t::destroy, NULL parameters\n"); return JK_FALSE; } @@ -547,16 +547,16 @@ jk_worker_t **w=result; lb_worker_t *private_data; - jk_log(l, JK_LOG_DEBUG, "Into lb_worker_factory\n"); + l->jkLog(l, JK_LOG_DEBUG, "Into lb_worker_factory\n"); if(NULL != name && NULL != w) { - jk_log(l, JK_LOG_ERROR,"In lb_worker_factory, NULL parameters\n"); + l->jkLog(l, JK_LOG_ERROR,"In lb_worker_factory, NULL parameters\n"); return JK_FALSE; } private_data = (lb_worker_t *)malloc(sizeof(lb_worker_t)); if(!private_data) { - jk_log(l, JK_LOG_ERROR,"In lb_worker_factory, malloc failed\n"); + l->jkLog(l, JK_LOG_ERROR,"In lb_worker_factory, malloc failed\n"); return JK_FALSE; } @@ -566,7 +566,7 @@ private_data->name = jk_pool_strdup(&private_data->p, name); if(! private_data->name) { - jk_log(l, JK_LOG_ERROR,"In lb_worker_factory, malloc failed\n"); + l->jkLog(l, JK_LOG_ERROR,"In lb_worker_factory, malloc failed\n"); jk_close_pool(&private_data->p); free(private_data); return JK_FALSE; 1.2 +3 -3 jakarta-tomcat-connectors/jk/native2/common/jk_msg_buff.c Index: jk_msg_buff.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_msg_buff.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_msg_buff.c 2001/12/01 22:38:39 1.1 +++ jk_msg_buff.c 2001/12/02 01:05:25 1.2 @@ -60,7 +60,7 @@ * Author: Costin <[EMAIL PROTECTED]> * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ #include "jk_pool.h" @@ -434,13 +434,13 @@ jk_msg_buf_t * msg) { #ifdef USE_ALSO_BODY - jk_log(l, file, line, level, "%s #%d %.*s\n", + l->jkLog(l, file, line, level, "%s #%d %.*s\n", what, jk_b_get_len(msg), jk_b_get_len(msg), jk_b_get_buff(msg)); #else -jk_log(l, file, line, level, "%s #%d\n", what, jk_b_get_len(msg)); +l->jkLog(l, file, line, level, "%s #%d\n", what, jk_b_get_len(msg)); #endif } 1.2 +5 -1 jakarta-tomcat-connectors/jk/native2/common/jk_registry.c Index: jk_registry.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_registry.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_registry.c 2001/12/01 22:38:39 1.1 +++ jk_registry.c 2001/12/02 01:05:25 1.2 @@ -62,7 +62,7 @@ /*************************************************************************** * Description: Worker list * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ /** Static declarations for all 'hardcoded' modules. This is a hack, @@ -110,7 +110,10 @@ int JK_METHOD jk_uriMap_factory(jk_env_t *env, void **result, char *type, char *name); +int JK_METHOD jk_logger_file_factory(jk_env_t *env, void **result, + char *type, char *name); + /** * Init the components that we compile in by default. * In future we should have a more flexible mechanism that would allow @@ -131,6 +134,7 @@ * and because the MetroWerks compiler (used for NetWare) treats this as an * error, I'm casting the function pointers to (void *) - mmanders */ + env->registerFactory( env, "logger", "file", &jk_logger_file_factory ); env->registerFactory( env, "workerEnv", "default", &jk_workerEnv_factory ); env->registerFactory( env, "uriMap", "default", &jk_uriMap_factory ); env->registerFactory( env, "worker", "ajp13", &jk_worker_ajp14_factory ); 1.2 +27 -25 jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c Index: jk_uriMap.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_uriMap.c 2001/12/01 22:34:38 1.1 +++ jk_uriMap.c 2001/12/02 01:05:25 1.2 @@ -59,15 +59,15 @@ * Description: URI to worker map object. * * Maps can be * * * - * Exact Context -> /exact/uri=worker e.g. /examples/do*=ajp12 * - * Context Based -> /context/*=worker e.g. /examples/*=ajp12 * - * Context and suffix ->/context/*.suffix=worker e.g. /examples/*.jsp=ajp12* + * Exact Context -> /exact/uri=worker e.g. /examples/do *=ajp12 * + * Context Based -> /context/ *=worker e.g. /examples/ *=ajp12 * + * Context and suffix ->/context/*.suffix=worker e.g. /examples/ *.jsp=ajp12* * * * This lets us either partition the work among the web server and the * * servlet container. * * * * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ #include "jk_pool.h" @@ -128,7 +128,7 @@ /* int uriMap_free(jk_uriMap_t **_this, */ /* jk_logger_t *l) */ /* { */ -/* jk_log(l, JK_LOG_DEBUG, */ +/* l->jkLog(l, JK_LOG_DEBUG, */ /* "Into jk_uriMap_t::uriMap_free\n"); */ /* if(_this && *_this) { */ @@ -138,7 +138,7 @@ /* return JK_TRUE; */ /* } */ /* else */ -/* jk_log(l, JK_LOG_ERROR, */ +/* l->jkLog(l, JK_LOG_ERROR, */ /* "In jk_uriMap_t::uriMap_free, NULL parameters\n"); */ /* return JK_FALSE; */ @@ -195,7 +195,7 @@ worker = jk_pool_strdup(&_this->p, pworker); if (err || !uri || ! worker || ! uwr ) { - jk_log(l, JK_LOG_ERROR,"Allocation error\n"); + l->jkLog(l, JK_LOG_ERROR,"Allocation error\n"); return NULL; } @@ -206,7 +206,7 @@ * I have fixed jk_mount_context() in apaches/mod_jk.c so we should * not arrive here when using Apache. */ - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "uriMap.addMapping() context must start with '/' in %s\n", uri); return NULL; @@ -227,7 +227,7 @@ uwr->context = uri; uwr->suffix = NULL; uwr->match_type = MATCH_TYPE_EXACT; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.addMapping() exact mapping %s=%s was added\n", uri, worker); return uwr; @@ -236,7 +236,7 @@ uwr->uri = jk_pool_strdup(&_this->p, uri); if (!uwr->uri) { - jk_log(l, JK_LOG_ERROR,"Allocation error\n"); + l->jkLog(l, JK_LOG_ERROR,"Allocation error\n"); return NULL; } @@ -256,7 +256,7 @@ uwr->context = uri; uwr->suffix = asterisk + 3; uwr->match_type = MATCH_TYPE_SUFFIX; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.addMapping() suffix mapping %s.%s=%s was added\n", uri, asterisk + 3, worker); } else if ('\0' != asterisk[2]) { @@ -266,7 +266,7 @@ uwr->context = uri; uwr->suffix = asterisk + 2; uwr->match_type = MATCH_TYPE_GENERAL_SUFFIX; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.addMapping() general suffix mapping %s.%s=%s\n", uri, asterisk + 2, worker); } else { @@ -276,7 +276,7 @@ uwr->context = uri; uwr->suffix = NULL; uwr->match_type = MATCH_TYPE_CONTEXT; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.addMapping() context mapping %s=%s\n", uri, worker); } @@ -287,7 +287,7 @@ uwr->context = uri; uwr->suffix = NULL; uwr->match_type = MATCH_TYPE_EXACT; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.addMapping() prefix mapping %s=%s\n", uri, worker); } @@ -317,7 +317,7 @@ sz = map_size(init_data); - jk_log(l, JK_LOG_DEBUG, "uriMap.open(): initializing %d rules\n", sz); + l->jkLog(l, JK_LOG_DEBUG, "uriMap.open(): initializing %d rules\n", sz); if (sz <= 0) { return JK_TRUE; @@ -329,7 +329,7 @@ map_name_at(init_data, i), map_value_at(init_data, i)); if ( uriEnv==NULL) { - jk_log(l, JK_LOG_ERROR, "Parsing error %s\n", + l->jkLog(l, JK_LOG_ERROR, "Parsing error %s\n", map_name_at(init_data, i)); rc=JK_FALSE; } @@ -340,7 +340,9 @@ static void jk_uriMap_destroy(jk_uriMap_t *_this) { - jk_log(_this->workerEnv->l, JK_LOG_DEBUG, + jk_logger_t *l=_this->workerEnv->l; + + l->jkLog(l, JK_LOG_DEBUG, "uriMap.destroy()\n"); /* this can't be null ( or a NPE would have been generated */ @@ -408,11 +410,11 @@ if( _this->size <= 0 ) return NULL; - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.mapUri() %s %s\n", vhost, uri); if( '/' != uri[0]) { - jk_log(l, JK_LOG_ERROR, + l->jkLog(l, JK_LOG_ERROR, "uriMap.mapUri() uri must start with /\n"); return NULL; } @@ -442,14 +444,14 @@ if(MATCH_TYPE_EXACT == uwr->match_type) { if(strlen(uri) == uwr->ctxt_len) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.mapUri() exact match %s:%s \n", uwr->worker->name, uwr->context ); return uwr->worker; } } else if(MATCH_TYPE_CONTEXT == uwr->match_type) { if(uwr->ctxt_len > longest_match) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.mapUri() tentative prefix match %s", uwr->context ); longest_match = uwr->ctxt_len; @@ -459,7 +461,7 @@ int suffix_start=last_index_of(uri,uwr->suffix[0]); if (suffix_start>=0 && 0==strcmp(uri+suffix_start,uwr->suffix)) { if(uwr->ctxt_len >= longest_match) { - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.mapUri() general suffix match %s\n", uwr->suffix ); longest_match = uwr->ctxt_len; @@ -475,7 +477,7 @@ if(0 == strcmp(suffix, uwr->suffix)) { #endif if(uwr->ctxt_len >= longest_match) { - jk_log(l,JK_LOG_DEBUG, + l->jkLog(l,JK_LOG_DEBUG, "uriMap.mapUri() suffix match %s\n", uwr->suffix ); longest_match = uwr->ctxt_len; @@ -495,7 +497,7 @@ return _this->maps[best_match]->worker; } - jk_log(l, JK_LOG_DEBUG, + l->jkLog(l, JK_LOG_DEBUG, "uriMap.mapUri() no match found\n"); return NULL; @@ -513,7 +515,7 @@ _this->capacity = 0; if( ! _this) { - jk_log(l, JK_LOG_ERROR, "Allocation error\n"); + l->jkLog(l, JK_LOG_ERROR, "Allocation error\n"); return JK_FALSE; } *result=_this; 1.2 +13 -1 jakarta-tomcat-connectors/jk/native2/common/jk_util.c Index: jk_util.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_util.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_util.c 2001/12/01 22:38:39 1.1 +++ jk_util.c 2001/12/02 01:05:25 1.2 @@ -59,7 +59,7 @@ * Description: Utility functions (mainly configuration) * * Author: Gal Shachor <[EMAIL PROTECTED]> * * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***************************************************************************/ @@ -556,3 +556,15 @@ s->num_attributes = 0; s->jvm_route = NULL; } + +int jk_file_exists(const char *f) +{ + if(f) { + struct stat st; + if((0 == stat(f, &st)) && (st.st_mode & S_IFREG)) { + return JK_TRUE; + } + } + return JK_FALSE; +} +
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>