[EMAIL PROTECTED] wrote:
mturk       2004/11/11 23:46:49

Modified: jk/native/common jk_mt.h jk_util.c
Log:
Fix Netware getpid/gettid.
Revision Changes Path
1.8 +10 -6 jakarta-tomcat-connectors/jk/native/common/jk_mt.h
Index: jk_mt.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_mt.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- jk_mt.h 11 Nov 2004 17:04:04 -0000 1.7
+++ jk_mt.h 12 Nov 2004 07:46:48 -0000 1.8
@@ -25,6 +25,13 @@
#include "jk_global.h"
+
+#if defined(WIN32)
+#define jk_gettid() ((int)GetCurrentThreadId())
+#elif defined(NETWARE)
+#define jk_gettid() ((int)GetThreadID())
+#endif
+
/*
* All WIN32 code is MT, UNIX code that uses pthreads is marked by the POSIX * _REENTRANT define.
@@ -47,8 +54,6 @@
#define JK_ENTER_CS(x, rc) EnterCriticalSection(x); rc = JK_TRUE;
#define JK_LEAVE_CS(x, rc) LeaveCriticalSection(x); rc = JK_TRUE;
-#define JK_THREADID() ((int)GetCurrentThreadId())
-
#else /* Unix pthreads */
#include <pthread.h>
@@ -67,8 +72,7 @@
#define JK_LEAVE_CS(x, rc)\
if(pthread_mutex_unlock(x)) rc = JK_FALSE; else rc = JK_TRUE;
-#define JK_THREADID() ((int)pthread_self())
-
+#define jk_gettid() ((int)pthread_self())
#endif /* Unix pthreads */
#else /* Not an MT code */
@@ -79,7 +83,7 @@
#define JK_DELETE_CS(x, rc) rc = JK_TRUE;
#define JK_ENTER_CS(x, rc) rc = JK_TRUE;
#define JK_LEAVE_CS(x, rc) rc = JK_TRUE;
-#define JK_THREADID() 0
+#define jk_gettid() 0
#endif /* Not an MT code */
1.36 +3 -3 jakarta-tomcat-connectors/jk/native/common/jk_util.c
Index: jk_util.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- jk_util.c 11 Nov 2004 17:06:06 -0000 1.35
+++ jk_util.c 12 Nov 2004 07:46:48 -0000 1.36
@@ -272,11 +272,11 @@
#ifdef USE_SPRINTF /* until we get a snprintf function */ if (line)
used += sprintf(&buf[used], "[%d:%d] ", getpid(),
- JK_THREADID());
+ jk_gettid());
#else
if (line)
used += snprintf(&buf[used], HUGE_BUFFER_SIZE, "[%d:%d] ",
- getpid(), JK_THREADID());
+ getpid(), jk_gettid());
#endif
if (used < 0) {
return 0; /* [V] not sure what to return... */


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


.

Greetings,
Sad to say, the latest CVS jk_util.c still contains, at lines 275 and 279, two references to 'getpid', one of which (not sure which) is still causing CW to abort when building for Apache 1.3. Apache-2.x mod_jk(s) build without issue because the build scripts include hooks into the Apache 2.x source and pick up the 'getpid' definition from there.


The os.h (for Apache 1.3) has a definition for 'getpid' as follows:

#define getpid() ((pid_t)GetThreadGroupID())

Unfortunately the GetThreadGroupID() isn't part of LibC. So, another patch is attached, which adapts jk_mt.h for NetWare, and have been able to successfully build for Apache 2.0, 2.1 and Apache 1.3 using this. If this is the best solution for you or NetWare I am unable to say.

Regards,
Norm

--- jk_mt.h.orig        2004-11-12 20:10:05.000000000 +1100
+++ jk_mt.h     2004-11-12 21:11:17.000000000 +1100
@@ -29,6 +29,9 @@
 #if defined(WIN32)
 #define jk_gettid()    ((int)GetCurrentThreadId())
 #elif defined(NETWARE)
+#if !defined(__NOVELL_LIBC__)
+#define getpid()       ((pid_t)GetThreadGroupID())
+#endif
 #define jk_gettid()    ((int)GetThreadID())
 #endif

--------------------------------
--- jk_mt.h.orig        2004-11-12 20:10:05.000000000 +1100
+++ jk_mt.h     2004-11-12 21:11:17.000000000 +1100
@@ -29,6 +29,9 @@
 #if defined(WIN32)
 #define jk_gettid()    ((int)GetCurrentThreadId())
 #elif defined(NETWARE)
+#if !defined(__NOVELL_LIBC__)
+#define getpid()       ((pid_t)GetThreadGroupID())
+#endif
 #define jk_gettid()    ((int)GetThreadID())
 #endif
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to