activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r835077 - in /activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java: org/ org/apache/ org/apache/activemq/ org/apache/activemq/syscall/ test/
Date Wed, 11 Nov 2009 21:24:38 GMT
Author: chirino
Date: Wed Nov 11 21:24:34 2009
New Revision: 835077

URL: http://svn.apache.org/viewvc?rev=835077&view=rev
Log:
starting to define all the native calls that we will be needing..

Added:
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/AIO.java
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/CLibrary.java
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/IO.java
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/Posix.java
Removed:
    activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/test/

Added: activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/AIO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/AIO.java?rev=835077&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/AIO.java
(added)
+++ activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/AIO.java
Wed Nov 11 21:24:34 2009
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.syscall;
+
+import org.fusesource.hawtjni.runtime.ClassFlag;
+import org.fusesource.hawtjni.runtime.JniArg;
+import org.fusesource.hawtjni.runtime.JniClass;
+import org.fusesource.hawtjni.runtime.JniField;
+
+/**
+ * The aio facility provides system calls for asynchronous I/O
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@JniClass
+public class AIO extends CLibrary {
+
+    @JniClass(flags={ClassFlag.STRUCT})
+    static public class aiocb {
+        
+        public static final native int aiocb_sizeof ();
+        public static final int SIZEOF = aiocb_sizeof();
+        
+        int aio_fildes;
+        @JniField(cast="void *")
+        long aio_buf;
+        @JniField(cast="size_t")
+        long aio_nbytes;
+        @JniField(cast="off_t")
+        long aio_offset;
+        // Don't need to access these right now:
+        // int aio_reqprio;
+        // struct sigevent aio_sigevent
+        // int aio_lio_opcode;
+        // int aio_flags;
+    }
+    
+    @JniClass(flags={ClassFlag.STRUCT})
+    static public class timespec {
+        
+        public static final native int timespec_sizeof ();
+        public static final int SIZEOF = timespec_sizeof();
+        
+        @JniField(cast="time_t")
+        long tv_sec;  
+        @JniField(cast="long")
+        long tv_nsec; 
+    }    
+    
+    /**
+     * <code><pre>
+     * int aio_read(struct aiocb *aiocbp);
+     * </pre></code>
+     */
+    public static final native int aio_read(
+            @JniArg(cast="struct aiocb *")long aiocbp);
+
+    /**
+     * <code><pre>
+     * int aio_cancel(int fd, struct aiocb *aiocbp);
+     * </pre></code>
+     */
+    public static final native int aio_cancel(
+            int fd, 
+            @JniArg(cast="struct aiocb *")long aiocbp);
+    
+    /**
+     * <code><pre>
+     * int aio_error(const struct aiocb *aiocbp);
+     * </pre></code>
+     */
+    public static final native int aio_error(
+            @JniArg(cast="const struct aiocb *")long aiocbp);
+    
+    /**
+     * <code><pre>
+     * ssize_t aio_return(struct aiocb *aiocbp);
+     * </pre></code>
+     */
+    public static final native long aio_return(
+            @JniArg(cast="struct aiocb *")long aiocbp);
+
+    /**
+     * <code><pre>
+     * int aio_suspend(const struct aiocb *const list[], int nent, const struct timespec
*timeout);
+     * </pre></code>
+     */
+    public static final native int aio_suspend(
+            @JniArg(cast="const struct aiocb *const*")long[] list,
+            int nent,
+            @JniArg(cast="struct timespec *")long timeout);
+    
+}

Added: activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/CLibrary.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/CLibrary.java?rev=835077&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/CLibrary.java
(added)
+++ activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/CLibrary.java
Wed Nov 11 21:24:34 2009
@@ -0,0 +1,193 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.syscall;
+
+import org.fusesource.hawtjni.runtime.JniArg;
+import org.fusesource.hawtjni.runtime.JniClass;
+import org.fusesource.hawtjni.runtime.JniMethod;
+import org.fusesource.hawtjni.runtime.Library;
+
+import static org.fusesource.hawtjni.runtime.ArgFlag.*;
+import static org.fusesource.hawtjni.runtime.Pointer.*;
+/**
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@JniClass
+public class CLibrary {
+
+    private static Library library = new Library("activemq-syscall", CLibrary.class);
+    static {
+        library.load();
+    }
+    
+    ///////////////////////////////////////////////////////////////////
+    //
+    // String related methods 
+    //
+    ///////////////////////////////////////////////////////////////////
+    
+    public static final native int strlen(
+            @JniArg(cast="char *")long s);
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // Memory management related methods 
+    //
+    ///////////////////////////////////////////////////////////////////
+    
+    /**
+     * <code><pre>
+     * void * calloc(size_t count, size_t size);
+     * </pre></code>
+     */
+    @JniMethod(cast="void *")
+    public static final native long calloc(
+            @JniArg(cast="size_t") long count,
+            @JniArg(cast="size_t") long size);
+
+    /**
+     * <code><pre>
+     * void * malloc(size_t len);
+     * </pre></code>
+     */
+    @JniMethod(cast="void *")
+    public static final native long malloc(
+            @JniArg(cast="size_t") long size);
+    
+    /**
+     * <code><pre>
+     * void * memset(void *ptr, int c, size_t len);
+     * </pre></code>
+     */
+    @JniMethod(cast="void *")
+    public static final native long memset (
+            @JniArg(cast="void *") long buffer, 
+            int c, 
+            @JniArg(cast="size_t") long num);
+    
+    /**
+     * <code><pre>
+     * void bzero(void *ptr, size_t len)
+     * </pre></code>
+     */
+    public static final native void bzero(
+            @JniArg(cast = "void *") long ptr, 
+            long len);
+    
+    /**
+     * <code><pre>
+     * void free(void *ptr);
+     * </pre></code>
+     */
+    public static final native void free(
+            @JniArg(cast="void *") long ptr);
+    
+    ///////////////////////////////////////////////////////////////////
+    //
+    // Type conversion related methods.
+    //
+    ///////////////////////////////////////////////////////////////////
+    
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) byte[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) char[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL})  short[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL})  int[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}, pointer=FALSE) long[]
src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) float[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *") long dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) double[] src, 
+            @JniArg(cast="size_t") long size);
+
+    
+    
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) byte[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) char[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) short[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) int[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}, pointer=FALSE) long[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+    
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) float[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) double[] dest, 
+            @JniArg(cast="const void *") long src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) byte[] dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL})  char[] src, 
+            @JniArg(cast="size_t") long size);
+
+    public static final native void memmove (
+            @JniArg(cast="void *", flags={NO_IN, CRITICAL}) int[] dest, 
+            @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) byte[] src, 
+            @JniArg(cast="size_t") long size);
+
+}

Added: activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/IO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/IO.java?rev=835077&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/IO.java
(added)
+++ activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/IO.java
Wed Nov 11 21:24:34 2009
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.syscall;
+
+import org.fusesource.hawtjni.runtime.JniClass;
+import org.fusesource.hawtjni.runtime.JniField;
+import org.fusesource.hawtjni.runtime.JniMethod;
+import org.fusesource.hawtjni.runtime.MethodFlag;
+
+import static org.fusesource.hawtjni.runtime.MethodFlag.*;
+
+import static org.fusesource.hawtjni.runtime.FieldFlag.*;
+import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT;
+
+/**
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@JniClass
+public class IO extends CLibrary {
+
+    @JniMethod(flags={CONSTANT_INITIALIZER})
+    private static final native void init();
+    static {
+        init();
+    }
+
+    @JniField(flags={CONSTANT})
+    public static int O_RDONLY;
+    @JniField(flags={CONSTANT})
+    public static int O_WRONLY;
+    @JniField(flags={CONSTANT})
+    public static int O_RDWR;
+    @JniField(flags={CONSTANT})
+    public static int O_NONBLOCK;
+    @JniField(flags={CONSTANT})
+    public static int O_APPEND;
+    @JniField(flags={CONSTANT})
+    public static int O_CREAT;
+    @JniField(flags={CONSTANT})
+    public static int O_TRUNC;
+    @JniField(flags={CONSTANT})
+    public static int O_EXCL;
+    @JniField(flags={CONSTANT})
+    public static int O_SHLOCK;
+    @JniField(flags={CONSTANT})
+    public static int O_EXLOCK;
+    @JniField(flags={CONSTANT})
+    public static int O_NOFOLLOW;
+    @JniField(flags={CONSTANT})
+    public static int O_SYMLINK;
+    @JniField(flags={CONSTANT})
+    public static int O_EVTONLY;
+    @JniField(flags={CONSTANT})
+    public static int O_ASYNC;
+
+    @JniField(flags={CONSTANT})
+    public static int F_DUPFD;
+    @JniField(flags={CONSTANT})
+    public static int F_GETFD;
+    @JniField(flags={CONSTANT})
+    public static int F_SETFD;
+    @JniField(flags={CONSTANT})
+    public static int F_GETFL;
+    @JniField(flags={CONSTANT})
+    public static int F_SETFL;
+    @JniField(flags={CONSTANT})
+    public static int F_GETOWN;
+    @JniField(flags={CONSTANT})
+    public static int F_SETOWN;
+    @JniField(flags={CONSTANT})
+    public static int F_GETPATH;
+    @JniField(flags={CONSTANT})
+    public static int F_PREALLOCATE;
+    @JniField(flags={CONSTANT})
+    public static int F_SETSIZE;
+    @JniField(flags={CONSTANT})
+    public static int F_RDADVISE;
+    @JniField(flags={CONSTANT})
+    public static int F_RDAHEAD;
+    @JniField(flags={CONSTANT})
+    public static int F_READBOOTSTRAP;
+    @JniField(flags={CONSTANT})
+    public static int F_WRITEBOOTSTRAP;
+    @JniField(flags={CONSTANT})
+    public static int F_NOCACHE;
+    @JniField(flags={CONSTANT})
+    public static int F_LOG2PHYS;
+    @JniField(flags={CONSTANT})
+    public static int F_FULLFSYNC;
+    @JniField(flags={CONSTANT})
+    public static int F_GETLK;
+    @JniField(flags={CONSTANT})
+    public static int F_SETLK;
+    @JniField(flags={CONSTANT})
+    public static int F_SETLKW;
+    
+    ///////////////////////////////////////////////////////////////////
+    //
+    // IO related methods 
+    //
+    ///////////////////////////////////////////////////////////////////
+
+    /**
+     * <code><pre>
+     * int open(const char *path, int oflags, ...);
+     * </pre></code>
+     */
+    public static final native int open(String path, int oflags, int mode);
+
+    /**
+     * <code><pre>
+     * int close(int fd);
+     * </pre></code>
+     */
+    public static final native int close(int fd);
+
+    /**
+     * <code><pre>
+     * int fcntl(int fd, int cmd, ...);
+     * </pre></code>
+     */
+    public static final native int fcntl(int fd, int cmd);
+        
+    
+
+}

Added: activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/Posix.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/Posix.java?rev=835077&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/Posix.java
(added)
+++ activemq/sandbox/activemq-apollo/activemq-syscall/activemq-syscall/src/main/java/org/apache/activemq/syscall/Posix.java
Wed Nov 11 21:24:34 2009
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.syscall;
+
+import org.fusesource.hawtjni.runtime.JniArg;
+import org.fusesource.hawtjni.runtime.JniClass;
+
+/**
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@JniClass
+public class Posix extends CLibrary {
+
+    /**
+     * <code><pre>
+     * int posix_memalign(void **ptrRef, size_t alignment, size_t len);
+     * </pre></code>
+     */
+    public static final native int posix_memalign(
+            @JniArg(cast="void **") long ptrRef[], 
+            @JniArg(cast="size_t")  long alignment, 
+            @JniArg(cast="size_t")  long len);
+    
+}



Mime
View raw message