tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jni/native/src pool.c shm.c
Date Thu, 03 Feb 2005 07:48:20 GMT
mturk       2005/02/02 23:48:20

  Modified:    jni/native/src pool.c shm.c
  Log:
  Add NIO ByteBuffer direct memory allocation.
  
  Revision  Changes    Path
  1.2       +30 -0     jakarta-tomcat-connectors/jni/native/src/pool.c
  
  Index: pool.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/pool.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pool.c	14 Jan 2005 13:47:58 -0000	1.1
  +++ pool.c	3 Feb 2005 07:48:20 -0000	1.2
  @@ -123,3 +123,33 @@
       (*e)->DeleteGlobalRef(e, cb->obj);
       free(cb);
   }
  +
  +TCN_IMPLEMENT_CALL(jobject, Pool, alloc)(TCN_STDARGS, jlong pool,
  +                                         jint size)
  +{
  +    apr_pool_t *p = J2P(pool, apr_pool_t *);
  +    apr_size_t sz = (apr_size_t)size;
  +    void *mem;
  +
  +    UNREFERENCED(o);
  +    
  +    if ((mem = apr_palloc(p, sz)) != NULL)
  +        return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
  +    else
  +        return NULL;
  +}
  +
  +TCN_IMPLEMENT_CALL(jobject, Pool, calloc)(TCN_STDARGS, jlong pool,
  +                                          jint size)
  +{
  +    apr_pool_t *p = J2P(pool, apr_pool_t *);
  +    apr_size_t sz = (apr_size_t)size;
  +    void *mem;
  +
  +    UNREFERENCED(o);
  +    
  +    if ((mem = apr_pcalloc(p, sz)) != NULL)
  +        return (*e)->NewDirectByteBuffer(e, mem, (jlong)sz);
  +    else
  +        return NULL;
  +}
  
  
  
  1.2       +14 -0     jakarta-tomcat-connectors/jni/native/src/shm.c
  
  Index: shm.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/shm.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- shm.c	14 Jan 2005 13:47:58 -0000	1.1
  +++ shm.c	3 Feb 2005 07:48:20 -0000	1.2
  @@ -108,3 +108,17 @@
       UNREFERENCED_STDARGS;
       return (jlong)apr_shm_size_get(s);
   }
  +
  +TCN_IMPLEMENT_CALL(jobject, Shm, buffer)(TCN_STDARGS, jlong shm)
  +{
  +    apr_shm_t *s = J2P(shm, apr_shm_t *);
  +    jlong sz = (jlong)apr_shm_size_get(s);
  +    void *a;
  +
  +    UNREFERENCED(o);
  +
  +    if ((a = apr_shm_baseaddr_get(s)) != NULL)
  +        return (*e)->NewDirectByteBuffer(e, a, sz);
  +    else
  +        return NULL;
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message