commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r819854 - /commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c
Date Tue, 29 Sep 2009 07:58:27 GMT
Author: mturk
Date: Tue Sep 29 07:58:27 2009
New Revision: 819854

URL: http://svn.apache.org/viewvc?rev=819854&view=rev
Log:
Add timeouts

Modified:
    commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c?rev=819854&r1=819853&r2=819854&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c Tue Sep 29 07:58:27 2009
@@ -49,5 +49,40 @@
         ACR_THROW_IO_IF_ERR(ACR_EBADF);
         return JNI_FALSE;
     }
-    return V2Z(f->err);
+    return V2Z(f->eof);
+}
+
+ACR_IO_EXPORT_DECLARE(jint, FileSystemProvider, tmset0)(ACR_JNISTDARGS,
+                                                        jint file,
+                                                        jlong timeout)
+{
+    acr_file_t *f = (acr_file_t *)ACR_IOH_FDATA(file);
+
+    if (ACR_IOH_FTYPE(file) != ACR_DT_FILE)
+        return ACR_EFTYPE;
+    if (IS_INVALID_HANDLE(f))
+        return ACR_EBADF;
+    if (f->blocking != BLK_OFF) {
+        /* Cannot use timeout with blocking files
+         */
+        return ACR_EPERM;
+    }
+    f->timeout = (acr_time_t)timeout;
+    return 0;
+}
+
+ACR_IO_EXPORT_DECLARE(jlong, FileSystemProvider, tmget0)(ACR_JNISTDARGS,
+                                                         jint file)
+{
+    acr_file_t *f = (acr_file_t *)ACR_IOH_FDATA(file);
+
+    if (ACR_IOH_FTYPE(file) != ACR_DT_FILE) {
+        ACR_THROW_IO_IF_ERR(ACR_EFTYPE);
+        return 0;
+    }
+    if (IS_INVALID_HANDLE(f)) {
+        ACR_THROW_IO_IF_ERR(ACR_EBADF);
+        return 0;
+    }
+    return (jlong)f->timeout;
 }



Mime
View raw message