You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/29 09:58:27 UTC
svn commit: r819854 -
/commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c
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;
}