| 1 |
|
| 2 |
/// $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) |
| 3 |
/// Author: Walter Bright |
| 4 |
|
| 5 |
module core.sys.windows.stat; |
| 6 |
version (Windows): |
| 7 |
|
| 8 |
extern (C) nothrow @nogc: |
| 9 |
|
| 10 |
import core.sys.windows.stdc.time; |
| 11 |
|
| 12 |
// Posix version is in core.sys.posix.sys.stat |
| 13 |
|
| 14 |
enum S_IFMT = 0xF000; |
| 15 |
enum S_IFDIR = 0x4000; |
| 16 |
enum S_IFCHR = 0x2000; |
| 17 |
enum S_IFIFO = 0x1000; |
| 18 |
enum S_IFREG = 0x8000; |
| 19 |
enum S_IREAD = 0x0100; |
| 20 |
enum S_IWRITE = 0x0080; |
| 21 |
enum S_IEXEC = 0x0040; |
| 22 |
enum S_IFBLK = 0x6000; |
| 23 |
enum S_IFNAM = 0x5000; |
| 24 |
|
| 25 |
@safe pure |
| 26 |
{ |
| 27 |
int S_ISREG(int m) { return (m & S_IFMT) == S_IFREG; } |
| 28 |
int S_ISBLK(int m) { return (m & S_IFMT) == S_IFBLK; } |
| 29 |
int S_ISNAM(int m) { return (m & S_IFMT) == S_IFNAM; } |
| 30 |
int S_ISDIR(int m) { return (m & S_IFMT) == S_IFDIR; } |
| 31 |
int S_ISCHR(int m) { return (m & S_IFMT) == S_IFCHR; } |
| 32 |
} |
| 33 |
|
| 34 |
version (CRuntime_Microsoft) |
| 35 |
{ |
| 36 |
struct struct_stat |
| 37 |
{ |
| 38 |
uint st_dev; |
| 39 |
ushort st_ino; |
| 40 |
ushort st_mode; |
| 41 |
short st_nlink; |
| 42 |
short st_uid; |
| 43 |
short st_gid; |
| 44 |
uint st_rdev; |
| 45 |
int st_size; |
| 46 |
time_t st_atime; |
| 47 |
time_t st_mtime; |
| 48 |
time_t st_ctime; |
| 49 |
} |
| 50 |
|
| 51 |
// These assume time_t is 32 bits (which druntime's definition currently is) |
| 52 |
// Add pragma(mangle) to use _stat64 etc. when time_t is made 64-bit |
| 53 |
// See also: https://issues.dlang.org/show_bug.cgi?id=21134 |
| 54 |
int stat(const(char)*, struct_stat *); |
| 55 |
int fstat(int, struct_stat *) @trusted; |
| 56 |
int _wstat(const(wchar)*, struct_stat *); |
| 57 |
} |