Author: rjung
Date: Thu Jan 1 02:52:46 2009
New Revision: 730523
URL: http://svn.apache.org/viewvc?rev=730523&view=rev
Log:
Sync methods implemented natively with their Java
references.
Fixes BZ 46457 and several other inconsistencies:
Changes to Java code:
Buffer: rename alloc() to malloc()
Buffer: change return type of size() from int to long
File: add getStat() and getInfo()
Registry: change val parameter in setValueJ() from int to long
Socket: add acceptx()
SSLContext: add setRandom()
SSLContext: rename setShutdowType() to setShutdownType()
Stdlib: change num parameter in calloc() from long to int
Changes to native code:
address.c: change return type of equal() from int to boolean
file.c: change pool parameter in mktemp() from int to long
lock.c: refer to Java method destroy instead of destoy in
Global and Lock
multicast.c: refer to Java class Multicast instead of Mulicast
ssl.c: add randSet() in non-OpenSSL case
sslcontext.c: whitespace
Modified:
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Buffer.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/File.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Registry.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSLContext.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java
tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Stdlib.java
tomcat/connectors/trunk/jni/native/src/address.c
tomcat/connectors/trunk/jni/native/src/file.c
tomcat/connectors/trunk/jni/native/src/lock.c
tomcat/connectors/trunk/jni/native/src/multicast.c
tomcat/connectors/trunk/jni/native/src/ssl.c
tomcat/connectors/trunk/jni/native/src/sslcontext.c
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Buffer.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Buffer.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Buffer.java
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Buffer.java Thu Jan
1 02:52:46 2009
@@ -32,7 +32,7 @@
* @param size The amount of memory to allocate
* @return The ByteBuffer with allocated memory
*/
- public static native ByteBuffer alloc(int size);
+ public static native ByteBuffer malloc(int size);
/**
* Allocate a new ByteBuffer from memory and set all of the memory to 0
@@ -86,6 +86,6 @@
* Returns the allocated memory size of the ByteBuffer.
* @param buf Previously allocated ByteBuffer.
*/
- public static native int size(ByteBuffer buf);
+ public static native long size(ByteBuffer buf);
}
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/File.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/File.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/File.java (original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/File.java Thu Jan 1
02:52:46 2009
@@ -693,6 +693,16 @@
public static native int stat(FileInfo finfo, String fname, int wanted,
long pool);
/**
+ * Get the specified file's stats. The file is specified by filename,
+ * instead of using a pre-opened file.
+ * @param fname The name of the file to stat.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of
APR_FINFO_ values
+ * @param pool the pool to use to allocate the new file.
+ * @return FileInfo object.
+ */
+ public static native FileInfo getStat(String fname, int wanted, long pool);
+
+ /**
* Get the specified file's stats.
* @param finfo Where to store the information about the file.
* @param wanted The desired apr_finfo_t fields, as a bit flag of
APR_FINFO_ values
@@ -700,4 +710,13 @@
*/
public static native int infoGet(FileInfo finfo, int wanted, long thefile);
+
+ /**
+ * Get the specified file's stats.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of
APR_FINFO_ values
+ * @param thefile The file to get information about.
+ * @return FileInfo object.
+ */
+ public static native FileInfo getInfo(int wanted, long thefile);
+
}
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Registry.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Registry.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Registry.java
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Registry.java Thu
Jan 1 02:52:46 2009
@@ -156,7 +156,7 @@
* @param val The the value to set
* @return If the function succeeds, the return value is 0
*/
- public static native int setValueJ(long key, String name, int val);
+ public static native int setValueJ(long key, String name, long val);
/**
* Set the Registry value for REG_SZ
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSLContext.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSLContext.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSLContext.java
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSLContext.java Thu
Jan 1 02:52:46 2009
@@ -226,6 +226,13 @@
throws Exception;
/**
+ * Set file for randomness
+ * @param ctx Server or Client context to use.
+ * @param file random file.
+ */
+ public static native void setRandom(long ctx, String file)
+
+ /**
* Set SSL connection shutdown type
* <br />
* The following levels are available for level:
@@ -237,7 +244,7 @@
* @param ctx Server or Client context to use.
* @param type Shutdown type to use.
*/
- public static native void setShutdowType(long ctx, int type);
+ public static native void setShutdownType(long ctx, int type);
/**
* Set Type of Client Certificate verification and Maximum depth of CA
Certificates
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Socket.java Thu Jan
1 02:52:46 2009
@@ -170,6 +170,16 @@
* made the connection request. This is the socket which should
* be used for all future communication.
*/
+ public static native long acceptx(long sock, long pool)
+ throws Exception;
+
+ /**
+ * Accept a new connection request
+ * @param sock The socket we are listening on.
+ * @return A copy of the socket that is connected to the socket that
+ * made the connection request. This is the socket which should
+ * be used for all future communication.
+ */
public static native long accept(long sock)
throws Exception;
Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Stdlib.java
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Stdlib.java?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Stdlib.java
(original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/Stdlib.java Thu Jan
1 02:52:46 2009
@@ -67,7 +67,7 @@
* @param num Number of elements.
* @param sz Length in bytes of each element.
*/
- public static native long calloc(long num, int sz);
+ public static native long calloc(int num, int sz);
/**
* Deallocates or frees a memory block.
Modified: tomcat/connectors/trunk/jni/native/src/address.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/address.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/address.c (original)
+++ tomcat/connectors/trunk/jni/native/src/address.c Thu Jan 1 02:52:46 2009
@@ -103,8 +103,8 @@
return P2J(sa);
}
-TCN_IMPLEMENT_CALL(jint, Address, equal)(TCN_STDARGS,
- jlong a, jlong b)
+TCN_IMPLEMENT_CALL(jboolean, Address, equal)(TCN_STDARGS,
+ jlong a, jlong b)
{
apr_sockaddr_t *sa = J2P(a, apr_sockaddr_t *);
apr_sockaddr_t *sb = J2P(b, apr_sockaddr_t *);
Modified: tomcat/connectors/trunk/jni/native/src/file.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/file.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/file.c (original)
+++ tomcat/connectors/trunk/jni/native/src/file.c Thu Jan 1 02:52:46 2009
@@ -92,7 +92,7 @@
TCN_IMPLEMENT_CALL(jlong, File, mktemp)(TCN_STDARGS, jstring templ,
jint flags,
- jint pool)
+ jlong pool)
{
apr_pool_t *p = J2P(pool, apr_pool_t *);
apr_file_t *f = NULL;
Modified: tomcat/connectors/trunk/jni/native/src/lock.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/lock.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/lock.c (original)
+++ tomcat/connectors/trunk/jni/native/src/lock.c Thu Jan 1 02:52:46 2009
@@ -84,7 +84,7 @@
return (jint)apr_proc_mutex_unlock(m);
}
-TCN_IMPLEMENT_CALL(jint, Lock, destoy)(TCN_STDARGS, jlong mutex)
+TCN_IMPLEMENT_CALL(jint, Lock, destroy)(TCN_STDARGS, jlong mutex)
{
apr_proc_mutex_t *m = J2P(mutex, apr_proc_mutex_t *);
@@ -192,7 +192,7 @@
return (jint)apr_global_mutex_unlock(m);
}
-TCN_IMPLEMENT_CALL(jint, Global, destoy)(TCN_STDARGS, jlong mutex)
+TCN_IMPLEMENT_CALL(jint, Global, destroy)(TCN_STDARGS, jlong mutex)
{
apr_global_mutex_t *m = J2P(mutex, apr_global_mutex_t *);
Modified: tomcat/connectors/trunk/jni/native/src/multicast.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/multicast.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/multicast.c (original)
+++ tomcat/connectors/trunk/jni/native/src/multicast.c Thu Jan 1 02:52:46 2009
@@ -22,9 +22,9 @@
#include "tcn.h"
-TCN_IMPLEMENT_CALL(jint, Mulicast, join)(TCN_STDARGS,
- jlong sock, jlong join,
- jlong iface, jlong source)
+TCN_IMPLEMENT_CALL(jint, Multicast, join)(TCN_STDARGS,
+ jlong sock, jlong join,
+ jlong iface, jlong source)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_sockaddr_t *ja = J2P(join, apr_sockaddr_t *);
@@ -34,9 +34,9 @@
return (jint)apr_mcast_join(s->sock, ja, ia, sa);
};
-TCN_IMPLEMENT_CALL(jint, Mulicast, leave)(TCN_STDARGS,
- jlong sock, jlong addr,
- jlong iface, jlong source)
+TCN_IMPLEMENT_CALL(jint, Multicast, leave)(TCN_STDARGS,
+ jlong sock, jlong addr,
+ jlong iface, jlong source)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_sockaddr_t *aa = J2P(addr, apr_sockaddr_t *);
@@ -46,16 +46,16 @@
return (jint)apr_mcast_leave(s->sock, aa, ia, sa);
};
-TCN_IMPLEMENT_CALL(jint, Mulicast, hops)(TCN_STDARGS,
- jlong sock, jint ttl)
+TCN_IMPLEMENT_CALL(jint, Multicast, hops)(TCN_STDARGS,
+ jlong sock, jint ttl)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
UNREFERENCED_STDARGS;
return (jint)apr_mcast_hops(s->sock, (apr_byte_t)ttl);
};
-TCN_IMPLEMENT_CALL(jint, Mulicast, loopback)(TCN_STDARGS,
- jlong sock, jboolean opt)
+TCN_IMPLEMENT_CALL(jint, Multicast, loopback)(TCN_STDARGS,
+ jlong sock, jboolean opt)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_byte_t on = 0;
@@ -65,8 +65,8 @@
return (jint)apr_mcast_loopback(s->sock, on);
};
-TCN_IMPLEMENT_CALL(jint, Mulicast, ointerface)(TCN_STDARGS,
- jlong sock, jlong iface)
+TCN_IMPLEMENT_CALL(jint, Multicast, ointerface)(TCN_STDARGS,
+ jlong sock, jlong iface)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_sockaddr_t *ia = J2P(iface, apr_sockaddr_t *);
Modified: tomcat/connectors/trunk/jni/native/src/ssl.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/ssl.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/ssl.c (original)
+++ tomcat/connectors/trunk/jni/native/src/ssl.c Thu Jan 1 02:52:46 2009
@@ -859,6 +859,12 @@
return JNI_FALSE;
}
+TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, jstring file)
+{
+ UNREFERENCED_STDARGS;
+ UNREFERENCED(file);
+}
+
TCN_IMPLEMENT_CALL(jlong, SSL, newBIO)(TCN_STDARGS, jlong pool,
jobject callback)
{
Modified: tomcat/connectors/trunk/jni/native/src/sslcontext.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/sslcontext.c?rev=730523&r1=730522&r2=730523&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/sslcontext.c (original)
+++ tomcat/connectors/trunk/jni/native/src/sslcontext.c Thu Jan 1 02:52:46 2009
@@ -494,7 +494,7 @@
jstring file)
{
tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
- TCN_ALLOC_CSTRING(file);
+ TCN_ALLOC_CSTRING(file);
TCN_ASSERT(ctx != 0);
UNREFERENCED(o);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]