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/10/03 08:40:10 UTC

svn commit: r821260 - in /commons/sandbox/runtime/trunk/src/main/native/os: unix/fsysio.c win32/fsysio.c

Author: mturk
Date: Sat Oct  3 06:40:09 2009
New Revision: 821260

URL: http://svn.apache.org/viewvc?rev=821260&view=rev
Log:
For Descriptor.flush() use fdatasync if available

Modified:
    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/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=821260&r1=821259&r2=821260&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 Sat Oct  3 06:40:09 2009
@@ -92,8 +92,6 @@
                     (*_E)->DeleteWeakGlobalRef(_E, fp->descriptor);
                     fp->descriptor = NULL;
                 }
-                fprintf(stdout, "[file] Finalize: %d\n", dp->di);
-                fflush(stdout);
                 rc = acr_ioh_clear(dp->di);
             }
             else
@@ -106,13 +104,20 @@
                     (*_E)->DeleteWeakGlobalRef(_E, fp->descriptor);
                     fp->descriptor = NULL;
                 }
-                fprintf(stdout, "[file] Close:    %d\n", dp->di);
-                fflush(stdout);
                 rc = acr_ioh_close(dp->di);
             }
             else
                 rc = ACR_EBADF;
         break;
+        case ACR_DESC_FLUSH:
+            if (dp->di > 0) {
+                acr_file_t *fp = ACR_IOH_FDATA(dp->di);
+                if (fdatasync(fp->fd) < 0)
+                    rc = ACR_GET_OS_ERROR();
+            }
+            else
+                rc = ACR_EBADF;
+        break;
         case ACR_DESC_SYNC:
             if (dp->di > 0) {
                 acr_file_t *fp = ACR_IOH_FDATA(dp->di);

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=821260&r1=821259&r2=821260&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 Sat Oct  3 06:40:09 2009
@@ -132,6 +132,7 @@
             else
                 rc = ACR_EBADF;
         break;
+        case ACR_DESC_FLUSH:
         case ACR_DESC_SYNC:
             if (dp->di > 0) {
                 acr_file_t *fp = ACR_IOH_FDATA(dp->di);