commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r819637 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.in Makefile.msc.in include/acr_file.h os/unix/fsysio.c os/win32/fsysio.c shared/fsysio.c
Date Mon, 28 Sep 2009 16:37:46 GMT
Author: mturk
Date: Mon Sep 28 16:37:45 2009
New Revision: 819637

URL: http://svn.apache.org/viewvc?rev=819637&view=rev
Log:
Add shared file sys code

Added:
    commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c   (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.in
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=819637&r1=819636&r2=819637&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Mon Sep 28 16:37:45 2009
@@ -90,6 +90,7 @@
 	$(SRCDIR)/shared/error.$(OBJ) \
 	$(SRCDIR)/shared/fco.$(OBJ) \
 	$(SRCDIR)/shared/file.$(OBJ) \
+	$(SRCDIR)/shared/fsysio.$(OBJ) \
 	$(SRCDIR)/shared/getopt.$(OBJ) \
 	$(SRCDIR)/shared/ini.$(OBJ) \
 	$(SRCDIR)/shared/mbstr.$(OBJ) \

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=819637&r1=819636&r2=819637&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Mon Sep 28 16:37:45 2009
@@ -78,6 +78,7 @@
 	$(SRCDIR)/shared/error.$(OBJ) \
 	$(SRCDIR)/shared/fco.$(OBJ) \
 	$(SRCDIR)/shared/file.$(OBJ) \
+	$(SRCDIR)/shared/fsysio.$(OBJ) \
 	$(SRCDIR)/shared/getopt.$(OBJ) \
 	$(SRCDIR)/shared/ini.$(OBJ) \
 	$(SRCDIR)/shared/mbstr.$(OBJ) \

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h?rev=819637&r1=819636&r2=819637&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h Mon Sep 28 16:37:45 2009
@@ -171,6 +171,7 @@
     acr_osd_t    fd;                    /**< Os file descriptor         */
     int          type;                  /**< File type. see ACR_FT      */
     int          eof;                   /**< Non zero if file hit EOF   */
+    int          err;                   /**< Last error value           */
     acr_uint32_t flags;                 /**< File flags                 */
     acr_time_t   timeout;               /**< I/O timeout                */
     enum {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=819637&r1=819636&r2=819637&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c Mon Sep 28 16:37:45 2009
@@ -25,7 +25,6 @@
 #include "acr_pointer.h"
 #include "acr_file.h"
 #include "acr_fileio.h"
-#include "acr_port.h"
 
 static int file_cleanup(void *file, int type, unsigned int flags)
 {
@@ -240,3 +239,34 @@
     }
     return fdo;
 }
+
+ACR_IO_EXPORT_DECLARE(jint, FileSystemProvider, read0)(ACR_JNISTDARGS,
+                                                       jint file)
+{
+    unsigned char c;
+    ssize_t rd;
+    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 -1;
+    }
+    if (IS_INVALID_HANDLE(f)) {
+        ACR_THROW_IO_IF_ERR(ACR_EBADF);
+        return -1;
+    }
+    rd = r_read(f->fd, &c, 1);
+    if (rd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) &&
+        f->timeout != 0) {
+
+    }
+    if (rd == -1)
+        f->err = ACR_GET_OS_ERROR();
+    else if (rd == 0)
+        f->eof = 1;
+    else if (rd == 1) {
+        f->err = 0;
+        return (int)c;
+    }
+    return -1;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=819637&r1=819636&r2=819637&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Mon Sep 28 16:37:45 2009
@@ -25,7 +25,6 @@
 #include "acr_pointer.h"
 #include "acr_file.h"
 #include "acr_fileio.h"
-#include "acr_port.h"
 
 static int file_cleanup(void *file, int type, unsigned int flags)
 {

Added: 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=819637&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c Mon Sep 28 16:37:45 2009
@@ -0,0 +1,53 @@
+/* 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.
+ */
+
+#include "acr.h"
+#include "acr_private.h"
+#include "acr_arch.h"
+#include "acr_error.h"
+#include "acr_memory.h"
+#include "acr_descriptor.h"
+#include "acr_file.h"
+#include "acr_fileio.h"
+
+
+ACR_IO_EXPORT_DECLARE(jint, FileSystemProvider, err0)(ACR_JNISTDARGS,
+                                                      jint file)
+{
+    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;
+    return f->err;
+}
+
+ACR_IO_EXPORT_DECLARE(jboolean, FileSystemProvider, eof0)(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 JNI_FALSE;
+    }
+    if (IS_INVALID_HANDLE(f)) {
+        ACR_THROW_IO_IF_ERR(ACR_EBADF);
+        return JNI_FALSE;
+    }
+    return V2Z(f->err);
+}

Propchange: commons/sandbox/runtime/trunk/src/main/native/shared/fsysio.c
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message