Author: rjung
Date: Sun Jun 24 12:00:08 2007
New Revision: 550275
URL: http://svn.apache.org/viewvc?view=rev&rev=550275
Log:
Handle LWP IDs as 32 Bit unsigned.
Try to make it work, although pthread IDs are opaque.
Code basically borrowed from APR.
Modified:
tomcat/connectors/trunk/jk/native/common/jk_mt.h
tomcat/connectors/trunk/jk/native/common/jk_util.c
tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
Modified: tomcat/connectors/trunk/jk/native/common/jk_mt.h
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_mt.h?view=diff&rev=550275&r1=550274&r2=550275
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_mt.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_mt.h Sun Jun 24 12:00:08 2007
@@ -28,7 +28,7 @@
#if defined(WIN32)
-#define jk_gettid() ((int)GetCurrentThreadId())
+#define jk_gettid() ((jk_uint32_t)GetCurrentThreadId())
#elif defined(NETWARE) && !defined(__NOVELL_LIBC__)
#define getpid() ((int)GetThreadGroupID())
#endif
@@ -71,7 +71,7 @@
#define JK_LEAVE_CS(x, rc)\
if(pthread_mutex_unlock(x)) rc = JK_FALSE; else rc = JK_TRUE
-int jk_gettid(void);
+jk_uint32_t jk_gettid(void);
#endif /* WIN32 */
#else /* !_MT_CODE */
Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?view=diff&rev=550275&r1=550274&r2=550275
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sun Jun 24 12:00:08 2007
@@ -499,7 +499,7 @@
/* Performance is no issue, because with production log levels */
/* we only call it often, if we have a lot of errors */
rc = snprintf(&buf[used], usable_size - used,
- "[%" JK_PID_T_FMT ":%04d] ", getpid(),
jk_gettid());
+ "[%" JK_PID_T_FMT ":%" JK_UINT32_T_FMT "] ",
getpid(), jk_gettid());
used += rc;
if (rc < 0 || usable_size - used < 8) {
return 0;
@@ -1697,17 +1697,27 @@
}
#ifdef _MT_CODE_PTHREAD
-int jk_gettid()
+jk_uint32_t jk_gettid()
{
- pthread_t t = pthread_self();
+ union {
+ pthread_t tid;
+ jk_uint64_t alignme;
+ } u;
+ u.tid = pthread_self();
#ifdef AS400
/* OS400 use 64 bits ThreadId, get only low 32 bits for now */
pthread_id_np_t tid;
- pthread_getunique_np(&t, &tid);
- return ((int)(tid.intId.lo & 0xFFFFFFFF));
+ pthread_getunique_np(&(u.tid), &tid);
+ return ((jk_uint32_t)(tid.intId.lo & 0xFFFFFFFF));
#else
- int tid = ((int)t) & 0xFFFF;
- return tid;
+ switch(sizeof(pthread_t)) {
+ case sizeof(jk_uint32_t):
+ return *(jk_uint32_t *)&u.tid;
+ case sizeof(jk_uint64_t):
+ return (*(jk_uint64_t *)&u.tid) & 0xFFFFFFFF;
+ default:
+ return 0;
+ }
#endif /* AS400 */
}
#endif
@@ -1815,4 +1825,3 @@
}
#endif
-
Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=550275&r1=550274&r2=550275
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jun 24
12:00:08 2007
@@ -28,6 +28,10 @@
<subsection name="Native">
<changelog>
<update>
+ Logging: handle LWP IDs as 32 Bit unsigned. Try to make
+ it work, although pthread IDs are opaque. (rjung)
+ </update>
+ <update>
JkStatus: Added manipulation of max_reply_timeouts. (rjung)
</update>
<update>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]