diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-23 07:30:43 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-23 07:30:43 +0000 |
commit | eb9708f38671aa6446a89acc755f3341f5cb59b6 (patch) | |
tree | 1a033ace8ffbc862b97c6f4eab80e3326462f06d /io.c | |
parent | b6cc058c53fde7442253c44e688ff8541050572d (diff) | |
download | ruby-eb9708f38671aa6446a89acc755f3341f5cb59b6.tar.gz |
* array.c (Init_Array): remove Array#filter.
* object.c (rb_mod_initialize): should accept zero argument.
* object.c (rb_mod_cmp): should raise ArgumentError if
inheritance/inclusion relation between two classes/modules is
not defined. [new]
* io.c (rb_io_fsync): new method. [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -439,6 +439,28 @@ rb_io_set_sync(io, mode) } static VALUE +rb_io_fsync(io) + VALUE io; +{ +#ifdef HAVE_FSYNC + OpenFile *fptr; + FILE *f; + + GetOpenFile(io, fptr); + rb_io_check_writable(fptr); + f = GetWriteFile(fptr); + + io_fflush(f, fptr->path); + if (fsync(fileno(f)) < 0) + rb_sys_fail(fptr->path); + return INT2FIX(0); +#else + rb_notimplement(); + return Qnil; /* not reached */ +#endif +} + +static VALUE rb_io_fileno(io) VALUE io; { @@ -3557,6 +3579,7 @@ Init_IO() rb_define_alias(rb_cIO, "to_i", "fileno"); rb_define_method(rb_cIO, "to_io", rb_io_to_io, 0); + rb_define_method(rb_cIO, "fsync", rb_io_fsync, 0); rb_define_method(rb_cIO, "sync", rb_io_sync, 0); rb_define_method(rb_cIO, "sync=", rb_io_set_sync, 1); |