mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Add inode to os2.Stat
This commit is contained in:
@@ -8,9 +8,12 @@ Fstat_Callback :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Er
|
|||||||
File_Info :: struct {
|
File_Info :: struct {
|
||||||
fullpath: string,
|
fullpath: string,
|
||||||
name: string,
|
name: string,
|
||||||
|
|
||||||
|
inode: u64,
|
||||||
size: i64,
|
size: i64,
|
||||||
mode: int,
|
mode: int,
|
||||||
type: File_Type,
|
type: File_Type,
|
||||||
|
|
||||||
creation_time: time.Time,
|
creation_time: time.Time,
|
||||||
modification_time: time.Time,
|
modification_time: time.Time,
|
||||||
access_time: time.Time,
|
access_time: time.Time,
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ _fstat_internal :: proc(fd: linux.Fd, allocator: runtime.Allocator) -> (File_Inf
|
|||||||
case linux.S_IFSOCK: type = .Socket
|
case linux.S_IFSOCK: type = .Socket
|
||||||
}
|
}
|
||||||
mode := int(0o7777 & transmute(u32)s.mode)
|
mode := int(0o7777 & transmute(u32)s.mode)
|
||||||
|
|
||||||
// TODO: As of Linux 4.11, the new statx syscall can retrieve creation_time
|
// TODO: As of Linux 4.11, the new statx syscall can retrieve creation_time
|
||||||
fi := File_Info {
|
fi := File_Info {
|
||||||
fullpath = _get_full_path(fd, allocator),
|
fullpath = _get_full_path(fd, allocator),
|
||||||
name = "",
|
name = "",
|
||||||
|
inode = u64(s.ino),
|
||||||
size = i64(s.size),
|
size = i64(s.size),
|
||||||
mode = mode,
|
mode = mode,
|
||||||
type = type,
|
type = type,
|
||||||
|
|||||||
@@ -262,7 +262,8 @@ _file_info_from_get_file_information_by_handle :: proc(path: string, h: win32.HA
|
|||||||
fi: File_Info
|
fi: File_Info
|
||||||
fi.fullpath = path
|
fi.fullpath = path
|
||||||
fi.name = basename(path)
|
fi.name = basename(path)
|
||||||
fi.size = i64(d.nFileSizeHigh)<<32 + i64(d.nFileSizeLow)
|
fi.inode = u64(d.nFileIndexHigh)<<32 + u64(d.nFileIndexLow)
|
||||||
|
fi.size = i64(d.nFileSizeHigh)<<32 + i64(d.nFileSizeLow)
|
||||||
type, mode := _file_type_mode_from_file_attributes(d.dwFileAttributes, nil, 0)
|
type, mode := _file_type_mode_from_file_attributes(d.dwFileAttributes, nil, 0)
|
||||||
fi.type = type
|
fi.type = type
|
||||||
fi.mode |= mode
|
fi.mode |= mode
|
||||||
|
|||||||
Reference in New Issue
Block a user