[前][次][番号順一覧][スレッド一覧]

ruby-changes:18735

From: kosaki <ko1@a...>
Date: Wed, 2 Feb 2011 17:15:51 +0900 (JST)
Subject: [ruby-changes:18735] Ruby:r30762 (trunk): * io.c (rb_io_fdatasync): Use fsync(2) if if the underlying

kosaki	2011-02-02 17:11:29 +0900 (Wed, 02 Feb 2011)

  New Revision: 30762

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30762

  Log:
    * io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
      operating system does not support fdatasync(2).

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30761)
+++ ChangeLog	(revision 30762)
@@ -1,3 +1,8 @@
+Wed Feb  2 17:09:22 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
+	  operating system does not support fdatasync(2).
+
 Wed Feb  2 14:51:08 2011  Eric Hodel  <drbrain@s...>
 
 	* lib/rdoc/markup/to_tt_only.rb: commit miss
Index: io.c
===================================================================
--- io.c	(revision 30761)
+++ io.c	(revision 30762)
@@ -1421,18 +1421,22 @@
 rb_io_fdatasync(VALUE io)
 {
     rb_io_t *fptr;
+    int saved_errno = 0;
 
     io = GetWriteIO(io);
     GetOpenFile(io, fptr);
 
     if (io_fflush(fptr) < 0)
         rb_sys_fail(0);
-    if (fdatasync(fptr->fd) < 0)
-	rb_sys_fail_path(fptr->pathv);
-    return INT2FIX(0);
+
+    if (fdatasync(fptr->fd) == 0)
+	return INT2FIX(0);
+
+    /* fall back */
+    return rb_io_fsync(io);
 }
 #else
-#define rb_io_fdatasync rb_f_notimplement
+#define rb_io_fdatasync rb_io_fsync
 #endif
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]