cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2003-02-03 Thread mturk
mturk   2003/02/03 23:40:51

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Update license to 2003.
  
  Revision  ChangesPath
  1.44  +1 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- jk_jni_aprImpl.c  20 Nov 2002 16:40:10 -  1.43
  +++ jk_jni_aprImpl.c  4 Feb 2003 07:40:51 -   1.44
  @@ -2,7 +2,7 @@
*   *
* The Apache Software License,  Version 1.1 *
*   *
  - *  Copyright (c) 1999-2002 The Apache Software Foundation.  *
  + *  Copyright (c) 1999-2003 The Apache Software Foundation.  *
*   All rights reserved.*
*   *
* = *
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-11-20 Thread mturk
mturk   2002/11/20 07:03:19

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Fix the POST data.
  The reply buffer shuld containg the endpoint's post message.
  
  Revision  ChangesPath
  1.42  +1 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- jk_jni_aprImpl.c  25 Sep 2002 08:02:58 -  1.41
  +++ jk_jni_aprImpl.c  20 Nov 2002 15:03:18 -  1.42
  @@ -502,7 +502,7 @@
   /*  ep-reply-pos, ep-reply-len , ep-reply-buf ); */
   ep-reply-end( env, ep-reply );
   
  -(*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-reply-len + 4 , 
(jbyte *)ep-reply-buf );
  +(*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-post-len + 4 , 
(jbyte *)ep-post-buf );
   rc=JK_OK;
   }
   } 
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-11-20 Thread mturk
mturk   2002/11/20 08:40:10

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Revert the usage of post msg.
  Use the suplied reply, and fix the 4 byte out-of-bounds exception
  
  Revision  ChangesPath
  1.43  +1 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- jk_jni_aprImpl.c  20 Nov 2002 15:03:18 -  1.42
  +++ jk_jni_aprImpl.c  20 Nov 2002 16:40:10 -  1.43
  @@ -502,7 +502,7 @@
   /*  ep-reply-pos, ep-reply-len , ep-reply-buf ); */
   ep-reply-end( env, ep-reply );
   
  -(*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-post-len + 4 , 
(jbyte *)ep-post-buf );
  +(*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-reply-len, (jbyte 
*)ep-reply-buf );
   rc=JK_OK;
   }
   } 
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-09-25 Thread mturk

mturk   2002/09/25 01:02:59

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  #ifdef with HAVE_JNI preprocessor flag to be able to compile on
  Apache 1.3 without JNI and APR.
  
  Revision  ChangesPath
  1.41  +3 -0  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- jk_jni_aprImpl.c  10 Jul 2002 00:35:27 -  1.40
  +++ jk_jni_aprImpl.c  25 Sep 2002 08:02:58 -  1.41
  @@ -61,6 +61,8 @@
* @author Costin Manolache
*/
   
  +#ifdef HAVE_JNI
  +
   #include jni.h
   #include apr.h
   #include apr_pools.h
  @@ -581,3 +583,4 @@
   }
   
   
  +#endif /* HAVE_JNI */
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-07-09 Thread nacho

nacho   2002/07/09 17:35:27

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Fixed some (Java?) leaks
  
  Revision  ChangesPath
  1.40  +11 -15jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- jk_jni_aprImpl.c  30 Jun 2002 09:57:38 -  1.39
  +++ jk_jni_aprImpl.c  10 Jul 2002 00:35:27 -  1.40
  @@ -313,15 +313,11 @@
   else if (strcmp(value, done) == 0)
  jk_jni_status_code = JNI_TOMCAT_STARTED;
   }
  -return JK_OK;
  -}
  -
  -if( component-setAttribute ==NULL )
  -return JK_OK;
  -
  -if( component-setAttribute!=NULL ) {
  -rc=component-setAttribute( env, component, name,
  -component-pool-pstrdup( env, component-pool, 
value ) );
  +} else {
  +if( component-setAttribute!=NULL ) {
  +rc=component-setAttribute( env, component, name,
  +component-pool-pstrdup( env, 
component-pool, value ) );
  +}
   }
   
   (*jniEnv)-ReleaseStringUTFChars(jniEnv, nameJ, name);
  @@ -379,12 +375,12 @@
   char *value;
   jstring valueJ=NULL;
   
  -if( component-setAttribute ==NULL )
  -return JK_OK;
  -
  -value=component-getAttribute( env, component, name );
  -if( value!=NULL )
  -valueJ=(*jniEnv)-NewStringUTF(jniEnv, value);
  +if( component-getAttribute !=NULL ){   
  +value=component-getAttribute( env, component, name );
  +if( value!=NULL ) {
  +valueJ=(*jniEnv)-NewStringUTF(jniEnv, value);
  +}
  +}
   
   (*jniEnv)-ReleaseStringUTFChars(jniEnv, nameJ, name);
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-30 Thread mturk

mturk   2002/06/30 02:57:38

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Removed the jkStatus native call.
  Use the jkSetAttribute for TC startup signaling.
  
  Revision  ChangesPath
  1.39  +15 -13jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- jk_jni_aprImpl.c  29 Jun 2002 07:44:04 -  1.38
  +++ jk_jni_aprImpl.c  30 Jun 2002 09:57:38 -  1.39
  @@ -98,6 +98,8 @@
   #define JK_GET_REGION 1
   #define JK_GET_BYTE_ARRAY_ELEMENTS 2
   #define JK_DIRECT_BUFFER_NIO 3
  +#define JNI_TOMCAT_STARTING 1
  +#define JNI_TOMCAT_STARTED 2
   
   static int arrayAccessMethod=JK_GET_REGION;
   void JK_METHOD jk2_env_setAprPool( jk_env_t *env, void *aprPool );
  @@ -301,6 +303,19 @@
   char *value=(char *)(*jniEnv)-GetStringUTFChars(jniEnv, valueJ, 0);
   int rc=JK_OK;
   
  +/* XXX need to find a way how to set this to channel:jni component
  + * instead of global variable.
  + */
  +if(env == NULL || component == NULL) {
  +if (strcmp(name, channel:jni) == 0) {
  +if (strcmp(value, starting) == 0)
  +jk_jni_status_code = JNI_TOMCAT_STARTING;
  +else if (strcmp(value, done) == 0)
  +   jk_jni_status_code = JNI_TOMCAT_STARTED;
  +}
  +return JK_OK;
  +}
  +
   if( component-setAttribute ==NULL )
   return JK_OK;
   
  @@ -505,15 +520,6 @@
   return rc;
   }
   
  -/*
  -*/
  -JNIEXPORT void JNICALL 
  -Java_org_apache_jk_apr_AprImpl_jkStatus
  -  (JNIEnv *jniEnv, jobject o, jint statusCode )
  -{
  -jk_jni_status_code = statusCode;
  -}
  -
   static JNINativeMethod org_apache_jk_apr_AprImpl_native_methods[] = {
   { 
   initialize, ()I, 
  @@ -562,10 +568,6 @@
   {
   jkRecycle, (JJ)V,
   Java_org_apache_jk_apr_AprImpl_jkRecycle
  -},
  -{
  -jkStatus, (I)V,
  -Java_org_apache_jk_apr_AprImpl_jkStatus
   },
   };
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-29 Thread mturk

mturk   2002/06/29 00:44:04

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Introduced new native function jkStatus that signals the
  TC startup status to the server for now.
  
  Revision  ChangesPath
  1.38  +14 -0 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- jk_jni_aprImpl.c  11 Jun 2002 22:51:29 -  1.37
  +++ jk_jni_aprImpl.c  29 Jun 2002 07:44:04 -  1.38
  @@ -93,6 +93,8 @@
   
   static int jniDebug=0;
   
  +int jk_jni_status_code=0;
  +
   #define JK_GET_REGION 1
   #define JK_GET_BYTE_ARRAY_ELEMENTS 2
   #define JK_DIRECT_BUFFER_NIO 3
  @@ -503,6 +505,14 @@
   return rc;
   }
   
  +/*
  +*/
  +JNIEXPORT void JNICALL 
  +Java_org_apache_jk_apr_AprImpl_jkStatus
  +  (JNIEnv *jniEnv, jobject o, jint statusCode )
  +{
  +jk_jni_status_code = statusCode;
  +}
   
   static JNINativeMethod org_apache_jk_apr_AprImpl_native_methods[] = {
   { 
  @@ -552,6 +562,10 @@
   {
   jkRecycle, (JJ)V,
   Java_org_apache_jk_apr_AprImpl_jkRecycle
  +},
  +{
  +jkStatus, (I)V,
  +Java_org_apache_jk_apr_AprImpl_jkStatus
   },
   };
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-11 Thread costin

costin  2002/06/11 15:51:30

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Remove the moved code.
  
  Few cleanups, start using 2 macros from conversion jlong to/from pointer.
  
  Revision  ChangesPath
  1.37  +30 -191   jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- jk_jni_aprImpl.c  11 Jun 2002 02:51:18 -  1.36
  +++ jk_jni_aprImpl.c  11 Jun 2002 22:51:29 -  1.37
  @@ -79,27 +79,12 @@
   #include jk_pool.h
   #include jk_logger.h
   
  -#ifndef WIN32
  -#include unistd.h
  -#include pwd.h
  -#endif
  -
   #if APR_HAVE_SYS_TYPES_H
   #include sys/types.h
   #endif
   
  -#if APR_HAS_SHARED_MEMORY
  -#include apr_shm.h
  -#endif
  -
  -#ifdef HAVE_SIGNAL
  -#include signal.h
  -#endif
  -
  -/* jniAprPool is the 'master pool' for standalone use ( i.e. not inprocess )
  -   All resources are allocated in this pool
  -*/
  -static apr_pool_t *jniAprPool=NULL;
  +#define P2J(jk_pointer) ((jlong)(long)(void *)jk_pointer)
  +#define J2P(p, jktype) ((jktype)(void *)(long)p)
   
   /** Access to the jk workerEnv. This field and jk_env_globalEnv are used
   to interact with the jk components 
  @@ -122,7 +107,13 @@
   }
   
   /*  Apr initialization and pools  */
  - 
  +
  +/** Initialize APR and jk, for standalone use. If we use in-process mode,
  +i.e. an application using jk to launch an in-process JVM - this function
  +will not do anything, since the setup is already done.
  +
  +The code is identical with what mod_jk is doing.
  +*/
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_initialize(JNIEnv *jniEnv, jobject _jthis)
   {
  @@ -130,6 +121,7 @@
   
   /* For in-process the env is initialized already */
   if( jk_env_globalEnv == NULL ) {
  +apr_pool_t *jniAprPool=NULL;
   jk_pool_t *globalPool;
   
   apr_initialize(); 
  @@ -182,6 +174,8 @@
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_terminate(JNIEnv *jniEnv, jobject _jthis)
   {
  +apr_pool_t *jniAprPool=jk_env_globalEnv-getAprPool(jk_env_globalEnv);
  +
   if ( jniAprPool!=NULL ) {
   apr_pool_destroy(jniAprPool);
   jniAprPool = NULL;
  @@ -190,144 +184,6 @@
   return 0;
   }
   
  -/*  Signals  */
  -/* XXX Move it to jk_signal.c */
  -
  -#ifdef HAVE_SIGNALS
  -static struct sigaction jkAction;
  -
  -/* We use a jni channel to send the notification to java
  - */
  -static jk_channel_t *jniChannel;
  -
  -/* XXX we should sync or use multiple endpoints if multiple signals
  -   can be concurent
  -*/
  -static jk_endpoint_t *signalEndpoint;
  -
  -static void jk2_SigAction(int sig) {
  -jk_env_t *env;
  -
  -/* Make a callback using the jni channel */
  -fprintf(stderr, Signal %d\n, sig );
  -
  -if( jk_env_globalEnv == NULL ) {
  -return;
  -}
  -
  -env=jk_env_globalEnv-getEnv( jk_env_globalEnv );
  -
  -if( jniChannel==NULL ) {
  -jniChannel=env-getByName( env, channel.jni:jni );
  -fprintf(stderr, Got jniChannel %#lx\n, jniChannel );
  -}
  -if( jniChannel==NULL ) {
  -return;
  -}
  -if( signalEndpoint == NULL ) {
  -jk_bean_t *component=env-createBean2( env, NULL, endpoint, NULL );
  -if( component == NULL ) {
  -fprintf(stderr, Can't create endpoint\n );
  -return;
  -}
  -component-init( env, component );
  -fprintf(stderr, Create endpoint %#lx\n, component-object );
  -signalEndpoint=component-object;
  -}
  -
  -/* Channel:jni should be initialized by the caller */
  -
  -/* XXX make the callback */
  -
  -jk_env_globalEnv-releaseEnv( jk_env_globalEnv, env );
  -
  -}
  -
  -
  -/* XXX We need to: - preserve the old signal ( or get them ) - either
  - implement waitSignal or use invocation in jk2_SigAction
  -
  - Probably waitSignal() is better ( we can have a thread that waits )
  - */
  -
  -JNIEXPORT jint JNICALL 
  -Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint signalNr 
)
  -{
  -memset( jkAction, 0, sizeof(jkAction));
  -jkAction.sa_handler=jk2_SigAction;
  -sigaction((int)signalNr, jkAction, (void *) NULL);
  -return 0;
  -}
  -
  -JNIEXPORT jint JNICALL 
  -Java_org_apache_jk_apr_AprImpl_sendSignal(JNIEnv *jniEnv, jobject _jthis, jint 
target ,
  -  jint signo)
  -{
  -return kill( (pid_t)target, (int)signo );
  -}
  -
  -#else /* ! HAVE_SIGNALS */
  -
  -JNIEXPORT jint JNICALL 
  -Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint signalNr 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-10 Thread costin

costin  2002/06/10 14:30:48

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Last part of the patch from  Mladen Turk, with few changes.
  
  The apr_initialize() is called if no jk_globalEnv is found, which means
  jk wasn't initialized so probably we are in Java standalone mode, and
  java just loaded libjkjni.so and libapr.so.
  
  Revision  ChangesPath
  1.32  +100 -8jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- jk_jni_aprImpl.c  7 Jun 2002 23:42:19 -   1.31
  +++ jk_jni_aprImpl.c  10 Jun 2002 21:30:48 -  1.32
  @@ -96,8 +96,16 @@
   #include signal.h
   #endif
   
  -static apr_pool_t *jniAprPool;
  +/* jniAprPool is the 'master pool' for standalone use ( i.e. not inprocess )
  +   All resources are allocated in this pool
  +*/
  +static apr_pool_t *jniAprPool=NULL;
  +
  +/** Access to the jk workerEnv. This field and jk_env_globalEnv are used
  +to interact with the jk components 
  + */
   static jk_workerEnv_t *workerEnv;
  +
   static int jniDebug=0;
   
   #define JK_GET_REGION 1
  @@ -113,25 +121,28 @@
   }
   
   /*  Apr initialization and pools  */
  -
  + 
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_initialize(JNIEnv *jniEnv, jobject _jthis)
   {
   jk_env_t *env;
  -
  -apr_initialize(); 
  -apr_pool_create( jniAprPool, NULL );
   
  +/* For in-process the env is initialized already */
   if( jk_env_globalEnv == NULL ) {
   jk_pool_t *globalPool;
   
  +apr_initialize(); 
  +apr_pool_create( jniAprPool, NULL );
  +
   if( jniAprPool==NULL ) {
  -return 0;
  +return JK_ERR;
   }
   jk2_pool_apr_create( NULL, globalPool, NULL, jniAprPool );
   /* Create the global env */
   env=jk2_env_getEnv( NULL, globalPool );
  +env-setAprPool(env, gPool);
   }
  +
   env=jk_env_globalEnv;
   
   workerEnv=env-getByName( env, workerEnv );
  @@ -160,14 +171,18 @@
   
   workerEnv-init( env, workerEnv );
   }
  -/* fprintf( stderr, XXX aprImpl: %p %p\n, env, workerEnv); */
  -return 0;
  +
  +return JK_OK;
   }
   
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_terminate(JNIEnv *jniEnv, jobject _jthis)
   {
  +if ( jniAprPool!=NULL ) {
  +apr_pool_destroy(jniAprPool);
  +jniAprPool = NULL;
   /* apr_terminate(); */
  +}
   return 0;
   }
   
  @@ -621,6 +636,83 @@
   /* env-l-jkLog(env, env-l, JK_LOG_INFO, jkInvoke() done\n); */
   
   return rc;
  +}
  +
  +
  +static JNINativeMethod org_apache_jk_apr_AprImpl_native_methods[] = {
  +{ 
  +initialize, ()I, 
  +Java_org_apache_jk_apr_AprImpl_initialize 
  +},
  +{ 
  +terminate, ()I,
  +Java_org_apache_jk_apr_AprImpl_terminate
  +},
  +{ 
  +getJkEnv, ()J,
  +Java_org_apache_jk_apr_AprImpl_getJkEnv
  +},
  +{
  +releaseJkEnv, (J)V,
  +Java_org_apache_jk_apr_AprImpl_releaseJkEnv
  +},
  +{ 
  +getJkHandler, (JLjava/lang/String;)J,
  +Java_org_apache_jk_apr_AprImpl_getJkHandler
  +},
  +{
  +createJkHandler, (JLjava/lang/String;)J,
  +Java_org_apache_jk_apr_AprImpl_createJkHandler
  +},
  +{
  +jkSetAttribute, (JJLjava/lang/String;Ljava/lang/String;)I,
  +Java_org_apache_jk_apr_AprImpl_jkSetAttribute
  +},
  +{
  +jkGetAttribute, (JJLjava/lang/String;)Ljava/lang/String;,
  +Java_org_apache_jk_apr_AprImpl_jkGetAttribute
  +},
  +{
  +jkInit, (JJ)I,
  +Java_org_apache_jk_apr_AprImpl_jkInit
  +},
  +{
  +jkDestroy, (JJ)I,
  +Java_org_apache_jk_apr_AprImpl_jkDestroy
  +},
  +{
  +jkInvoke, (JJJI[BIII)I,
  +Java_org_apache_jk_apr_AprImpl_jkInvoke
  +},
  +{
  +jkRecycle, (JJ)V,
  +Java_org_apache_jk_apr_AprImpl_jkRecycle
  +},
  +{
  +setUser, (Ljava/lang/String;Ljava/lang/String;)I,
  +Java_org_apache_jk_apr_AprImpl_setUser
  +},
  +{
  +signal, (I)I,
  +Java_org_apache_jk_apr_AprImpl_signal
  +},
  +{
  +sendSignal, (II)V,
  +Java_org_apache_jk_apr_AprImpl_sendSignal
  +}
  +};
  +
  +/*
  +  Register Native methods returning the total number of
  +  native functions
  +*/
  +jint jk_jni_aprImpl_registerNatives(JNIEnv *jniEnv, jclass bridgeClass)
  +{
  +  
  +   return (*jniEnv)-RegisterNatives(jniEnv, bridgeClass,
  +org_apache_jk_apr_AprImpl_native_methods,
  +

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-10 Thread costin

costin  2002/06/10 14:36:15

  Modified:jk/native2/common jk_worker_jni.c
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  Me again, spell errors.
  
  Revision  ChangesPath
  1.17  +1 -0  jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c
  
  Index: jk_worker_jni.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_worker_jni.c   10 Jun 2002 21:27:39 -  1.16
  +++ jk_worker_jni.c   10 Jun 2002 21:36:15 -  1.17
  @@ -77,6 +77,7 @@
   
   /* default only, will be  configurable  */
   #define JAVA_BRIDGE_CLASS_NAME (org/apache/jk/apr/TomcatStarter)
  +#define JAVA_BRIDGE_CLASS_APRI (org/apache/jk/apr/AprImpl)
   
   struct jni_worker_data {
   jclass  jk_java_bridge_class;
  
  
  
  1.33  +1 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jk_jni_aprImpl.c  10 Jun 2002 21:30:48 -  1.32
  +++ jk_jni_aprImpl.c  10 Jun 2002 21:36:15 -  1.33
  @@ -140,7 +140,7 @@
   jk2_pool_apr_create( NULL, globalPool, NULL, jniAprPool );
   /* Create the global env */
   env=jk2_env_getEnv( NULL, globalPool );
  -env-setAprPool(env, gPool);
  +env-setAprPool(env, globalPool);
   }
   
   env=jk_env_globalEnv;
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-10 Thread nacho

nacho   2002/06/10 14:49:53

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  * Changed %p format specifiers to %#lx - Thanks to JFC
  * Only relase array if arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS
  
  Revision  ChangesPath
  1.34  +19 -16jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- jk_jni_aprImpl.c  10 Jun 2002 21:36:15 -  1.33
  +++ jk_jni_aprImpl.c  10 Jun 2002 21:49:53 -  1.34
  @@ -2,7 +2,7 @@
*   *
* The Apache Software License,  Version 1.1 *
*   *
  - *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
  + *  Copyright (c) 1999-2002 The Apache Software Foundation.  *
*   All rights reserved.*
*   *
* = *
  @@ -215,7 +215,7 @@
   
   if( jniChannel==NULL ) {
   jniChannel=env-getByName( env, channel.jni:jni );
  -fprintf(stderr, Got jniChannel %p\n, jniChannel );
  +fprintf(stderr, Got jniChannel %#lx\n, jniChannel );
   }
   if( jniChannel==NULL ) {
   return;
  @@ -227,7 +227,7 @@
   return;
   }
   component-init( env, component );
  -fprintf(stderr, Create endpoint %p\n, component-object );
  +fprintf(stderr, Create endpoint %#lx\n, component-object );
   signalEndpoint=component-object;
   }
   
  @@ -341,11 +341,11 @@
   if( jk_env_globalEnv == NULL )
   return 0;
   
  -/* fprintf(stderr, Get env %p\n, jk_env_globalEnv); */
  +/* fprintf(stderr, Get env %#lx\n, jk_env_globalEnv); */
   env=jk_env_globalEnv-getEnv( jk_env_globalEnv );
   /* if( env!=NULL) */
   /* env-l-jkLog(env, env-l, JK_LOG_INFO,  */
  -/*   aprImpl.getJkEnv()  %p\n, env); */
  +/*   aprImpl.getJkEnv()  %#lx\n, env); */
   return (jlong)(long)(void *)env;
   }
   
  @@ -364,7 +364,7 @@
   
   if( jniDebug  0 )
   env-l-jkLog(env, env-l, JK_LOG_INFO, 
  -  aprImpl.releaseJkEnv()  %p\n, env);
  +  aprImpl.releaseJkEnv()  %#lx\n, env);
   }
   
   /*
  @@ -388,7 +388,7 @@
   env-recycleEnv( env );
   
   /* env-l-jkLog(env, env-l, JK_LOG_INFO,  */
  -/*   aprImpl.releaseJkEnv()  %p\n, env); */
  +/*   aprImpl.releaseJkEnv()  %#lx\n, env); */
   }
   
   
  @@ -407,7 +407,7 @@
   component=env-getBean( env, cname );
   
   /* env-l-jkLog(env, env-l, JK_LOG_INFO,  */
  -/*   aprImpl.getJkHandler()  %p %s\n, component, cname ); */
  +/*   aprImpl.getJkHandler()  %#lx %s\n, component, cname ); */
   
   (*jniEnv)-ReleaseStringUTFChars(jniEnv, compNameJ, cname);
   
  @@ -534,7 +534,7 @@
   jk_bean_t *bean=(jk_bean_t *)target;
   jk_endpoint_t *ep;
   
  -jbyte *nbuf;
  +jbyte *nbuf=NULL;
   jboolean iscopy;
   
   int cnt=0;
  @@ -553,7 +553,7 @@
   env-l-jkLog(env, env-l, JK_LOG_ERROR,jni.jkInvoke() NPE ep==null\n);
   return JK_ERR;
   }
  -
  +
   if( arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS ) {
   nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, data, iscopy);
   if( iscopy )
  @@ -568,7 +568,6 @@
   if( raw==0 ) {
   ep-reply-reset(env, ep-reply);
   }
  -
   oldBuf=ep-reply-buf;
   ep-reply-buf = (unsigned char *)nbuf;
   } else if ( arrayAccessMethod == JK_GET_REGION ) {
  @@ -588,16 +587,20 @@
   env-l-jkLog(env, env-l, JK_LOG_ERROR,
 jkInvoke() invalid data\n);
   /* we just can't recover, unset recover flag */
  -(*jniEnv)-ReleaseByteArrayElements(jniEnv, data, nbuf, 0);
  -ep-reply-buf=oldBuf;
  +if( arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS ) {
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, data, ep-reply-buf, 0);
  +ep-reply-buf=oldBuf;
  +}
   return JK_ERR;
   }
   
   if( bean-debug  0 ) 
   env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  jkInvoke() component dispatch %d %d %p\n, rc, code, 
bean-invoke);
  +  jkInvoke() component dispatch %d %d \n, rc, code );
   
   if( bean-invoke != NULL ) {
  +

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-10 Thread costin

costin  2002/06/10 17:01:16

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Fix the POST in in-process mode.
  
  The 'response' from a jni invocation is in the same buffer, but we must
  call msg-end() to update the message size.
  
  The dispatch mechanism is no longer used ( or it shouldn't ), I'll do a grep and
  clean the code. ( invoke is much cleaner ).
  
  Revision  ChangesPath
  1.35  +13 -6 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- jk_jni_aprImpl.c  10 Jun 2002 21:49:53 -  1.34
  +++ jk_jni_aprImpl.c  11 Jun 2002 00:01:16 -  1.35
  @@ -603,8 +603,10 @@
 jkInvoke() invoke %#lx \n, bean-invoke );
   rc=bean-invoke( env, bean, ep, code, ep-reply, raw );
   } else {
  -/* Backward compat for AJP13 messages, where the code is used to
  +/* NOT USED. Backward compat for AJP13 messages, where the code is used to
locate a handler. Deprecated, use the invoke() method  ! */
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  jkInvoke() component dispatch2 %d %d %#lx\n, rc, code, 
bean-invoke);
   rc=workerEnv-dispatch( env, workerEnv, target, ep, code, ep-reply ); 
   }
   
  @@ -612,6 +614,10 @@
   
   if( arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS ) {
   if( rc == JK_INVOKE_WITH_RESPONSE ) {
  +/* env-l-jkLog(env, env-l, JK_LOG_INFO, */
  +/*   jkInvoke() release byte array elements %d %d %#lx\n, 
*/
  +/*ep-reply-pos, ep-reply-len , ep-reply-buf ); */
  +ep-reply-end( env, ep-reply );
   (*jniEnv)-ReleaseByteArrayElements(jniEnv, data, nbuf, JNI_ABORT );
   rc=JK_OK;
   } else {
  @@ -620,9 +626,12 @@
   ep-reply-buf=oldBuf;
   } else if ( arrayAccessMethod == JK_GET_REGION ) {
   if( rc == JK_INVOKE_WITH_RESPONSE ) {
  -/*   env-l-jkLog(env, env-l, JK_LOG_INFO, */
  -/*jkInvoke() release %d %d %#lx\n, */
  -/*ep-reply-pos, ep-reply-len , ep-reply-buf ); */
  +
  +/*env-l-jkLog(env, env-l, JK_LOG_INFO, */
  +/*  jkInvoke() release %d %d %#lx\n, */
  +/*  ep-reply-pos, ep-reply-len , ep-reply-buf ); */
  +ep-reply-end( env, ep-reply );
  +
   (*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-reply-len + 4 , 
(jbyte *)ep-reply-buf );
   rc=JK_OK;
   }
  @@ -636,8 +645,6 @@
   (*jniEnv)-ExceptionClear( jniEnv ) */
   }
   
  -/* env-l-jkLog(env, env-l, JK_LOG_INFO, jkInvoke() done\n); */
  -
   return rc;
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-06-10 Thread costin

costin  2002/06/10 19:51:18

  Modified:jk/native2/common jk_env.c jk_logger_file.c
jk_mutex_thread.c
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  Fix initialization problem for libjkjni.so
  
  Revision  ChangesPath
  1.36  +3 -3  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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_env.c  10 Jun 2002 21:55:06 -  1.35
  +++ jk_env.c  11 Jun 2002 02:51:18 -  1.36
  @@ -63,7 +63,7 @@
   #endif
   
   jk_env_t *jk_env_globalEnv;
  -void *jkGlobalAprPool;
  +void *jkGlobalAprPool=NULL;
   
   /* Private methods 
   */
  @@ -82,7 +82,7 @@
*/
   if( jkGlobalAprPool==NULL ) {
   int rc;
  -
  +
   rc = apr_pool_create(( apr_pool_t **)jkGlobalAprPool, NULL);
   if (rc != APR_SUCCESS || jkGlobalAprPool==NULL ) {
   env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  @@ -96,7 +96,7 @@
   #endif
   }
   
  -static void JK_METHOD jk2_env_setAprPool( jk_env_t *env, void *aprPool ) {
  +void JK_METHOD jk2_env_setAprPool( jk_env_t *env, void *aprPool ) {
   jkGlobalAprPool=aprPool;
   }
   
  
  
  
  1.31  +5 -5  jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c
  
  Index: jk_logger_file.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_logger_file.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- jk_logger_file.c  10 Jun 2002 23:58:52 -  1.30
  +++ jk_logger_file.c  11 Jun 2002 02:51:18 -  1.31
  @@ -111,7 +111,7 @@
   if( f==NULL ) {
   /* This is usefull to debug what happens before logger is set.
  On apache you need -X option ( no detach, single process ) */
  -fprintf(stderr, JK_LOG: %s, what );
  +if( what != NULL ) fprintf(stderr, what );
   return JK_OK;
   }
   if(l  l-level = level  l-logger_private  what) {   
  @@ -261,9 +261,9 @@
   f++;
   }
   
  -/* XXX or apr_ctime ? */
  -apr_rfc822_date( rfctime, time );
  -fmt1=apr_psprintf( aprPool, [%s] (%5s) [%s (%d)]  %s, rfctime, slevel, f, 
line, fmt );
  +/* XXX rfc822_date or apr_ctime ? */
  +apr_ctime( rfctime, time );
  +fmt1=apr_psprintf( aprPool, [%s] (%5s ) [%s (%d)]  %s, rfctime, slevel, 
f, line, fmt );
   buf=apr_pvsprintf( aprPool, fmt1, args );
   
   l-log(env, l, level, buf);
  
  
  
  1.5   +3 -0  jakarta-tomcat-connectors/jk/native2/common/jk_mutex_thread.c
  
  Index: jk_mutex_thread.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_mutex_thread.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_mutex_thread.c 10 Jun 2002 21:55:06 -  1.4
  +++ jk_mutex_thread.c 11 Jun 2002 02:51:18 -  1.5
  @@ -98,18 +98,21 @@
   static int JK_METHOD 
   jk2_mutex_thread_lock(jk_env_t *env, jk_mutex_t  *jkMutex)
   {
  +if( jkMutex==NULL || jkMutex-threadMutex==NULL ) return JK_ERR;
   return apr_thread_mutex_lock( jkMutex-threadMutex );
   }
   
   static int JK_METHOD 
   jk2_mutex_thread_tryLock(jk_env_t *env, jk_mutex_t  *jkMutex)
   {
  +if( jkMutex==NULL || jkMutex-threadMutex==NULL ) return JK_ERR;
   return apr_thread_mutex_trylock( jkMutex-threadMutex );
   }
   
   static int JK_METHOD 
   jk2_mutex_thread_unLock(jk_env_t *env, jk_mutex_t  *jkMutex)
   {
  +if( jkMutex==NULL || jkMutex-threadMutex==NULL ) return JK_ERR;
   return apr_thread_mutex_unlock( jkMutex-threadMutex );
   }
   
  
  
  
  1.36  +5 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_jni_aprImpl.c  11 Jun 2002 00:01:16 -  1.35
  +++ jk_jni_aprImpl.c  11 Jun 2002 02:51:18 -  1.36
  @@ -113,6 +113,7 @@
   #define JK_DIRECT_BUFFER_NIO 3
   
   static int arrayAccessMethod=JK_GET_REGION;
  +void JK_METHOD jk2_env_setAprPool( jk_env_t *env, void *aprPool );
   
   JNIEXPORT void JNICALL 
   Java_org_apache_jk_apr_AprImpl_setArrayAccessMode(JNIEnv *jniEnv, jobject _jthis, 
jint mode)
  @@ -137,10 +138,12 @@
   if( jniAprPool==NULL ) {
   return JK_ERR;
   }
  +
  +jk2_env_setAprPool( NULL, jniAprPool );
  +
   jk2_pool_apr_create( NULL, globalPool, NULL, jniAprPool );
   /* 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h

2002-06-07 Thread costin

costin  2002/06/07 16:42:19

  Modified:jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h
  Log:
  Another patch from  Mladen Turk, cleaning up the singatures.
  
  Revision  ChangesPath
  1.31  +3 -3  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- jk_jni_aprImpl.c  31 May 2002 19:19:45 -  1.30
  +++ jk_jni_aprImpl.c  7 Jun 2002 23:42:19 -   1.31
  @@ -255,11 +255,11 @@
   return 0;
   }
   
  -JNIEXPORT jint JNICALL 
  +JNIEXPORT void JNICALL 
   Java_org_apache_jk_apr_AprImpl_sendSignal(JNIEnv *jniEnv, jobject _jthis, jint 
signo,
  -  jlong target)
  +  jint target)
   {
  -return 0;
  +
   }
   
   #endif
  
  
  
  1.5   +56 -49
jakarta-tomcat-connectors/jk/native2/jni/org_apache_jk_apr_AprImpl.h
  
  Index: org_apache_jk_apr_AprImpl.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native2/jni/org_apache_jk_apr_AprImpl.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- org_apache_jk_apr_AprImpl.h   28 May 2002 22:34:59 -  1.4
  +++ org_apache_jk_apr_AprImpl.h   7 Jun 2002 23:42:19 -   1.5
  @@ -17,6 +17,8 @@
   #define org_apache_jk_apr_AprImpl_HANDLE_RECEIVE_PACKET 10L
   #undef org_apache_jk_apr_AprImpl_HANDLE_SEND_PACKET
   #define org_apache_jk_apr_AprImpl_HANDLE_SEND_PACKET 11L
  +#undef org_apache_jk_apr_AprImpl_HANDLE_FLUSH
  +#define org_apache_jk_apr_AprImpl_HANDLE_FLUSH 12L
   /* Inaccessible static: aprSingleton */
   /* Inaccessible static: ok */
   /* Inaccessible static: jniMode */
  @@ -36,70 +38,77 @@
   JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_terminate
 (JNIEnv *, jobject);
   
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:getJkEnv
  + * Signature: ()J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_getJkEnv
  +  (JNIEnv *, jobject);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unSocketClose
  - * Signature: (JJI)J
  + * Method:releaseJkEnv
  + * Signature: (J)V
*/
  -JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_unSocketClose
  -  (JNIEnv *, jobject, jlong, jint);
  +JNIEXPORT void JNICALL Java_org_apache_jk_apr_AprImpl_releaseJkEnv
  +  (JNIEnv *, jobject, jlong);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unSocketListen
  - * Signature: (JLjava/lang/String;I)J
  + * Method:getJkHandler
  + * Signature: (JLjava/lang/String;)J
*/
  -JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_unSocketListen
  -  (JNIEnv *, jobject, jstring, jint);
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_getJkHandler
  +  (JNIEnv *, jobject, jlong, jstring);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unSocketConnect
  + * Method:createJkHandler
* Signature: (JLjava/lang/String;)J
*/
  -JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_unSocketConnect
  -  (JNIEnv *, jobject, jstring);
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_createJkHandler
  +  (JNIEnv *, jobject, jlong, jstring);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unAccept
  - * Signature: (JJ)J
  + * Method:jkSetAttribute
  + * Signature: (JJLjava/lang/String;Ljava/lang/String;)I
*/
  -JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_unAccept
  -  (JNIEnv *, jobject, jlong);
  +JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_jkSetAttribute
  +  (JNIEnv *, jobject, jlong, jlong, jstring, jstring);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unRead
  - * Signature: (JJ[BII)I
  + * Method:jkGetAttribute
  + * Signature: (JJLjava/lang/String;)Ljava/lang/String;
*/
  -JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_unRead
  -  (JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
  +JNIEXPORT jstring JNICALL Java_org_apache_jk_apr_AprImpl_jkGetAttribute
  +  (JNIEnv *, jobject, jlong, jlong, jstring);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:unWrite
  - * Signature: (JJ[BII)I
  + * Method:jkInit
  + * Signature: (JJ)I
*/
  -JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_unWrite
  -  (JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
  +JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_jkInit
  +  (JNIEnv *, jobject, jlong, jlong);
   
   /*
* Class: org_apache_jk_apr_AprImpl
  - * Method:getJkEnv
  - * Signature: ()J
  + * Method:jkDestroy
  + * Signature: (JJ)I
*/
  -JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_getJkEnv
  -  (JNIEnv *, 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-31 Thread costin

costin  2002/05/31 12:19:45

  Modified:jk/native2 build.xml
   jk/native2/common jk_shm.c jk_workerEnv.c
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  Other fixes.
  
  Remove the locking when adding worker/channel/etc - it's better to
  sync on the thread making updates ( the original config is in the
  main thread , updates are syced in jk_config ).
  
  ( this avoids problems when a component adds another one )
  
  Revision  ChangesPath
  1.35  +1 -0  jakarta-tomcat-connectors/jk/native2/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- build.xml 30 May 2002 18:00:56 -  1.34
  +++ build.xml 31 May 2002 19:19:44 -  1.35
  @@ -378,6 +378,7 @@
   info=Building for NetWare platform /
 def name=HAS_APR
   info=JNI is now based on APR /
  +  def name=_REENTRANT /
 def name=HAVE_JNI /
  
 import fileName=${novellndk.home}/imports/clib.imp if=netware /
  
  
  
  1.23  +6 -5  jakarta-tomcat-connectors/jk/native2/common/jk_shm.c
  
  Index: jk_shm.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_shm.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_shm.c  30 May 2002 18:21:03 -  1.22
  +++ jk_shm.c  31 May 2002 19:19:45 -  1.23
  @@ -127,13 +127,14 @@
   if( shm-image!=NULL ) {
   shm-head = (jk_shm_head_t *)shm-image;
   
  -env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  -  shm.create(): GLOBAL_SHM  %p\n, shm-image );
  -fprintf( stderr, GLOBAL SHM: %p\n, shm-image );
  +if( shm-mbean-debug  0 )
  +env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  +  shm.create(): GLOBAL_SHM  %p\n, shm-image );
   return JK_OK;
   } else {
  -env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  -  shm.create(): NO GLOBAL_SHM  %p\n, shm-image );
  +if( shm-mbean-debug  0 )
  +env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  +  shm.create(): NO GLOBAL_SHM  %p\n, shm-image );
   }
   
   
  
  
  
  1.51  +6 -30 jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c
  
  Index: jk_workerEnv.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- jk_workerEnv.c31 May 2002 18:09:13 -  1.50
  +++ jk_workerEnv.c31 May 2002 19:19:45 -  1.51
  @@ -59,7 +59,7 @@
* Description: Workers controller *
* Author:  Gal Shachor [EMAIL PROTECTED]   *
* Author:  Henri Gomez [EMAIL PROTECTED]   *
  - * Version: $Revision: 1.50 $   *
  + * Version: $Revision: 1.51 $   *
***/
   
   #include jk_env.h
  @@ -554,11 +554,7 @@
   {
   int err=JK_OK;
   jk_bean_t *jkb;
  -int csOk;
   
  -if( wEnv-cs != NULL ) 
  -wEnv-cs-lock( env, wEnv-cs );
  -
   ch-mbean-id=wEnv-channel_map-size( env, wEnv-channel_map );
   wEnv-channel_map-add(env, wEnv-channel_map, ch-mbean-name, ch);
   
  @@ -568,37 +564,24 @@
   if( jkb == NULL ) {
   env-l-jkLog(env, env-l, JK_LOG_ERROR,
 workerEnv.addChannel(): Can't find ajp13 worker\n );
  -if( wEnv-cs != NULL ) 
  -wEnv-cs-unLock( env, wEnv-cs );
   return JK_ERR;
   }
   ch-worker=jkb-object;
   ch-worker-channelName=ch-mbean-name;
   ch-worker-channel=ch;
   
  -/* XXX Set additional parameters - use defaults otherwise */
  -if( wEnv-cs != NULL ) 
  -wEnv-cs-unLock( env, wEnv-cs );
  -
   return JK_OK;
   }
   
   static int jk2_workerEnv_addEndpoint(jk_env_t *env, jk_workerEnv_t *wEnv, 
jk_endpoint_t *ep)
   {
  -int csOk;
  +int pos=wEnv-endpointMap-size( env, wEnv-endpointMap );
   
  -if( wEnv-cs != NULL ) 
  -wEnv-cs-lock( env, wEnv-cs );
  -{
  -int pos=wEnv-endpointMap-size( env, wEnv-endpointMap );
  -
  -wEnv-endpointMap-add( env, wEnv-endpointMap, ep-mbean-localName, ep );
  -ep-mbean-id=pos;
  +wEnv-endpointMap-add( env, wEnv-endpointMap, ep-mbean-localName, ep );
  +ep-mbean-id=pos;
  +
  +ep-mbean-init( env, ep-mbean );
   
  -ep-mbean-init( env, ep-mbean );
  -}
  -if( 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-30 Thread costin

costin  02/05/30 11:08:48

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Added a flag to select the byte[] access mechanism.
  
  getArrayElements is the fastest - if pinning is supported by the VM. Aparently
  JDK1.4 doesn't pin, so the performance will go down.
  
  getArrayRegion works well on all VMs, so it is the default.
  
  The third option will work only on JDK1.4, with direct buffers ( it'll probably have
  the same performance with getArrayElements with pinning ). For this
  to work we need to implemnet a direct buffer version for ByteChunk and
  MsgAjp.
  
  Revision  ChangesPath
  1.29  +63 -26jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- jk_jni_aprImpl.c  29 May 2002 17:51:23 -  1.28
  +++ jk_jni_aprImpl.c  30 May 2002 18:08:48 -  1.29
  @@ -100,6 +100,18 @@
   static jk_workerEnv_t *workerEnv;
   static int jniDebug=0;
   
  +#define JK_GET_REGION 1
  +#define JK_GET_BYTE_ARRAY_ELEMENTS 2
  +#define JK_DIRECT_BUFFER_NIO 3
  +
  +static int arrayAccessMethod=JK_GET_REGION;
  +
  +JNIEXPORT void JNICALL 
  +Java_org_apache_jk_apr_AprImpl_setArrayAccessMode(JNIEnv *jniEnv, jobject _jthis, 
jint mode)
  +{
  +arrayAccessMethod=mode;
  +}
  +
   /*  Apr initialization and pools  */
   
   JNIEXPORT jint JNICALL 
  @@ -527,26 +539,27 @@
   return JK_ERR;
   }
   
  -nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, data, iscopy);
  -
  -if( iscopy )
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  aprImpl.jkInvoke() get java bytes iscopy %d\n, iscopy);
  -
  -if(nbuf==NULL) {
  -env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  -  jkInvoke() NullPointerException 2\n);
  - return -1;
  -}
  -
  -if( raw==0 ) {
  -ep-reply-reset(env, ep-reply);
  +if( arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS ) {
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, data, iscopy);
  +if( iscopy )
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  aprImpl.jkInvoke() get java bytes iscopy %d\n, iscopy);
  +
  +if(nbuf==NULL) {
  +env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  +  jkInvoke() NullPointerException 2\n);
  +return -1;
  +}
  +if( raw==0 ) {
  +ep-reply-reset(env, ep-reply);
  +}
  +
  +oldBuf=ep-reply-buf;
  +ep-reply-buf = nbuf;
  +} else if ( arrayAccessMethod == JK_GET_REGION ) {
  +(*jniEnv)-GetByteArrayRegion( jniEnv, data, off, len, ep-reply-buf );
   }
  -
  -//memcpy( ep-reply-buf, nbuf , len );
  -oldBuf=ep-reply-buf;
  -ep-reply-buf = nbuf;
  -
  +
   
   if( raw == 0 ) {
   rc=ep-reply-checkHeader( env, ep-reply, ep );
  @@ -565,9 +578,10 @@
   return JK_ERR;
   }
   
  -env-l-jkLog(env, env-l, JK_LOG_DEBUG,
  -  jkInvoke() component dispatch %d %d %p\n, rc, code, 
bean-invoke);
  -
  +if( bean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  jkInvoke() component dispatch %d %d %p\n, rc, code, 
bean-invoke);
  +
   if( bean-invoke != NULL ) {
   rc=bean-invoke( env, bean, ep, code, ep-reply, raw );
   } else {
  @@ -575,12 +589,35 @@
locate a handler. Deprecated, use the invoke() method  ! */
   rc=workerEnv-dispatch( env, workerEnv, target, ep, code, ep-reply ); 
   }
  -/* XXX Copy back the response, if any */
   
  -
  -(*jniEnv)-ReleaseByteArrayElements(jniEnv, data, nbuf, 0);
  -ep-reply-buf=oldBuf;
  +/* Copy back the response, if any */
   
  +if( arrayAccessMethod == JK_GET_BYTE_ARRAY_ELEMENTS ) {
  +if( rc == JK_INVOKE_WITH_RESPONSE ) {
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, data, nbuf, JNI_ABORT );
  +rc=JK_OK;
  +} else {
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, data, nbuf, 0);
  +}
  +ep-reply-buf=oldBuf;
  +} else if ( arrayAccessMethod == JK_GET_REGION ) {
  +if( rc == JK_INVOKE_WITH_RESPONSE ) {
  +/*   env-l-jkLog(env, env-l, JK_LOG_INFO, */
  +/*jkInvoke() release %d %d %p\n, */
  +/*ep-reply-pos, ep-reply-len , ep-reply-buf ); */
  +(*jniEnv)-SetByteArrayRegion( jniEnv, data, 0, ep-reply-len + 4 , 
ep-reply-buf );
  +rc=JK_OK;
  +}
  +} 
  +
  +if( (*jniEnv)-ExceptionCheck( jniEnv ) ) {
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  jkInvoke() 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h

2002-05-26 Thread costin

costin  02/05/26 00:38:17

  Modified:jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h
  Log:
  - removed code we don't need. ( creating and using directly the apr pools
  is overkill and dangerous, things are better handled by keeping them
  in the execution context - jk_endpoint ).
  
  - started to add the signal callbacks ( using the code in the jni channel ).
  The jni channel is not used only for in-process apache-tomcat communication,
  but for any callbacks from C to java ( i.e. you can have tomcat standalone
  using libjkjni.so to receive SIGHUP or any other callbacks we want ).
  
  - add jkInit/jkDestroy ( for component initialization )
  
  Revision  ChangesPath
  1.24  +114 -65   jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- jk_jni_aprImpl.c  24 May 2002 04:30:07 -  1.23
  +++ jk_jni_aprImpl.c  26 May 2002 07:38:17 -  1.24
  @@ -91,7 +91,9 @@
   #include apr_shm.h
   #endif
   
  +#ifdef HAVE_SIGNAL
   #include signal.h
  +#endif
   
   static apr_pool_t *jniAprPool;
   static jk_workerEnv_t *workerEnv;
  @@ -152,55 +154,86 @@
   return 0;
   }
   
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_poolCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
parentP)
  -{
  -apr_pool_t *parent;
  -apr_pool_t *child;
  -
  -parent=(apr_pool_t *)(void *)(long)parentP;
  -apr_pool_create( child, parent );
  -return (jlong)(long)child;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_poolClear(JNIEnv *jniEnv, jobject _jthis,
  - jlong poolP)
  -{
  -apr_pool_t *pool;
  -
  -pool=(apr_pool_t *)(void *)(long)poolP;
  -apr_pool_clear( pool );
  -return 0;
  -}
  -
   /*  Signals  */
  +
   #ifdef HAVE_SIGNALS
   static struct sigaction jkAction;
   
  +/* We use a jni channel to send the notification to java
  + */
  +static jk_channel_t *jniChannel;
  +
  +/* XXX we should sync or use multiple endpoints if multiple signals
  +   can be concurent
  +*/
  +static jk_endpoint_t *signalEndpoint;
  +
   static void jk2_SigAction(int sig) {
  -fprintf(stderr, Signal %d\n, sig );
  +jk_env_t *env;
   
   /* Make a callback using the jni channel */
  +fprintf(stderr, Signal %d\n, sig );
  +
  +if( jk_env_globalEnv == NULL ) {
  +return;
  +}
  +
  +env=jk_env_globalEnv-getEnv( jk_env_globalEnv );
  +
  +if( jniChannel==NULL ) {
  +jniChannel=env-getByName( env, channel.jni:jni );
  +fprintf(stderr, Got jniChannel %p\n, jniChannel );
  +}
  +if( jniChannel==NULL ) {
  +return;
  +}
  +if( signalEndpoint == NULL ) {
  +jk_bean_t *component=env-createBean2( env, NULL, endpoint, NULL );
  +if( component == NULL ) {
  +fprintf(stderr, Can't create endpoint\n );
  +return;
  +}
  +component-init( env, component );
  +fprintf(stderr, Create endpoint %p\n, component-object );
  +signalEndpoint=component-object;
  +}
  +
  +/* Channel:jni should be initialized by the caller */
  +
  +/* XXX make the callback */
   
  -signal( sig, jk2_SigAction );
  +jk_env_globalEnv-releaseEnv( jk_env_globalEnv, env );
  +
   }
  -#endif
  +
   
   /* XXX We need to: - preserve the old signal ( or get them ) - either
implement waitSignal or use invocation in jk2_SigAction
   
Probably waitSignal() is better ( we can have a thread that waits )
  -*/
  + */
   
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint signalNr 
)
   {
  -#ifdef HAVE_SIGNALS
   memset( jkAction, 0, sizeof(jkAction));
   jkAction.sa_handler=jk2_SigAction;
   sigaction((int)signalNr, jkAction, (void *) NULL);
  -#endif
  +return 0;
  +}
  +
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_sendSignal(JNIEnv *jniEnv, jobject _jthis, jint 
target ,
  +  jint signo)
  +{
  +return kill( (pid_t)target, (int)signo );
  +}
  +
  +#else /* ! HAVE_SIGNALS */
  +
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint signalNr 
)
  +{
   return 0;
   }
   
  @@ -208,10 +241,12 @@
   Java_org_apache_jk_apr_AprImpl_sendSignal(JNIEnv *jniEnv, jobject _jthis, jint 
signo,
 jlong target)
   {
  -
   return 0;
   }
   
  +#endif
  +
  +
   /*  User related functions  */
   
   JNIEXPORT jint JNICALL 
  @@ -262,10 +297,13 @@
  'native' calls. For 'tcp' sockets 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-23 Thread costin

costin  02/05/23 16:45:08

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Add support for setuid() - to change the user if run as root.
  
  Revision  ChangesPath
  1.22  +46 -2 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- jk_jni_aprImpl.c  15 May 2002 19:46:46 -  1.21
  +++ jk_jni_aprImpl.c  23 May 2002 23:45:07 -  1.22
  @@ -78,6 +78,10 @@
   #include jk_map.h
   #include jk_pool.h
   
  +#ifndef WIN32
  +#include unistd.h
  +#include pwd.h
  +#endif
   
   #if APR_HAVE_SYS_TYPES_H
   #include sys/types.h
  @@ -107,7 +111,6 @@
   
   if( jk_env_globalEnv == NULL ) {
   jk_pool_t *globalPool;
  -jk_bean_t *jkb;
   
   if( jniAprPool==NULL ) {
   return 0;
  @@ -212,10 +215,51 @@
   /*  User related functions  */
   
   JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_userId(JNIEnv *jniEnv, jobject _jthis, jlong pool)
  +Java_org_apache_jk_apr_AprImpl_userId(JNIEnv *jniEnv, jobject _jthis)
   {
   
   return 0;
  +}
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_getPid(JNIEnv *jniEnv, jobject _jthis)
  +{
  +  return (jlong) getpid();
  +}
  +
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_setUser(JNIEnv *jniEnv, jobject _jthis,
  +   jstring userJ, jstring groupJ)
  +{
  +int rc=0;
  +#ifndef WIN32
  +const char *user;
  +char *group;
  +struct passwd *passwd;
  +int uid;
  +int gid;
  +
  +user = (*jniEnv)-GetStringUTFChars(jniEnv, userJ, 0);
  +
  +passwd = getpwnam(user);
  +
  +(*jniEnv)-ReleaseStringUTFChars(jniEnv, userJ, user);
  +
  +if (passwd == NULL ) {
  +return -1;
  +}
  +uid = passwd-pw_uid;
  +gid = passwd-pw_gid;
  +
  +if (uid  0 || gid  0 ) 
  +return -2;
  +
  +rc = setuid(uid);
  +
  +#endif
  +
  +return rc;
   }
   
   /*  interprocess mutexes  */
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-23 Thread costin

costin  02/05/23 21:30:07

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Remove the mutex code ( move to a separate jk component ).
  
  Add few extra checks.
  
  Revision  ChangesPath
  1.23  +21 -85jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_jni_aprImpl.c  23 May 2002 23:45:07 -  1.22
  +++ jk_jni_aprImpl.c  24 May 2002 04:30:07 -  1.23
  @@ -93,8 +93,6 @@
   
   #include signal.h
   
  -#include apr_proc_mutex.h
  -
   static apr_pool_t *jniAprPool;
   static jk_workerEnv_t *workerEnv;
   static int jniDebug=0;
  @@ -182,6 +180,9 @@
   
   static void jk2_SigAction(int sig) {
   fprintf(stderr, Signal %d\n, sig );
  +
  +/* Make a callback using the jni channel */
  +
   signal( sig, jk2_SigAction );
   }
   #endif
  @@ -193,13 +194,12 @@
   */
   
   JNIEXPORT jint JNICALL 
  -Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint bitMask,
  -  jobject func)
  +Java_org_apache_jk_apr_AprImpl_signal(JNIEnv *jniEnv, jobject _jthis, jint signalNr 
)
   {
   #ifdef HAVE_SIGNALS
   memset( jkAction, 0, sizeof(jkAction));
   jkAction.sa_handler=jk2_SigAction;
  -sigaction((int)bitMask, jkAction, (void *) NULL);
  +sigaction((int)signalNr, jkAction, (void *) NULL);
   #endif
   return 0;
   }
  @@ -214,21 +214,14 @@
   
   /*  User related functions  */
   
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_userId(JNIEnv *jniEnv, jobject _jthis)
  -{
  -
  -return 0;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  +JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_getPid(JNIEnv *jniEnv, jobject _jthis)
   {
  -  return (jlong) getpid();
  +  return (jint) getpid();
   }
   
   
  -JNIEXPORT jlong JNICALL 
  +JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_setUser(JNIEnv *jniEnv, jobject _jthis,
  jstring userJ, jstring groupJ)
   {
  @@ -259,78 +252,11 @@
   
   #endif
   
  -return rc;
  +return (jint)rc;
   }
   
   /*  interprocess mutexes  */
   
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  -   jstring fileJ,
  -   jint mechJ )
  -{
  -apr_proc_mutex_t *mutex;
  -apr_lockmech_e mech=(apr_lockmech_e)mechJ;
  -apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolP;
  -apr_status_t  st;
  -char *fname=(char *)(*jniEnv)-GetStringUTFChars(jniEnv, fileJ, 0);
  -
  -st=apr_proc_mutex_create( mutex, fname, mech, pool );
  -
  -(*jniEnv)-ReleaseStringUTFChars(jniEnv, fileJ, fname);
  -
  -return (jlong)(long)(void *)mutex;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexLock(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  - jlong mutexP )
  -{
  -apr_proc_mutex_t *mutex=(apr_proc_mutex_t *)(void *)(long)mutexP;
  -apr_status_t  st;
  -
  -st=apr_proc_mutex_lock( mutex );
  -
  -return (jlong)(long)st;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexTryLock(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  - jlong mutexP )
  -{
  -apr_proc_mutex_t *mutex=(apr_proc_mutex_t *)(void *)(long)mutexP;
  -apr_status_t  st;
  -
  -st=apr_proc_mutex_trylock( mutex );
  -
  -return (jlong)(long)st;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexUnLock(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  - jlong mutexP )
  -{
  -apr_proc_mutex_t *mutex=(apr_proc_mutex_t *)(void *)(long)mutexP;
  -apr_status_t  st;
  -
  -st=apr_proc_mutex_unlock( mutex );
  -
  -return (jlong)(long)st;
  -}
  -
  -JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexDestroy(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  -jlong mutexP )
  -{
  -apr_proc_mutex_t *mutex=(apr_proc_mutex_t *)(void *)(long)mutexP;
  -apr_status_t  st;
  -
  -st=apr_proc_mutex_destroy( mutex );
  -
  -return (jlong)(long)st;
  -}
  -
  -
   /*  Unix sockets  */
   /* It seems apr doesn't support them yet, so this code will use the
  'native' calls. For 'tcp' sockets we just use what java provides.
  @@ -765,7 +691,7 @@
   jk_env_t *env = (jk_env_t *)(void *)(long)envJ;
   jk_bean_t *compCtx=(jk_bean_t *)(void 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-14 Thread costin

costin  02/05/14 10:28:15

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Remove the signal hack, it doesn't seem to solve the problems with
  JDK1.4.
  
  Revision  ChangesPath
  1.20  +4 -4  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- jk_jni_aprImpl.c  12 May 2002 01:10:56 -  1.19
  +++ jk_jni_aprImpl.c  14 May 2002 17:28:15 -  1.20
  @@ -411,10 +411,10 @@
   
   fprintf(stderr, unAccept %d\n, listenUnSocket );
   
  -signal( SIGCHLD, SIG_IGN );
  -signal( SIGPIPE, SIG_IGN );
  -signal( SIGIO, jk2_SigAction );
  -
  +#ifdef HAVE_SIGNALS
  +/* signal( SIGCHLD, SIG_IGN ); */
  +/* signal( SIGIO, jk2_SigAction ); */
  +#endif
   clientlen=sizeof( client );
   
   connfd=accept( listenUnSocket, (struct sockaddr *)client, clientlen );
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h

2002-05-11 Thread nacho

nacho   02/05/11 18:10:56

  Modified:jk/native2/jni jk_jni_aprImpl.c org_apache_jk_apr_AprImpl.h
  Log:
  * Fixed mutexcreate impl
  * Commited complete JNI header
  
  Revision  ChangesPath
  1.19  +6 -4  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jk_jni_aprImpl.c  11 May 2002 17:29:28 -  1.18
  +++ jk_jni_aprImpl.c  12 May 2002 01:10:56 -  1.19
  @@ -226,12 +226,14 @@
  jint mechJ )
   {
   apr_proc_mutex_t *mutex;
  -char *fname;
  -apr_lockmech_e mech;
  -apr_pool_t *pool;
  +apr_lockmech_e mech=(apr_lockmech_e)mechJ;
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolP;
   apr_status_t  st;
  -
  +char *fname=(char *)(*jniEnv)-GetStringUTFChars(jniEnv, fileJ, 0);
  +
   st=apr_proc_mutex_create( mutex, fname, mech, pool );
  +
  +(*jniEnv)-ReleaseStringUTFChars(jniEnv, fileJ, fname);
   
   return (jlong)(long)(void *)mutex;
   }
  
  
  
  1.2   +109 -0
jakarta-tomcat-connectors/jk/native2/jni/org_apache_jk_apr_AprImpl.h
  
  Index: org_apache_jk_apr_AprImpl.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native2/jni/org_apache_jk_apr_AprImpl.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- org_apache_jk_apr_AprImpl.h   6 Jan 2002 09:01:51 -   1.1
  +++ org_apache_jk_apr_AprImpl.h   12 May 2002 01:10:56 -  1.2
  @@ -7,6 +7,19 @@
   #ifdef __cplusplus
   extern C {
   #endif
  +#undef org_apache_jk_apr_AprImpl_OK
  +#define org_apache_jk_apr_AprImpl_OK 0L
  +#undef org_apache_jk_apr_AprImpl_LAST
  +#define org_apache_jk_apr_AprImpl_LAST 1L
  +#undef org_apache_jk_apr_AprImpl_ERROR
  +#define org_apache_jk_apr_AprImpl_ERROR 2L
  +#undef org_apache_jk_apr_AprImpl_HANDLE_RECEIVE_PACKET
  +#define org_apache_jk_apr_AprImpl_HANDLE_RECEIVE_PACKET 10L
  +#undef org_apache_jk_apr_AprImpl_HANDLE_SEND_PACKET
  +#define org_apache_jk_apr_AprImpl_HANDLE_SEND_PACKET 11L
  +/* Inaccessible static: aprSingleton */
  +/* Inaccessible static: ok */
  +/* Inaccessible static: jniMode */
   /*
* Class: org_apache_jk_apr_AprImpl
* Method:initialize
  @@ -86,6 +99,102 @@
*/
   JNIEXPORT jint JNICALL Java_org_apache_jk_apr_AprImpl_unWrite
 (JNIEnv *, jobject, jlong, jlong, jbyteArray, jint, jint);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:mutexCreate
  + * Signature: (JLjava/lang/String;I)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_mutexCreate
  +  (JNIEnv *, jobject, jlong, jstring, jint);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:mutexLock
  + * Signature: (JJ)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_mutexLock
  +  (JNIEnv *, jobject, jlong, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:mutexUnLock
  + * Signature: (JJ)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_mutexUnLock
  +  (JNIEnv *, jobject, jlong, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:mutexTryLock
  + * Signature: (JJ)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_mutexTryLock
  +  (JNIEnv *, jobject, jlong, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:mutexDestroy
  + * Signature: (JJ)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_mutexDestroy
  +  (JNIEnv *, jobject, jlong, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:getJkEnv
  + * Signature: ()J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_getJkEnv
  +  (JNIEnv *, jobject);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:releaseJkEnv
  + * Signature: (J)V
  + */
  +JNIEXPORT void JNICALL Java_org_apache_jk_apr_AprImpl_releaseJkEnv
  +  (JNIEnv *, jobject, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:jkRecycle
  + * Signature: (JJ)V
  + */
  +JNIEXPORT void JNICALL Java_org_apache_jk_apr_AprImpl_jkRecycle
  +  (JNIEnv *, jobject, jlong, jlong);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:getJkHandler
  + * Signature: (JLjava/lang/String;)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_getJkHandler
  +  (JNIEnv *, jobject, jlong, jstring);
  +
  +/*
  + * Class: org_apache_jk_apr_AprImpl
  + * Method:createJkHandler
  + * Signature: (JLjava/lang/String;)J
  + */
  +JNIEXPORT jlong JNICALL Java_org_apache_jk_apr_AprImpl_createJkHandler
  +  (JNIEnv *, jobject, jlong, jstring);
  +
  +/*
  + * Class: 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-10 Thread costin

costin  02/05/10 17:07:26

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Similar warnings if the array is not pinned.
  
  Revision  ChangesPath
  1.17  +20 -11jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_jni_aprImpl.c  9 May 2002 23:47:32 -   1.16
  +++ jk_jni_aprImpl.c  11 May 2002 00:07:26 -  1.17
  @@ -436,18 +436,23 @@
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_unRead(JNIEnv *jniEnv, jobject _jthis, 
 jlong poolJ, jlong unSocketJ,
  -  jbyteArray bufJ, jint from, jint cnt)
  +  jbyteArray jbuf, jint from, jint cnt)
   {
   apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
   jbyte *nbuf;
   int rd;
  -jboolean iscommit;
  +jboolean iscopy;
   
  -nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, bufJ, iscommit);
  +/* We can't use Critical with blocking ops. 
  + */
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, jbuf, iscopy);
   if( ! nbuf ) {
   return -1;
   }
   
  +if( iscopy==JNI_TRUE )
  +fprintf( stderr, aprImpl.unRead() get java bytes iscopy %d\n, iscopy);
  +
   while( 1 ) {
   /* Read */
   rd=read( (int)unSocketJ, nbuf + from, cnt );
  @@ -458,29 +463,29 @@
   } else {
   fprintf(stderr, Error reading %d %d %s\n,
   (int)unSocketJ, errno, strerror(errno));
  -(*jniEnv)-ReleaseByteArrayElements(jniEnv, bufJ, nbuf, 0);
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, jbuf, nbuf, 0);
   return -1;
   }
   }
   /* fprintf(stderr, Read %d from %d\n, */
   /* rd, unSocketJ); */
   
  -(*jniEnv)-ReleaseByteArrayElements(jniEnv, bufJ, nbuf, 0);
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, jbuf, nbuf, 0);
   return (jint)rd;
   }
   }
   
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_unWrite(JNIEnv *jniEnv, jobject _jthis, 
  - jlong poolJ, jlong unSocketJ, jbyteArray bufJ, 
jint from, jint cnt)
  + jlong poolJ, jlong unSocketJ, jbyteArray jbuf, 
jint from, jint cnt)
   {
   apr_status_t status;
   apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
   jbyte *nbuf;
   int rd;
  -jboolean iscommit;
  +jboolean iscopy;
   
  -nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, bufJ, iscommit);
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, jbuf, iscopy);
   if( ! nbuf ) {
   return -1;
   }
  @@ -488,7 +493,7 @@
   /* write */
   write( (int) unSocketJ, nbuf + from, cnt );
   
  -(*jniEnv)-ReleaseByteArrayElements(jniEnv, bufJ, nbuf, 0);
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, jbuf, nbuf, 0);
   return (jint)rd;
   }
   
  @@ -707,7 +712,7 @@
   jk_endpoint_t *ep = compCtx-object;
   
   jbyte *nbuf;
  -jboolean iscommit;
  +jboolean iscopy;
   
   int cnt=0;
   jint rc = -1;
  @@ -715,7 +720,11 @@
   
   /*env-l-jkLog(env, env-l, JK_LOG_INFO,jkInvoke()\n); */
   
  -nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, data, iscommit);
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, data, iscopy);
  +
  +if( iscopy )
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  aprImpl.jkInvoke() get java bytes iscopy %d\n, iscopy);
   
   if(nbuf==NULL) {
   env-l-jkLog(env, env-l, JK_LOG_ERROR, 
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-05-09 Thread costin

costin  02/05/09 16:47:32

  Modified:jk/native2/common jk_channel_socket.c jk_channel_un.c
jk_env.c jk_shm.c jk_workerEnv.c jk_worker_ajp13.c
jk_worker_lb.c
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  reduce verbosity.
  
  Make sure we try all available workers before giving up.
  
  Revision  ChangesPath
  1.23  +4 -2  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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_channel_socket.c   9 May 2002 21:12:15 -   1.22
  +++ jk_channel_socket.c   9 May 2002 23:47:31 -   1.23
  @@ -276,8 +276,10 @@
   
   /* Tries to connect to JServ (continues trying while error is EINTR) */
   do {
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channelSocket.open() connect on %d\n,sock);
  +if( ch-mbean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  channelSocket.open() connect on %d\n,sock);
  +
   ret = connect(sock,(struct sockaddr *)addr,
 sizeof(struct sockaddr_in));
   
  
  
  
  1.2   +22 -17jakarta-tomcat-connectors/jk/native2/common/jk_channel_un.c
  
  Index: jk_channel_un.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_un.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_channel_un.c   9 May 2002 00:05:14 -   1.1
  +++ jk_channel_un.c   9 May 2002 23:47:31 -   1.2
  @@ -123,7 +123,7 @@
   {
   jk_channel_un_private_t *socketInfo=
   (jk_channel_un_private_t *)(_this-_privatePtr);
  -int rc;
  +int rc=JK_OK;
   
   if( socketInfo-file==NULL ) {
   char *localName=_this-mbean-localName;
  @@ -147,10 +147,10 @@
   strcpy(socketInfo-unix_addr.sun_path,  socketInfo-file );
   
   env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channelApr.resolve(): create AF_UNIX  %s\n, 
socketInfo-file );
  +  channelUn.init(): create AF_UNIX  %s\n, socketInfo-file );
   } else {
  -env-l-jkLog(env, env-l, JK_LOG_ERROR, jk2_channel_un_init: 
  -  can't resolve %s errno=%d\n, socketInfo-file, errno );
  +env-l-jkLog(env, env-l, JK_LOG_ERROR, channelUn.init(): 
  +  can't init %s errno=%d\n, socketInfo-file, errno );
   }
   
   return rc;
  @@ -175,8 +175,9 @@
   return JK_ERR;
   }
   
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channelApr.open(): create unix socket %s %d\n, 
socketInfo-file, unixsock );
  +if( _this-mbean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  channelApr.open(): create unix socket %s %d\n, 
socketInfo-file, unixsock );
   
   if (connect(unixsock,(struct sockaddr *)(socketInfo-unix_addr),
   sizeof(struct sockaddr_un))0) {
  @@ -186,8 +187,9 @@
 errno, strerror( errno ) );
   return JK_ERR;
   }
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channelApr.open(): connect unix socket %d %s\n, unixsock, 
socketInfo-file );
  +if( _this-mbean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  channelApr.open(): connect unix socket %d %s\n, unixsock, 
socketInfo-file );
   /* store the channel information */
   
   endpoint-sd=unixsock;
  @@ -234,10 +236,11 @@
   /* this_time = send(unixsock, (char *)b + sent , len - sent,  0); */
   errno=0;
   this_time = write(unixsock, (char *)b + sent , len - sent);
  -
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channel.apr:send() write() %d %d %s\n, this_time, errno,
  -  strerror( errno));
  +
  +if( _this-mbean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  channel.apr:send() write() %d %d %s\n, this_time, errno,
  +  strerror( errno));
   /* if( errno != 0 ) { */
   /* env-l-jkLog(env, env-l, JK_LOG_ERROR, */
   /*   channel.apr:send() send() %d %d %s\n, this_time, 
errno, */
  @@ -330,9 +333,10 @@
   return JK_ERR;
   }
   
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  channelApr.receive(): Received len=%d type=%d\n,
  -  blen, (int)msg-buf[hlen]);
  +if( _this-mbean-debug  0 ) 
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  channelApr.receive(): Received 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-25 Thread costin

costin  02/04/25 12:24:17

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Implement the jni side for the dispatch.
  
  Revision  ChangesPath
  1.13  +319 -16   jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- jk_jni_aprImpl.c  18 Apr 2002 22:52:33 -  1.12
  +++ jk_jni_aprImpl.c  25 Apr 2002 19:24:17 -  1.13
  @@ -72,7 +72,6 @@
   #include stdio.h
   #include string.h
   #include signal.h
  -#include sys/socket.h
   #include sys/un.h
   
   #include org_apache_jk_apr_AprImpl.h
  @@ -80,7 +79,6 @@
   #include jk_global.h
   #include jk_map.h
   #include jk_pool.h
  -/* #include jk_scoreboard.h */
   
   #include apr_strings.h
   #include apr_portable.h
  @@ -96,12 +94,55 @@
   
   #include apr_proc_mutex.h
   
  +static apr_pool_t *jniAprPool;
  +static jk_workerEnv_t *workerEnv;
  +
  +/*  Apr initialization and pools  */
   
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_initialize(JNIEnv *jniEnv, jobject _jthis)
   {
  -/* fprintf(stderr, XXX AprInitialize\n); */
  +jk_env_t *env;
  +
   apr_initialize(); 
  +apr_pool_create( jniAprPool, NULL );
  +
  +if( jk_env_globalEnv == NULL ) {
  +jk_pool_t *globalPool;
  +jk_bean_t *jkb;
  +
  +if( jniAprPool==NULL ) {
  +return 0;
  +}
  +jk2_pool_apr_create( NULL, globalPool, NULL, jniAprPool );
  +/* Create the global env */
  +env=jk2_env_getEnv( NULL, globalPool );
  +}
  +env=jk_env_globalEnv;
  +
  +workerEnv=env-getByName( env, workerEnv );
  +if( workerEnv==NULL ) {
  +jk_bean_t *jkb;
  +
  +jkb=env-createBean2( env, env-globalPool, logger.file, );
  +if( jkb==NULL ) {
  +fprintf(stderr, Error creating logger );
  +return JK_ERR;
  +}
  +
  +env-l=jkb-object;;
  +env-alias( env, logger.file:, logger);
  +
  +jkb=env-createBean2( env, env-globalPool,workerEnv, );
  +env-alias( env, workerEnv:, workerEnv);
  +if( jkb==NULL ) {
  +fprintf(stderr, Error creating workerEnv );
  +return JK_ERR;
  +}
  +
  +workerEnv=jkb-object;
  +}
  +fprintf( stderr, XXX aprImpl: %p %p\n, env, workerEnv);
   return 0;
   }
   
  @@ -134,6 +175,8 @@
   return 0;
   }
   
  +/*  Signals  */
  +
   static void jk2_SigAction(int signal) {
   
   }
  @@ -164,6 +207,8 @@
   return 0;
   }
   
  +/*  User related functions  */
  +
   JNIEXPORT jlong JNICALL 
   Java_org_apache_jk_apr_AprImpl_userId(JNIEnv *jniEnv, jobject _jthis, jlong pool)
   {
  @@ -172,19 +217,6 @@
   }
   
   
  -/*
  -  SendPacket 
  -*/
  -JNIEXPORT jint JNICALL 
  -Java_org_apache_jk_apr_AprImpl_sendPacket
  -  (JNIEnv *jniEnv, jobject o, jlong xEnv, jlong eP, jbyteArray data,
  -   jint len)
  -{
  -return (jint)jk2_channel_jni_javaSendPacket( jniEnv, o, xEnv, eP,
  -data, len);
  -}
  -
  -
   /*  Shared memory  */
   /* Use it to access the scoreboard or for shmem channel */
   
  @@ -272,6 +304,41 @@
   return apr_shm_destroy(shm);
   }
   
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmGetInt(JNIEnv *jniEnv, jobject _jthis, 
  + jlong poolJ, jlong mP )
  +{
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +int *mem=(int *)(void *)(long)mP;
  +jbyte *nbuf;
  +int rd;
  +
  +/* XXX use atomic */
  +return (jint)*mem;
  +}
  +
  +JNIEXPORT void JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmSetInt(JNIEnv *jniEnv, jobject _jthis, 
  + jlong poolJ, jlong mP, jint value )
  +{
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +int *mem=(int *)(void *)(long)mP;
  +
  +/* XXX use atomic */
  +*mem=(int)value;
  +}
  +
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmIncrement(JNIEnv *jniEnv, jobject _jthis, 
  +jlong poolJ, jlong mP )
  +{
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +int *mem=(int  *)(void *)(long)mP;
  +
  +/* XXX use atomic */
  +*mem++;
  +}
  +
   
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_shmRead(JNIEnv *jniEnv, jobject _jthis, 
  @@ -659,4 +726,240 @@
   return 0;
   }
   
  +/*  Access jk components  */
  +
  +/*
  + * Get a jk_env_t * from the pool
  + *
  + * XXX We should use per thread data 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-18 Thread costin

costin  02/04/18 15:52:33

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Few fixes. Now the scoreboard works from the java side as well.
  
  Started work on the mutexes.
  
  Revision  ChangesPath
  1.12  +128 -3jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_jni_aprImpl.c  17 Apr 2002 22:51:02 -  1.11
  +++ jk_jni_aprImpl.c  18 Apr 2002 22:52:33 -  1.12
  @@ -199,9 +199,28 @@
   apr_status_t rv;
   apr_shm_t *aprShm;
   
  +rv = apr_shm_attach(aprShm, fname, pool);
  +
  +(*jniEnv)-ReleaseStringUTFChars(jniEnv, fileJ, fname);
  +
  +if (rv != APR_SUCCESS) {
  +return (jlong)NULL;
  +}
  +return (jlong)(long)(void *)aprShm;
  +}
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
poolJ,
  + jlong size, jstring fileJ)
  +{
  +char *fname=(char *)(*jniEnv)-GetStringUTFChars(jniEnv, fileJ, 0);
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +apr_status_t rv;
  +apr_shm_t *aprShm;
  +
   apr_file_remove(fname, pool); /* ignore errors */
   
  -rv = apr_shm_attach(aprShm, fname, pool);
  +rv = apr_shm_create(aprShm, size, fname, pool);
   
   (*jniEnv)-ReleaseStringUTFChars(jniEnv, fileJ, fname);
   
  @@ -218,8 +237,10 @@
   {
   apr_shm_t *shm=(apr_shm_t *)(void *)(long)shmP;
   void *sb_shared;
  -
  +
  +fprintf(stderr, GET BASE ADDR %p, shmP ); 
   sb_shared = apr_shm_baseaddr_get(shm);
  +fprintf(stderr, GOt BASE ADDR %p, sb_shared ); 
   return (jlong)(long)(void *)sb_shared;
   }

  @@ -251,6 +272,56 @@
   return apr_shm_destroy(shm);
   }
   
  +
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmRead(JNIEnv *jniEnv, jobject _jthis, 
  +   jlong poolJ, jlong mP, 
  +   jbyteArray bufJ, jint from, jint cnt)
  +{
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +char *mem=(char *)(void *)(long)mP;
  +jbyte *nbuf;
  +int rd;
  +jboolean iscommit;
  +
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, bufJ, iscommit);
  +if( ! nbuf ) {
  +return -1;
  +}
  +
  +memcpy( nbuf + from, mem, cnt ); 
  +
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, bufJ, nbuf, 0);
  +return (jint)cnt;
  +}
  +
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmWrite(JNIEnv *jniEnv, jobject _jthis, 
  +   jlong poolJ, jlong mP, 
  +   jbyteArray bufJ, jint from, jint cnt)
  +{
  +apr_status_t status;
  +apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  +jbyte *nbuf;
  +char *mem=(char *)(void *)(long)mP;
  +int rd;
  +jboolean iscommit;
  +
  +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, bufJ, iscommit);
  +if( ! nbuf ) {
  +return -1;
  +}
  +
  +/* write */
  +memcpy( mem, nbuf + from,  cnt ); 
  +
  +(*jniEnv)-ReleaseByteArrayElements(jniEnv, bufJ, nbuf, 0);
  +return (jint)rd;
  +}
  +
  +
  +
  +
   #else
   
   
  @@ -261,6 +332,12 @@
   return (jlong)0;
   }
   
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_shmCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
poolJ,
  + jstring fileJ)
  +{
  +return (jlong)0;
  +}
   
   JNIEXPORT jlong JNICALL 
   Java_org_apache_jk_apr_AprImpl_shmBaseaddrGet(JNIEnv *jniEnv, jobject _jthis, jlong 
pool,
  @@ -296,7 +373,7 @@
   /*  interprocess mutexes  */
   
   JNIEXPORT jlong JNICALL 
  -Java_org_apache_jk_apr_AprImpl_mutexCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
pool,
  +Java_org_apache_jk_apr_AprImpl_mutexCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  jstring fileJ,
  jint mechJ )
   {
  @@ -309,6 +386,54 @@
   st=apr_proc_mutex_create( mutex, fname, mech, pool );
   
   return (jlong)(long)(void *)mutex;
  +}
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_mutexLock(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  + jlong mutexP )
  +{
  +apr_proc_mutex_t *mutex=(apr_proc_mutex_t *)(void *)(long)mutexP;
  +apr_status_t  st;
  +
  +st=apr_proc_mutex_lock( mutex );
  +
  +return (jlong)(long)st;
  +}
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_mutexTryLock(JNIEnv *jniEnv, jobject _jthis, jlong 
poolP,
  +   

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-17 Thread costin

costin  02/04/17 15:51:02

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  Small fix in shmAttach.
  
  Started to add mutexes ( to support shm end not only ).
  
  Again ( see the comments in AprImpl ) - the interfaces are not even started,
  this is just the JNI code. AprImpl will have many native methods, with longs and
  other strange things - not to be called by any user code.
  
  Also note that we'll not support all APR functions - only what's missing
  in java.
  
  Revision  ChangesPath
  1.11  +23 -1 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_jni_aprImpl.c  15 Apr 2002 23:54:51 -  1.10
  +++ jk_jni_aprImpl.c  17 Apr 2002 22:51:02 -  1.11
  @@ -94,6 +94,9 @@
   #include apr_shm.h
   #endif
   
  +#include apr_proc_mutex.h
  +
  +
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_initialize(JNIEnv *jniEnv, jobject _jthis)
   {
  @@ -189,7 +192,7 @@
   
   JNIEXPORT jlong JNICALL 
   Java_org_apache_jk_apr_AprImpl_shmAttach(JNIEnv *jniEnv, jobject _jthis, jlong 
poolJ,
  -   jlong size, jstring fileJ)
  + jstring fileJ)
   {
   char *fname=(char *)(*jniEnv)-GetStringUTFChars(jniEnv, fileJ, 0);
   apr_pool_t *pool=(apr_pool_t *)(void *)(long)poolJ;
  @@ -289,6 +292,25 @@
   }
   
   #endif 
  +
  +/*  interprocess mutexes  */
  +
  +JNIEXPORT jlong JNICALL 
  +Java_org_apache_jk_apr_AprImpl_mutexCreate(JNIEnv *jniEnv, jobject _jthis, jlong 
pool,
  +   jstring fileJ,
  +   jint mechJ )
  +{
  +apr_proc_mutex_t *mutex;
  +char *fname;
  +apr_lockmech_e mech;
  +apr_pool_t *pool;
  +apr_status_t  st;
  +
  +st=apr_proc_mutex_create( mutex, fname, mech, pool );
  +
  +return (jlong)(long)(void *)mutex;
  +}
  +
   
   /*  Unix sockets  */
   /* It seems apr doesn't support them yet, so this code will use the
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-15 Thread costin

costin  02/04/15 16:54:51

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  A single class will deal with native.
  
  Revision  ChangesPath
  1.10  +17 -1 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jk_jni_aprImpl.c  10 Apr 2002 23:49:02 -  1.9
  +++ jk_jni_aprImpl.c  15 Apr 2002 23:54:51 -  1.10
  @@ -168,6 +168,20 @@
   return 0;
   }
   
  +
  +/*
  +  SendPacket 
  +*/
  +JNIEXPORT jint JNICALL 
  +Java_org_apache_jk_apr_AprImpl_sendPacket
  +  (JNIEnv *jniEnv, jobject o, jlong xEnv, jlong eP, jbyteArray data,
  +   jint len)
  +{
  +return (jint)jk2_channel_jni_javaSendPacket( jniEnv, o, xEnv, eP,
  +data, len);
  +}
  +
  +
   /*  Shared memory  */
   /* Use it to access the scoreboard or for shmem channel */
   
  @@ -391,6 +405,8 @@
   while( 1 ) {
   int connfd;
   
  +fprintf(stderr, unAccept\n);
  +
   clientlen=sizeof( client );
   connfd=accept( listenUnSocket, (struct sockaddr *)client, clientlen );
   /* XXX Should we return EINTR ? This would allow us to stop
  @@ -405,6 +421,7 @@
   return -errno;
   }
   }
  +fprintf(stderr, unAccept: accepted %d\n, connfd);
   return (jlong)connfd;
   }
   return 0L;
  @@ -494,6 +511,5 @@
   }
   return 0;
   }
  -
   
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-10 Thread costin

costin  02/04/10 16:49:02

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Log:
  I don't know why apr_initialize was commented out.
  
  Revision  ChangesPath
  1.9   +2 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jk_jni_aprImpl.c  8 Apr 2002 19:17:35 -   1.8
  +++ jk_jni_aprImpl.c  10 Apr 2002 23:49:02 -  1.9
  @@ -97,7 +97,8 @@
   JNIEXPORT jint JNICALL 
   Java_org_apache_jk_apr_AprImpl_initialize(JNIEnv *jniEnv, jobject _jthis)
   {
  -/* apr_initialize(); */
  +/* fprintf(stderr, XXX AprInitialize\n); */
  +apr_initialize(); 
   return 0;
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-04-08 Thread costin

costin  02/04/08 12:17:35

  Modified:jk/native2/jni jk_jni_aprImpl.c
  Added:   jk/native2/common jk_shm.c
  Log:
  Initial ( and mostly untested ) shared memory code.
  
  It'll work only if APR is enabled ( like all 'advanced' features ).
  
  I also added some minimal code to support it from the java side - it's
  based on the rough 'long as void *' representation - not supposed to
  be visible from the user side, just to keep the C code simple while
  doing the data abstraction in java.
  
  As you may notice, there's no object interface yet - I'm still exploring
  how to implement this on top of 1.4 nio ( or something that is close as
  interface - obviously requiring 1.4 to use shmem and APR is not the best
  option :-)
  
  In any case, the goal is to have at least worker status exposed in
  a shared memory segment and java access to it.
  Long term this will be used for configuring multi-process servers
  ( i.e. apache ).
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jk/native2/common/jk_shm.c
  
  Index: jk_shm.c
  ===
  /* = *
   *   *
   * The Apache Software License,  Version 1.1 *
   *   *
   *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
   *   All rights reserved.*
   *   *
   * = *
   *   *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *   *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *notice, this list of conditions and the following disclaimer.  *
   *   *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *notice,  this list of conditions  and the following  disclaimer in the *
   *documentation and/or other materials provided with the distribution.   *
   *   *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *must include the following acknowlegement: *
   *   *
   *   This product includes  software developed  by the Apache  Software *
   *Foundation http://www.apache.org/.  *
   *   *
   *Alternately, this acknowlegement may appear in the software itself, if *
   *and wherever such third-party acknowlegements normally appear. *
   *   *
   * 4. The names  The  Jakarta  Project,  Jk,  and  Apache  Software *
   *Foundation  must not be used  to endorse or promote  products derived *
   *from this  software without  prior  written  permission.  For  written *
   *permission, please contact [EMAIL PROTECTED].*
   *   *
   * 5. Products derived from this software may not be called Apache nor may *
   *Apache appear in their names without prior written permission of the *
   *Apache Software Foundation.*
   *   *
   * THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.  

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-01-14 Thread jfclere

jfclere 02/01/14 01:36:13

  Modified:jk/java/org/apache/jk/common ChannelUn.java
   jk/native2 build.xml
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  The file used by the socket was removed twice (in java and native code).
  I have commented out the removal in the native code (more things in java ;-))
  
  Revision  ChangesPath
  1.3   +5 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChannelUn.java12 Jan 2002 04:03:42 -  1.2
  +++ ChannelUn.java14 Jan 2002 09:36:13 -  1.3
  @@ -140,9 +140,13 @@
   
   File socketFile=new File( file );
   if( socketFile.exists() ) {
  -socketFile.delete();
  +// The socket file cannot be removed ...
  +if (!socketFile.delete())
  +  throw(new IOException(Cannot remove  + file));
   }
   unixListenSocket=apr.unSocketListen( gPool, file, 10 );
  +if (unixListenSocket0)
  +throw(new IOException(Cannot create listening socket));
   
   // Run a thread that will accept connections.
   tp.start();
  
  
  
  1.12  +1 -1  jakarta-tomcat-connectors/jk/native2/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- build.xml 12 Jan 2002 05:25:08 -  1.11
  +++ build.xml 14 Jan 2002 09:36:13 -  1.12
  @@ -6,8 +6,8 @@
 
 property file=${user.home}/.ant.properties /
 property file=${user.home}/build.properties /
  -  property file=../build.properties /
 property file=build.properties /
  +  property file=../build.properties /
   
 !-- == Local paths, overriden in build.properties == --
   
  
  
  
  1.5   +2 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_jni_aprImpl.c  12 Jan 2002 05:25:09 -  1.4
  +++ jk_jni_aprImpl.c  14 Jan 2002 09:36:13 -  1.5
  @@ -202,10 +202,11 @@
   strcpy(unixAddr.sun_path, host);
   (*jniEnv)-ReleaseStringUTFChars(jniEnv, hostJ, host);
   
  -// remove the exist socket.
  +/* remove the exist socket. (it had been moved in ChannelUn.java).
   if (unlink(unixAddr.sun_path)  0  errno != ENOENT) {
   // The socket cannot be remove... Well I hope that no problems ;-)
   }
  + */
   
   unixSocket = socket(AF_UNIX, SOCK_STREAM, 0);
   if (unixSocket0) {
  
  
  

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




Re: cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-01-14 Thread jean-frederic clere

[EMAIL PROTECTED] wrote:
 
 jfclere 02/01/14 01:36:13
 
   Modified:jk/java/org/apache/jk/common ChannelUn.java
jk/native2 build.xml

Oops, I miss build.xml. I have changed the order because the ./build.properties
were overwritten by the ../build.properties
(For example: apr.include in /home/apache20/apache (from ../build.properties)
instead of /home1/apache20/include (from ./build.properties))

jk/native2/jni jk_jni_aprImpl.c
   Log:
   The file used by the socket was removed twice (in java and native code).
   I have commented out the removal in the native code (more things in java ;-))
 
   Revision  ChangesPath
   1.3   +5 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
 
   Index: ChannelUn.java
   ===
   RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
   retrieving revision 1.2
   retrieving revision 1.3
   diff -u -r1.2 -r1.3
   --- ChannelUn.java12 Jan 2002 04:03:42 -  1.2
   +++ ChannelUn.java14 Jan 2002 09:36:13 -  1.3
   @@ -140,9 +140,13 @@
 
File socketFile=new File( file );
if( socketFile.exists() ) {
   -socketFile.delete();
   +// The socket file cannot be removed ...
   +if (!socketFile.delete())
   +  throw(new IOException(Cannot remove  + file));
}
unixListenSocket=apr.unSocketListen( gPool, file, 10 );
   +if (unixListenSocket0)
   +throw(new IOException(Cannot create listening socket));
 
// Run a thread that will accept connections.
tp.start();
 
 
 
   1.12  +1 -1  jakarta-tomcat-connectors/jk/native2/build.xml
 
   Index: build.xml
   ===
   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
   retrieving revision 1.11
   retrieving revision 1.12
   diff -u -r1.11 -r1.12
   --- build.xml 12 Jan 2002 05:25:08 -  1.11
   +++ build.xml 14 Jan 2002 09:36:13 -  1.12
   @@ -6,8 +6,8 @@
 
  property file=${user.home}/.ant.properties /
  property file=${user.home}/build.properties /
   -  property file=../build.properties /
  property file=build.properties /
   +  property file=../build.properties /
 
  !-- == Local paths, overriden in build.properties == --
 
 
 
 
   1.5   +2 -1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
 
   Index: jk_jni_aprImpl.c
   ===
   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
   retrieving revision 1.4
   retrieving revision 1.5
   diff -u -r1.4 -r1.5
   --- jk_jni_aprImpl.c  12 Jan 2002 05:25:09 -  1.4
   +++ jk_jni_aprImpl.c  14 Jan 2002 09:36:13 -  1.5
   @@ -202,10 +202,11 @@
strcpy(unixAddr.sun_path, host);
(*jniEnv)-ReleaseStringUTFChars(jniEnv, hostJ, host);
 
   -// remove the exist socket.
   +/* remove the exist socket. (it had been moved in ChannelUn.java).
if (unlink(unixAddr.sun_path)  0  errno != ENOENT) {
// The socket cannot be remove... Well I hope that no problems ;-)
}
   + */
 
unixSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (unixSocket0) {
 
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]

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




RE: cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-01-14 Thread GOMEZ Henri

Seems to be good ;)

Tks JF 

-
Henri Gomez ___[_]
EMAIL : [EMAIL PROTECTED](. .) 
PGP KEY : 697ECEDD...oOOo..(_)..oOOo...
PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6 



-Original Message-
From: jean-frederic clere [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 14, 2002 11:59 AM
To: Tomcat Developers List
Subject: Re: cvs commit: jakarta-tomcat-connectors/jk/native2/jni
jk_jni_aprImpl.c


[EMAIL PROTECTED] wrote:
 
 jfclere 02/01/14 01:36:13
 
   Modified:jk/java/org/apache/jk/common ChannelUn.java
jk/native2 build.xml

Oops, I miss build.xml. I have changed the order because the 
./build.properties
were overwritten by the ../build.properties
(For example: apr.include in /home/apache20/apache (from 
../build.properties)
instead of /home1/apache20/include (from ./build.properties))

jk/native2/jni jk_jni_aprImpl.c
   Log:
   The file used by the socket was removed twice (in java and 
native code).
   I have commented out the removal in the native code (more 
things in java ;-))
 
   Revision  ChangesPath
   1.3   +5 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
 
   Index: ChannelUn.java
   ===
   RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/commo
n/ChannelUn.java,v
   retrieving revision 1.2
   retrieving revision 1.3
   diff -u -r1.2 -r1.3
   --- ChannelUn.java12 Jan 2002 04:03:42 -  1.2
   +++ ChannelUn.java14 Jan 2002 09:36:13 -  1.3
   @@ -140,9 +140,13 @@
 
File socketFile=new File( file );
if( socketFile.exists() ) {
   -socketFile.delete();
   +// The socket file cannot be removed ...
   +if (!socketFile.delete())
   +  throw(new IOException(Cannot remove  + file));
}
unixListenSocket=apr.unSocketListen( gPool, file, 10 );
   +if (unixListenSocket0)
   +throw(new IOException(Cannot create 
listening socket));
 
// Run a thread that will accept connections.
tp.start();
 
 
 
   1.12  +1 -1  jakarta-tomcat-connectors/jk/native2/build.xml
 
   Index: build.xml
   ===
   RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
   retrieving revision 1.11
   retrieving revision 1.12
   diff -u -r1.11 -r1.12
   --- build.xml 12 Jan 2002 05:25:08 -  1.11
   +++ build.xml 14 Jan 2002 09:36:13 -  1.12
   @@ -6,8 +6,8 @@
 
  property file=${user.home}/.ant.properties /
  property file=${user.home}/build.properties /
   -  property file=../build.properties /
  property file=build.properties /
   +  property file=../build.properties /
 
  !-- == Local paths, overriden in 
build.properties == --
 
 
 
 
   1.5   +2 -1  
jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
 
   Index: jk_jni_aprImpl.c
   ===
   RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
   retrieving revision 1.4
   retrieving revision 1.5
   diff -u -r1.4 -r1.5
   --- jk_jni_aprImpl.c  12 Jan 2002 05:25:09 -  1.4
   +++ jk_jni_aprImpl.c  14 Jan 2002 09:36:13 -  1.5
   @@ -202,10 +202,11 @@
strcpy(unixAddr.sun_path, host);
(*jniEnv)-ReleaseStringUTFChars(jniEnv, hostJ, host);
 
   -// remove the exist socket.
   +/* remove the exist socket. (it had been moved in 
ChannelUn.java).
if (unlink(unixAddr.sun_path)  0  errno != ENOENT) {
// The socket cannot be remove... Well I hope 
that no problems ;-)
}
   + */
 
unixSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (unixSocket0) {
 
 
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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

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




Re: cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-01-14 Thread jean-frederic clere

GOMEZ Henri wrote:
 
 Seems to be good ;)
 
 Tks JF

You are welcome

 
 -
 Henri Gomez ___[_]
 EMAIL : [EMAIL PROTECTED](. .)
 PGP KEY : 697ECEDD...oOOo..(_)..oOOo...
 PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6
 
 -Original Message-
 From: jean-frederic clere [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 14, 2002 11:59 AM
 To: Tomcat Developers List
 Subject: Re: cvs commit: jakarta-tomcat-connectors/jk/native2/jni
 jk_jni_aprImpl.c
 
 
 [EMAIL PROTECTED] wrote:
 
  jfclere 02/01/14 01:36:13
 
Modified:jk/java/org/apache/jk/common ChannelUn.java
 jk/native2 build.xml
 
 Oops, I miss build.xml. I have changed the order because the
 ./build.properties
 were overwritten by the ../build.properties
 (For example: apr.include in /home/apache20/apache (from
 ../build.properties)
 instead of /home1/apache20/include (from ./build.properties))
 
 jk/native2/jni jk_jni_aprImpl.c
Log:
The file used by the socket was removed twice (in java and
 native code).
I have commented out the removal in the native code (more
 things in java ;-))
 
Revision  ChangesPath
1.3   +5 -1
 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
 
Index: ChannelUn.java
===
RCS file:
 /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/commo
 n/ChannelUn.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChannelUn.java12 Jan 2002 04:03:42 -  1.2
+++ ChannelUn.java14 Jan 2002 09:36:13 -  1.3
@@ -140,9 +140,13 @@
 
 File socketFile=new File( file );
 if( socketFile.exists() ) {
-socketFile.delete();
+// The socket file cannot be removed ...
+if (!socketFile.delete())
+  throw(new IOException(Cannot remove  + file));
 }
 unixListenSocket=apr.unSocketListen( gPool, file, 10 );
+if (unixListenSocket0)
+throw(new IOException(Cannot create
 listening socket));
 
 // Run a thread that will accept connections.
 tp.start();
 
 
 
1.12  +1 -1  jakarta-tomcat-connectors/jk/native2/build.xml
 
Index: build.xml
===
RCS file:
 /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- build.xml 12 Jan 2002 05:25:08 -  1.11
+++ build.xml 14 Jan 2002 09:36:13 -  1.12
@@ -6,8 +6,8 @@
 
   property file=${user.home}/.ant.properties /
   property file=${user.home}/build.properties /
-  property file=../build.properties /
   property file=build.properties /
+  property file=../build.properties /
 
   !-- == Local paths, overriden in
 build.properties == --
 
 
 
 
1.5   +2 -1
 jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
 
Index: jk_jni_aprImpl.c
===
RCS file:
 /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jk_jni_aprImpl.c  12 Jan 2002 05:25:09 -  1.4
+++ jk_jni_aprImpl.c  14 Jan 2002 09:36:13 -  1.5
@@ -202,10 +202,11 @@
 strcpy(unixAddr.sun_path, host);
 (*jniEnv)-ReleaseStringUTFChars(jniEnv, hostJ, host);
 
-// remove the exist socket.
+/* remove the exist socket. (it had been moved in
 ChannelUn.java).
 if (unlink(unixAddr.sun_path)  0  errno != ENOENT) {
 // The socket cannot be remove... Well I hope
 that no problems ;-)
 }
+ */
 
 unixSocket = socket(AF_UNIX, SOCK_STREAM, 0);
 if (unixSocket0) {
 
 
 
 
  --
  To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]

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




cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2002-01-11 Thread costin

costin  02/01/11 21:25:09

  Modified:jk/native2 CHANGES.html build.xml
   jk/native2/jni jk_jni_aprImpl.c
  Log:
  Document some of the changes. Move some of the code did by Jean-Francisc in 
jk_jni_aprImpl.
  
  The whole thing will disapear as soon as apr adds the support.
  
  Revision  ChangesPath
  1.4   +26 -0 jakarta-tomcat-connectors/jk/native2/CHANGES.html
  
  Index: CHANGES.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/CHANGES.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CHANGES.html  17 Dec 2001 07:17:08 -  1.3
  +++ CHANGES.html  12 Jan 2002 05:25:08 -  1.4
  @@ -18,6 +18,17 @@
   efficient./li
   li 
 /ul
  +
  +liJNI worker. Most options on the jni worker are now optional, jk can detect
  +and set them automcatically. This reduce the effort needed to configure jni.
  +It is _required_ that LD_LIBRARY_PATH or equivalent is set coreclty, otherwise
  +java will not start and apache will crash. ( on windows this may not be needed ).
  +The user must set either as environment variables or in httpd.conf ( using JkSet )
  +or in workers.properties: JAVA_HOME, TOMCAT_HOME ( or CATALINA_HOME ). Jk must
  +be installed in the standard location ( modules/ or webapps/. The output from
  +the vm will go in apache's error.log ( like all other jk output ) unless
  +a special file is requested.
  +
   /ul
   
   h4Developer specific/h4
  @@ -54,6 +65,21 @@
   liMethod signatures. Jk2 uses the same 'patterns' as jni, with a jk_env as 
   first parameter, then 'this' (the pointer to the object ), then regular parameters.
   The same pattern is used no consistently in all methods.
  +
  +liJNI has been refactored. On file, jk_vmutil deals with the creation of the
  +vm and guessing of all properties needed to create a java vm. It could be possible
  +to create specialized instances of jk_vmutil for different vms ( the default 
  +works for most ).
  +
  +liJNI now uses the channel abstraction to send/receive messages. In future we 
  +could refine this to use a special 'marshalling' that will map 'messages' into
  +method invocations. One big benefit is that we can now reuse all objects, no
  +longer need to use strings ( and thus enable the solving of most i18n problems ).
  +The code is also more 'uniform' and easier to extend.
  +
  +liJNI worker is no longer singleton and can be used to start multiple java 
  +programms in the same process. Probably not very usefull for jk in particular, 
  +but the restriction was not needed. 
   
   li(not completed) Error handling. The env parameter will provide a mechanism to
   pass error information up the stack ( eventually a stack trace ). It'll also   
  
  
  
  1.11  +7 -30 jakarta-tomcat-connectors/jk/native2/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build.xml 6 Jan 2002 09:06:02 -   1.10
  +++ build.xml 12 Jan 2002 05:25:08 -  1.11
  @@ -43,7 +43,7 @@
   
 !--  Targets  --
   
  -  target name=main depends=init,apache20,jni,unixsocket
  +  target name=main depends=init,apache20,jni
 /target
   
 target name=init 
  @@ -77,6 +77,9 @@
   info=Use the MD5 implementation that is part of apache2 /
 def name=HAS_APR 
   info=Allow APR specific extensions /
  +  def name=HAVE_JNI 
  +info=Jni worker /
  +  def name=HPUX11 if=hpux /
 src dir=.
include name=server/apache2/*.c /
include name=common/*.c /
  @@ -89,6 +92,7 @@
include name=${native.dir}/include /
include name=${java.home}/../include /
   include name=${java.home}/../include/linux if=linux /
  +include name=${java.home}/../include/hp-ux if=hpux /
 /includes
 depends
fileset dir=${native.dir}/common includes=*.h /
  @@ -128,6 +132,7 @@
   
   include name=${java.home}/../include/win32 if=win32 /
   include name=${java.home}/../include/linux if=linux /
  +include name=${java.home}/../include/linux if=linux /
 /includes
 depends
fileset dir=${native.dir}/common includes=*.h /
  @@ -156,6 +161,7 @@
 linkOpt value=-threadname quot;JK_JNI Threadquot; if=netware /
 linkOpt value=-stacksize 64000 if=netware /
 
  +  def name=HPUX11 if=hpux /
 def name=WIN32 if=win32 /
 def name=NDEBUG if=win32  /
 def name=_WINDOWS if=win32 /
  @@ -406,33 +412,4 @@
   /delete
 /target
   
  -  target name=unixsocket depends=init if=useunixsocket
  -mkdir dir=${jk.build}/WEB-INF/jk2/unixsocket /
  -so 

cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jni_aprImpl.c

2001-12-05 Thread costin

costin  01/12/05 12:52:41

  Modified:jk/native2 build.xml
  Added:   jk/native2/jni jk_jni_aprImpl.c
  Log:
  Added the initial stub for the jni code to use apr from java.
  
  This is needed to implement any 'fun' channel ( unix domain, shmem, etc ). It'll
  also be used to implement signals ( so Jk can triger soft restarts on apache )
  and maybe change uid ( not related with jk, but trivial to do ).
  
  For now the focus is getting the functionality in ( i.e. the JNI code ), not
  the interfaces - long term we should use some nice interfaces ( like
  Socket for unix domain sockets, etc )
  
  Revision  ChangesPath
  1.4   +2 -0  jakarta-tomcat-connectors/jk/native2/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build.xml 2001/12/04 19:11:02 1.3
  +++ build.xml 2001/12/05 20:52:41 1.4
  @@ -83,6 +83,7 @@
 includes
include name=${native.dir}/common /
include name=${apache2.include} /
  + include name=${apr.include} /
include name=${native.dir}/include /
include name=${java.home}/../include /
 /includes
  @@ -115,6 +116,7 @@
include name=${native.dir}/include /
include name=${java.home}/../include /
include name=${build.compiler.base}/include /
  + include name=${apr.include} /
   
   !-- Platform specific includes --
include name=${novellndk.dir}/include/nlm if=netware /
  
  
  
  1.1  jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===
  /* = *
   *   *
   * The Apache Software License,  Version 1.1 *
   *   *
   *  Copyright (c) 1999-2001 The Apache Software Foundation.  *
   *   All rights reserved.*
   *   *
   * = *
   *   *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *   *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *notice, this list of conditions and the following disclaimer.  *
   *   *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *notice,  this list of conditions  and the following  disclaimer in the *
   *documentation and/or other materials provided with the distribution.   *
   *   *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *must include the following acknowlegement: *
   *   *
   *   This product includes  software developed  by the Apache  Software *
   *Foundation http://www.apache.org/.  *
   *   *
   *Alternately, this acknowlegement may appear in the software itself, if *
   *and wherever such third-party acknowlegements normally appear. *
   *   *
   * 4. The names  The  Jakarta  Project,  Jk,  and  Apache  Software *
   *Foundation  must not be used  to endorse or promote  products derived *
   *from this  software without  prior  written  permission.  For  written *
   *permission, please contact [EMAIL PROTECTED].*
   *   *
   * 5. Products derived from this software may not be called Apache nor may *
   *Apache appear in their names without prior written permission of the *
   *Apache Software Foundation.*
   *   *
   * THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A