diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-10 17:26:58 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-10 17:26:58 +0000 |
commit | 91de3d6539ca93366cf5f5de0a26b4474ccecab2 (patch) | |
tree | cb55186ebd1f798232d7665e1dd2fb0a3f74d255 /file.c | |
parent | 4cfc1aa9591714b0d9ccc9a8f5ce4461a82db899 (diff) |
support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
from stati64ns, change the type of st_ino to 64bit and added st_inohigh.
* dir.c, file.c (stat, lstat): follow above changes.
* file.c (rb_stat_ino): support 128bit ino.
* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
[Feature #13731]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -91,9 +91,9 @@ int flock(int, int); /* define system APIs */ #ifdef _WIN32 #include "win32/file.h" -#define STAT(p, s) rb_w32_ustati64ns((p), (s)) +#define STAT(p, s) rb_w32_ustati128((p), (s)) #undef lstat -#define lstat(p, s) rb_w32_ulstati64ns((p), (s)) +#define lstat(p, s) rb_w32_ulstati128((p), (s)) #undef access #define access(p, m) rb_w32_uaccess((p), (m)) #undef truncate @@ -611,17 +611,12 @@ rb_stat_dev_minor(VALUE self) static VALUE rb_stat_ino(VALUE self) { -#ifdef _WIN32 - struct stat *st = get_stat(self); - unsigned short *p2 = (unsigned short *)st; - unsigned int *p4 = (unsigned int *)st; - uint64_t r; - r = p2[2]; - r <<= 16; - r |= p2[7]; - r <<= 32; - r |= p4[5]; - return ULL2NUM(r); +#ifdef HAVE_STRUCT_STAT_ST_INOHIGH + /* assume INTEGER_PACK_LSWORD_FIRST and st_inohigh is just next of st_ino */ + return rb_integer_unpack(&get_stat(self)->st_ino, 2, + SIZEOF_STRUCT_STAT_ST_INO, 0, + INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER| + INTEGER_PACK_2COMP); #elif SIZEOF_STRUCT_STAT_ST_INO > SIZEOF_LONG return ULL2NUM(get_stat(self)->st_ino); #else |