authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-08 14:27:49-06:00
committergravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-08 15:19:02-06:00
log55077435bf53bb8273e1b23c1690798312d6abc6
tree1b2c7e1903e61df5eb1b2ca523943a679ecc7aab
parentcf38ce970155512577cfb0cc281d1a308af7e7e9

Expose file inode (linux) and file index (windows)


1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/fs/file.zig+7
......@@ -28,6 +28,10 @@ pub const File = struct {
2828 pub const async_block_allowed_no = if (io.is_async) false else {};
2929
3030 pub const Mode = os.mode_t;
31 pub const INode = switch (builtin.os.tag) {
32 .windows => os.windows.LARGE_INTEGER,
33 else => u64,
34 };
3135
3236 pub const default_mode = switch (builtin.os.tag) {
3337 .windows => 0,
......@@ -145,6 +149,7 @@ pub const File = struct {
145149 }
146150
147151 pub const Stat = struct {
152 inode: INode,
148153 size: u64,
149154 mode: Mode,
150155
......@@ -174,6 +179,7 @@ pub const File = struct {
174179 else => return windows.unexpectedStatus(rc),
175180 }
176181 return Stat{
182 .inode = info.InternalInformation.IndexNumber,
177183 .size = @bitCast(u64, info.StandardInformation.EndOfFile),
178184 .mode = 0,
179185 .atime = windows.fromSysTime(info.BasicInformation.LastAccessTime),
......@@ -187,6 +193,7 @@ pub const File = struct {
187193 const mtime = st.mtime();
188194 const ctime = st.ctime();
189195 return Stat{
196 .inode = st.ino,
190197 .size = @bitCast(u64, st.size),
191198 .mode = st.mode,
192199 .atime = @as(i64, atime.tv_sec) * std.time.ns_per_s + atime.tv_nsec,