commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r812814 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/io/Status.java native/shared/error.c
Date Wed, 09 Sep 2009 08:15:44 GMT
Author: mturk
Date: Wed Sep  9 08:15:44 2009
New Revision: 812814

URL: http://svn.apache.org/viewvc?rev=812814&view=rev
Log:
Sync errors between native and Java

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java?rev=812814&r1=812813&r2=812814&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
Wed Sep  9 08:15:44 2009
@@ -36,72 +36,297 @@
     private static native void init0(int[] i);
 
     static {
-        int [] i = new int[32];
+        int [] i = new int[128];
         init0(i);
 
-        EACCES              = i[1];
-        EEXIST              = i[2];
-        ENAMETOOLONG        = i[3];
-        ENOENT              = i[4];
-        ENOTDIR             = i[5];
-        ENOSPC              = i[6];
-        ENOMEM              = i[7];
-        EMFILE              = i[8];
-        ENFILE              = i[9];
-        EBADF               = i[10];
-        EINVAL              = i[11];
-        ESPIPE              = i[12];
-        EAGAIN              = i[13];
-        EINTR               = i[14];
-        ENOTSOCK            = i[15];
-        ECONNREFUSED        = i[16];
-        EINPROGRESS         = i[17];
-        ECONNABORTED        = i[18];
-        ECONNRESET          = i[19];
-        EHOSTUNREACH        = i[20];
-        ENETUNREACH         = i[21];
-        EFTYPE              = i[22];
-        EPIPE               = i[23];
-        EXDEV               = i[24];
-        ENOTEMPTY           = i[25];
-        EAFNOSUPPORT        = i[26];
+        OS_LAST_CANONERR    = i[0];
+        EPERM               = i[1];
+        ENOENT              = i[2];
+        ESRCH               = i[3];
+        EINTR               = i[4];
+        EIO                 = i[5];
+        ENXIO               = i[6];
+        E2BIG               = i[7];
+        ENOEXEC             = i[8];
+        EBADF               = i[9];
+        ECHILD              = i[10];
+        EDEADLK             = i[11];
+        ENOMEM              = i[12];
+        EACCES              = i[13];
+        EFAULT              = i[14];
+        ENOTBLK             = i[15];
+        EBUSY               = i[16];
+        EEXIST              = i[17];
+        EXDEV               = i[18];
+        ENODEV              = i[19];
+        ENOTDIR             = i[20];
+        EISDIR              = i[21];
+        EINVAL              = i[22];
+        ENFILE              = i[23];
+        EMFILE              = i[24];
+        ENOTTY              = i[25];
+        ETXTBSY             = i[26];
+        EFBIG               = i[27];
+        ENOSPC              = i[28];
+        ESPIPE              = i[29];
+        EROFS               = i[30];
+        EMLINK              = i[31];
+        EPIPE               = i[32];
+        EDOM                = i[33];
+        ERANGE              = i[34];
+        EAGAIN              = i[35];
+        EWOULDBLOCK         = i[36];
+        EINPROGRESS         = i[37];
+        EALREADY            = i[38];
+        ENOTSOCK            = i[39];
+        EDESTADDRREQ        = i[40];
+        EMSGSIZE            = i[41];
+        EPROTOTYPE          = i[42];
+        ENOPROTOOPT         = i[43];
+        EPROTONOSUPPORT     = i[44];
+        ESOCKTNOSUPPORT     = i[45];
+        EOPNOTSUPP          = i[46];
+        EPFNOSUPPORT        = i[47];
+        EAFNOSUPPORT        = i[48];
+        EADDRINUSE          = i[49];
+        EADDRNOTAVAIL       = i[50];
+        ENETDOWN            = i[51];
+        ENETUNREACH         = i[52];
+        ENETRESET           = i[53];
+        ECONNABORTED        = i[54];
+        ECONNRESET          = i[55];
+        ENOBUFS             = i[56];
+        EISCONN             = i[57];
+        ENOTCONN            = i[58];
+        ESHUTDOWN           = i[59];
+        ETOOMANYREFS        = i[60];
+        ETIMEDOUT           = i[61];
+        ECONNREFUSED        = i[62];
+        ELOOP               = i[63];
+        ENAMETOOLONG        = i[64];
+        EHOSTDOWN           = i[65];
+        EHOSTUNREACH        = i[66];
+        ENOTEMPTY           = i[67];
+        EPROCLIM            = i[68];
+        EUSERS              = i[69];
+        EDQUOT              = i[70];
+        ESTALE              = i[71];
+        EREMOTE             = i[72];
+        EBADRPC             = i[73];
+        ERPCMISMATCH        = i[74];
+        EPROGUNAVAIL        = i[75];
+        EPROGMISMATCH       = i[76];
+        EPROCUNAVAIL        = i[77];
+        ENOLCK              = i[78];
+        ENOSYS              = i[79];
+        EFTYPE              = i[80];
+        EAUTH               = i[81];
+        ENEEDAUTH           = i[82];
+        EIPSEC              = i[83];
+        ENOATTR             = i[84];
+        EILSEQ              = i[85];
+        ENOMEDIUM           = i[86];
+        EMEDIUMTYPE         = i[87];
+        EOVERFLOW           = i[88];
+        ECANCELED           = i[89];
+        EIDRM               = i[90];
+        ENOMSG              = i[91];
 
     }
 
     /* ACR CANONICAL ERROR VALUES */
+    /** Operation not permitted */
+    public static final int EPERM;
+    /** No such file or directory */
+    public static final int ENOENT;
+    /** No such process */
+    public static final int ESRCH;
+    /** Interrupted system call */
+    public static final int EINTR;
+    /** Input/output error */
+    public static final int EIO;
+    /** Device not configured */
+    public static final int ENXIO;
+    /** Argument list too long */
+    public static final int E2BIG;
+    /** Exec format error */
+    public static final int ENOEXEC;
+    /** Bad file descriptor */
+    public static final int EBADF;
+    /** No child processes */
+    public static final int ECHILD;
+    /** Resource deadlock avoided */
+    public static final int EDEADLK;
+    /** Cannot allocate memory */
+    public static final int ENOMEM;
+    /** Permission denied */
     public static final int EACCES;
+    /** Bad address */
+    public static final int EFAULT;
+    /** Block device required */
+    public static final int ENOTBLK;
+    /** Device busy */
+    public static final int EBUSY;
+    /** File exists */
     public static final int EEXIST;
-    public static final int ENAMETOOLONG;
-    public static final int ENOENT;
+    /** Cross-device link */
+    public static final int EXDEV;
+    /** Operation not supported by device */
+    public static final int ENODEV;
+    /** Not a directory */
     public static final int ENOTDIR;
-    public static final int ENOSPC;
-    public static final int ENOMEM;
-    public static final int EMFILE;
-    public static final int ENFILE;
-    public static final int EBADF;
+    /** Is a directory */
+    public static final int EISDIR;
+    /** Invalid argument */
     public static final int EINVAL;
+    /** Too many open files in system */
+    public static final int ENFILE;
+    /** Too many open files */
+    public static final int EMFILE;
+    /** Inappropriate ioctl for device */
+    public static final int ENOTTY;
+    /** Text file busy */
+    public static final int ETXTBSY;
+    /** File too large */
+    public static final int EFBIG;
+    /** No space left on device */
+    public static final int ENOSPC;
+    /** Illegal seek */
     public static final int ESPIPE;
+    /** Read-only file system */
+    public static final int EROFS;
+    /** Too many links */
+    public static final int EMLINK;
+    /** Broken pipe */
+    public static final int EPIPE;
+    /** Numerical argument out of domain */
+    public static final int EDOM;
+    /** Result too large */
+    public static final int ERANGE;
+    /** Resource temporarily unavailable */
     public static final int EAGAIN;
-    public static final int EINTR;
-    public static final int ENOTSOCK;
-    public static final int ECONNREFUSED;
+    /** Operation would block */
+    public static final int EWOULDBLOCK;
+    /** Operation now in progress */
     public static final int EINPROGRESS;
+    /** Operation already in progress */
+    public static final int EALREADY;
+    /** Socket operation on non-socket */
+    public static final int ENOTSOCK;
+    /** Destination address required */
+    public static final int EDESTADDRREQ;
+    /** Message too long */
+    public static final int EMSGSIZE;
+    /** Protocol wrong type for socket */
+    public static final int EPROTOTYPE;
+    /** Protocol not available */
+    public static final int ENOPROTOOPT;
+    /** Protocol not supported */
+    public static final int EPROTONOSUPPORT;
+    /** Socket type not supported */
+    public static final int ESOCKTNOSUPPORT;
+    /** Operation not supported */
+    public static final int EOPNOTSUPP;
+    /** Protocol family not supported */
+    public static final int EPFNOSUPPORT;
+    /** Address family not supported by protocol family */
+    public static final int EAFNOSUPPORT;
+    /** Address already in use */
+    public static final int EADDRINUSE;
+    /** Can't assign requested address */
+    public static final int EADDRNOTAVAIL;
+    /** Network is down */
+    public static final int ENETDOWN;
+    /** Network is unreachable */
+    public static final int ENETUNREACH;
+    /** Network dropped connection on reset */
+    public static final int ENETRESET;
+    /** Software caused connection abort */
     public static final int ECONNABORTED;
+    /** Connection reset by peer */
     public static final int ECONNRESET;
+    /** No buffer space available */
+    public static final int ENOBUFS;
+    /** Socket is already connected */
+    public static final int EISCONN;
+    /** Socket is not connected */
+    public static final int ENOTCONN;
+    /** Can't send after socket shutdown */
+    public static final int ESHUTDOWN;
+    /** Too many references: can't splice */
+    public static final int ETOOMANYREFS;
+    /** Operation timed out */
+    public static final int ETIMEDOUT;
+    /** Connection refused */
+    public static final int ECONNREFUSED;
+    /** Too many levels of symbolic links */
+    public static final int ELOOP;
+    /** File name too long */
+    public static final int ENAMETOOLONG;
+    /** Host is down */
+    public static final int EHOSTDOWN;
+    /** No route to host */
     public static final int EHOSTUNREACH;
-    public static final int ENETUNREACH;
-    public static final int EFTYPE;
-    public static final int EPIPE;
-    public static final int EXDEV;
+    /** Directory not empty */
     public static final int ENOTEMPTY;
-    public static final int EAFNOSUPPORT;
+    /** Too many processes */
+    public static final int EPROCLIM;
+    /** Too many users */
+    public static final int EUSERS;
+    /** Disk quota exceeded */
+    public static final int EDQUOT;
+    /** Stale NFS file handle */
+    public static final int ESTALE;
+    /** Too many levels of remote in path */
+    public static final int EREMOTE;
+    /** RPC struct is bad */
+    public static final int EBADRPC;
+    /** RPC version wrong */
+    public static final int ERPCMISMATCH;
+    /** RPC prog. not avail */
+    public static final int EPROGUNAVAIL;
+    /** Program version wrong */
+    public static final int EPROGMISMATCH;
+    /** Bad procedure for program */
+    public static final int EPROCUNAVAIL;
+    /** No locks available */
+    public static final int ENOLCK;
+    /** Function not implemented */
+    public static final int ENOSYS;
+    /** Inappropriate file type or format */
+    public static final int EFTYPE;
+    /** Authentication error */
+    public static final int EAUTH;
+    /** Need authenticator */
+    public static final int ENEEDAUTH;
+    /** IPsec processing failure */
+    public static final int EIPSEC;
+    /** Attribute not found */
+    public static final int ENOATTR;
+    /** Illegal byte sequence */
+    public static final int EILSEQ;
+    /** No medium found */
+    public static final int ENOMEDIUM;
+    /** Wrong Medium Type */
+    public static final int EMEDIUMTYPE;
+    /** Conversion overflow */
+    public static final int EOVERFLOW;
+    /** Operation canceled */
+    public static final int ECANCELED;
+    /** Identifier removed */
+    public static final int EIDRM;
+    /** No message of desired type */
+    public static final int ENOMSG;
 
 
+    /* Hard coded definitions for acr_error.h
+     */
     private static final int OS_START_ERROR         =  20000;
     private static final int OS_START_STATUS        =  70000;
     private static final int UTIL_START_STATUS      = 100000;
     private static final int OS_START_USERERR       = 120000;
     private static final int OS_START_CANONERR      = 620000;
+    private static final int OS_LAST_CANONERR;
     private static final int OS_START_EAIERR        = 670000;
     private static final int OS_START_SYSERR        = 720000;
     private static final int OS_ERRSPACE_SIZE       =  50000;
@@ -152,8 +377,7 @@
     /* ACR private errors added to the std APR errors */
     public static final int EISNULL                 = OS_START_ERROR + 100;
     public static final int EINVALSIZ               = OS_START_ERROR + 101;
-    public static final int ERANGE                  = OS_START_ERROR + 102;
-    public static final int ECLASSNOTFOUND          = OS_START_ERROR + 103;
+    public static final int ECLASSNOTFOUND          = OS_START_ERROR + 102;
 
 
     public static final int INCHILD                 = OS_START_STATUS +  1;
@@ -180,7 +404,6 @@
     public static final int EINIT                   = OS_START_STATUS + 22;
     public static final int ENOTIMPL                = OS_START_STATUS + 23;
     public static final int EMISMATCH               = OS_START_STATUS + 24;
-    public static final int EBUSY                   = OS_START_STATUS + 25;
 
     /** Native system error */
     public static boolean IS_NATIVE_ERROR(int s)

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=812814&r1=812813&r2=812814&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Wed Sep  9 08:15:44 2009
@@ -19,6 +19,7 @@
 #include "acr_arch.h"
 #include "acr_port.h"
 #include "acr_error.h"
+#include "acr_memory.h"
 #include "acr_string.h"
 #include "acr_vm.h"
 
@@ -693,39 +694,108 @@
 ACR_JNI_EXPORT_DECLARE(void, io_Status, init0)(ACR_JNISTDARGS,
                                                jintArray ra)
 {
-    jint i[32];
+    jint *i;
 
     UNREFERENCED_O;
 
-    i[0]  = 0;
-    i[1]  = ACR_EACCES;
-    i[2]  = ACR_EEXIST;
-    i[3]  = ACR_ENAMETOOLONG;
-    i[4]  = ACR_ENOENT;
-    i[5]  = ACR_ENOTDIR;
-    i[6]  = ACR_ENOSPC;
-    i[7]  = ACR_ENOMEM;
-    i[8]  = ACR_EMFILE;
-    i[9]  = ACR_ENFILE;
-    i[10] = ACR_EBADF;
-    i[11] = ACR_EINVAL;
-    i[12] = ACR_ESPIPE;
-    i[13] = ACR_EAGAIN;
-    i[14] = ACR_EINTR;
-    i[15] = ACR_ENOTSOCK;
-    i[16] = ACR_ECONNREFUSED;
-    i[17] = ACR_EINPROGRESS;
-    i[18] = ACR_ECONNABORTED;
-    i[19] = ACR_ECONNRESET;
-    i[20] = ACR_EHOSTUNREACH;
-    i[21] = ACR_ENETUNREACH;
-    i[22] = ACR_EFTYPE;
-    i[23] = ACR_EPIPE;
-    i[24] = ACR_EXDEV;
-    i[25] = ACR_ENOTEMPTY;
-    i[26] = ACR_EAFNOSUPPORT;
-    i[27] = ACR_E2BIG;
+    if (!(i = (jint *)ACR_Calloc(_E, THROW_FMARK, 128 * sizeof(jint)))) {
+        /* Exception was aleady thrown */
+        return;
+    }
+    i[0]  = ACR_OS_LAST_CANONERR - ACR_OS_START_CANONERR;
+    i[1]  = ACR_EPERM;
+    i[2]  = ACR_ENOENT;
+    i[3]  = ACR_ESRCH;
+    i[4]  = ACR_EINTR;
+    i[5]  = ACR_EIO;
+    i[6]  = ACR_ENXIO;
+    i[7]  = ACR_E2BIG;
+    i[8]  = ACR_ENOEXEC;
+    i[9]  = ACR_EBADF;
+    i[10] = ACR_ECHILD;
+    i[11] = ACR_EDEADLK;
+    i[12] = ACR_ENOMEM;
+    i[13] = ACR_EACCES;
+    i[14] = ACR_EFAULT;
+    i[15] = ACR_ENOTBLK;
+    i[16] = ACR_EBUSY;
+    i[17] = ACR_EEXIST;
+    i[18] = ACR_EXDEV;
+    i[19] = ACR_ENODEV;
+    i[20] = ACR_ENOTDIR;
+    i[21] = ACR_EISDIR;
+    i[22] = ACR_EINVAL;
+    i[23] = ACR_ENFILE;
+    i[24] = ACR_EMFILE;
+    i[25] = ACR_ENOTTY;
+    i[26] = ACR_ETXTBSY;
+    i[27] = ACR_EFBIG;
+    i[28] = ACR_ENOSPC;
+    i[29] = ACR_ESPIPE;
+    i[30] = ACR_EROFS;
+    i[31] = ACR_EMLINK;
+    i[32] = ACR_EPIPE;
+    i[33] = ACR_EDOM;
+    i[34] = ACR_ERANGE;
+    i[35] = ACR_EAGAIN;
+    i[36] = ACR_EWOULDBLOCK;
+    i[37] = ACR_EINPROGRESS;
+    i[38] = ACR_EALREADY;
+    i[39] = ACR_ENOTSOCK;
+    i[40] = ACR_EDESTADDRREQ;
+    i[41] = ACR_EMSGSIZE;
+    i[42] = ACR_EPROTOTYPE;
+    i[43] = ACR_ENOPROTOOPT;
+    i[44] = ACR_EPROTONOSUPPORT;
+    i[45] = ACR_ESOCKTNOSUPPORT;
+    i[46] = ACR_EOPNOTSUPP;
+    i[47] = ACR_EPFNOSUPPORT;
+    i[48] = ACR_EAFNOSUPPORT;
+    i[49] = ACR_EADDRINUSE;
+    i[50] = ACR_EADDRNOTAVAIL;
+    i[51] = ACR_ENETDOWN;
+    i[52] = ACR_ENETUNREACH;
+    i[53] = ACR_ENETRESET;
+    i[54] = ACR_ECONNABORTED;
+    i[55] = ACR_ECONNRESET;
+    i[56] = ACR_ENOBUFS;
+    i[57] = ACR_EISCONN;
+    i[58] = ACR_ENOTCONN;
+    i[59] = ACR_ESHUTDOWN;
+    i[60] = ACR_ETOOMANYREFS;
+    i[61] = ACR_ETIMEDOUT;
+    i[62] = ACR_ECONNREFUSED;
+    i[63] = ACR_ELOOP;
+    i[64] = ACR_ENAMETOOLONG;
+    i[65] = ACR_EHOSTDOWN;
+    i[66] = ACR_EHOSTUNREACH;
+    i[67] = ACR_ENOTEMPTY;
+    i[68] = ACR_EPROCLIM;
+    i[69] = ACR_EUSERS;
+    i[70] = ACR_EDQUOT;
+    i[71] = ACR_ESTALE;
+    i[72] = ACR_EREMOTE;
+    i[73] = ACR_EBADRPC;
+    i[74] = ACR_ERPCMISMATCH;
+    i[75] = ACR_EPROGUNAVAIL;
+    i[76] = ACR_EPROGMISMATCH;
+    i[77] = ACR_EPROCUNAVAIL;
+    i[78] = ACR_ENOLCK;
+    i[79] = ACR_ENOSYS;
+    i[80] = ACR_EFTYPE;
+    i[81] = ACR_EAUTH;
+    i[82] = ACR_ENEEDAUTH;
+    i[83] = ACR_EIPSEC;
+    i[84] = ACR_ENOATTR;
+    i[85] = ACR_EILSEQ;
+    i[86] = ACR_ENOMEDIUM;
+    i[87] = ACR_EMEDIUMTYPE;
+    i[88] = ACR_EOVERFLOW;
+    i[89] = ACR_ECANCELED;
+    i[90] = ACR_EIDRM;
+    i[91] = ACR_ENOMSG;
 
-    (*_E)->SetIntArrayRegion(_E, ra, 0, 32, &i[0]);
+    (*_E)->SetIntArrayRegion(_E, ra, 0, 128, i);
+    x_free(i);
 }
 



Mime
View raw message