ruby-changes:33590
From: usa <ko1@a...>
Date: Tue, 22 Apr 2014 23:57:26 +0900 (JST)
Subject: [ruby-changes:33590] usa:r45671 (trunk): * file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable.
usa 2014-04-22 23:57:18 +0900 (Tue, 22 Apr 2014) New Revision: 45671 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45671 Log: * file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable. * configure.in (fstatfs): check it. Modified files: trunk/ChangeLog trunk/configure.in trunk/file.c Index: configure.in =================================================================== --- configure.in (revision 45670) +++ configure.in (revision 45671) @@ -1946,6 +1946,7 @@ AC_CHECK_FUNCS(fcntl) https://github.com/ruby/ruby/blob/trunk/configure.in#L1946 AC_CHECK_FUNCS(fdatasync) AC_CHECK_FUNCS(fmod) AC_CHECK_FUNCS(fork) +AC_CHECK_FUNCS(fstatfs) AC_CHECK_FUNCS(fsync) AC_CHECK_FUNCS(ftruncate) AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform Index: ChangeLog =================================================================== --- ChangeLog (revision 45670) +++ ChangeLog (revision 45671) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Apr 22 23:56:24 2014 NAKAMURA Usaku <usa@r...> + + * file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable. + + * configure.in (fstatfs): check it. + Tue Apr 22 23:14:28 2014 Nobuyoshi Nakada <nobu@r...> * ext/stringio/stringio.c (strio_write): use rb_str_append to Index: file.c =================================================================== --- file.c (revision 45670) +++ file.c (revision 45671) @@ -1120,7 +1120,12 @@ rb_io_statfs(VALUE obj) https://github.com/ruby/ruby/blob/trunk/file.c#L1120 struct statfs st; GetOpenFile(obj, fptr); - if (fstatfs(fptr->fd, &st) == -1) { +#ifdef HAVE_FSTATFS + if (fstatfs(fptr->fd, &st) == -1) +#else + if (statfs(RSTRING_PTR(fptr->pathv), &st) == -1) +#endif + { rb_sys_fail_path(fptr->pathv); } return rb_statfs_new(&st); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/