file.c: unpack in binary

* file.c (statfs_fsid): convert with rb_integer_unpack.

* configure.in: fsid_t is no longer used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-23 04:31:09 +00:00
parent 3254b0f3c1
commit c5fef27312
3 changed files with 3 additions and 21 deletions

View File

@ -1061,7 +1061,6 @@ main()
ac_cv_func_malloc_usable_size=no
ac_cv_type_struct_statfs=yes
ac_cv_member_struct_statfs_f_fstypename=yes
ac_cv_type_fsid_t=yes
{ test "$target_cpu" = x64 && ac_cv_func___builtin_setjmp=no; }
AC_CHECK_TYPE([NET_LUID], [], [],
[@%:@include <windows.h>
@ -1743,15 +1742,6 @@ AC_CHECK_MEMBERS([struct statfs.f_fstypename], [], [], [@%:@ifdef HAVE_SYS_PARAM
@%:@ifdef HAVE_SYS_VFS_H
@%:@ include <sys/vfs.h>
@%:@endif])
AC_CHECK_TYPES([fsid_t], [], [], [@%:@ifdef HAVE_SYS_PARAM_H
@%:@ include <sys/param.h>
@%:@endif
@%:@ifdef HAVE_SYS_MOUNT_H
@%:@ include <sys/mount.h>
@%:@endif
@%:@ifdef HAVE_SYS_VFS_H
@%:@ include <sys/vfs.h>
@%:@endif])
])
AC_CHECK_TYPES([clockid_t], [], [], [@%:@ifdef HAVE_TIME_H

13
file.c
View File

@ -5540,16 +5540,9 @@ statfs_ffree(VALUE self)
static VALUE
statfs_fsid(VALUE self)
{
#ifdef HAVE_FSID_T
union {
uint64_t v;
fsid_t f;
} n = {0};
n.f = get_statfs(self)->f_fsid;
return LL2NUM(n.v);
#else
return LONG2NUM(get_statfs(self)->f_fsid);
#endif
return rb_integer_unpack(&get_statfs(self)->f_fsid,
1, sizeof(get_statfs(self)->f_fsid),
0, INTEGER_PACK_2COMP|INTEGER_PACK_NATIVE_BYTE_ORDER);
}
#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME

View File

@ -701,7 +701,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define HAVE_RB_FD_INIT 1
#define HAVE_STRUCT_STATFS 1
#define HAVE_STRUCT_STATFS_F_FSTYPENAME 1
#define HAVE_FSID_T 1
#define RUBY_SETJMP(env) _setjmp(env)
#define RUBY_LONGJMP(env,val) longjmp(env,val)
#define RUBY_JMP_BUF jmp_buf