| 8 | struct stat; |
| 9 | |
| 10 | struct TFileStat { |
| 11 | ui32 Mode = 0; /* protection */ |
| 12 | ui32 Uid = 0; /* user ID of owner */ |
| 13 | ui32 Gid = 0; /* group ID of owner */ |
| 14 | |
| 15 | ui64 NLinks = 0; /* number of hard links */ |
| 16 | ui64 Size = 0; /* total size, in bytes */ |
| 17 | ui64 INode = 0; /* inode number */ |
| 18 | ui64 AllocationSize = 0; /* number of bytes allocated on the disk */ |
| 19 | |
| 20 | time_t ATime = 0; /* time of last access */ |
| 21 | long ATimeNSec = 0; /* nsec of last access */ |
| 22 | time_t MTime = 0; /* time of last modification */ |
| 23 | long MTimeNSec = 0; /* nsec of last modification */ |
| 24 | time_t CTime = 0; /* time of last status change */ |
| 25 | long CTimeNSec = 0; /* nsec of last status change */ |
| 26 | |
| 27 | TFileStat(); |
| 28 | |
| 29 | bool IsNull() const noexcept; |
| 30 | |
| 31 | bool IsFile() const noexcept; |
| 32 | bool IsDir() const noexcept; |
| 33 | bool IsSymlink() const noexcept; |
| 34 | |
| 35 | #if defined(_unix_) |
| 36 | explicit TFileStat(const struct stat& fs); |
| 37 | #endif |
| 38 | explicit TFileStat(const TFile& f); |
| 39 | explicit TFileStat(FHANDLE f); |
| 40 | TFileStat(const TFsPath& fileName, bool nofollow = false); |
| 41 | TFileStat(const TString& fileName, bool nofollow = false); |
| 42 | TFileStat(const char* fileName, bool nofollow = false); |
| 43 | |
| 44 | bool operator==(const TFileStat& other) const noexcept; |
| 45 | |
| 46 | private: |
| 47 | void MakeFromFileName(const char* fileName, bool nofollow); |
| 48 | }; |
| 49 | |
| 50 | i64 GetFileLength(FHANDLE fd); |
| 51 | i64 GetFileLength(const char* name); |
no outgoing calls