fixed Windows build errors
[public/netxms.git] / include / nxstat.h
CommitLineData
279cb65b
VK
1#ifndef _nxstat_h_
2#define _nxstat_h_
3
4#ifndef S_ISDIR
5#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
6#endif
7
8#ifndef S_ISREG
9#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
10#endif
11
12#if defined(_WIN32)
13#define NX_STAT _tstati64
14#define NX_STAT_STRUCT struct _stati64
15#elif HAVE_LSTAT64 && HAVE_STRUCT_STAT64
16#define NX_STAT lstat64
17#define NX_STAT_STRUCT struct stat64
18#else
19#define NX_STAT lstat
20#define NX_STAT_STRUCT struct stat
21#endif
22
23#if defined(UNICODE) && !defined(_WIN32)
24inline int __call_stat(const WCHAR *f, NX_STAT_STRUCT *s)
25{
26 char *mbf = MBStringFromWideString(f);
27 int rc = NX_STAT(mbf, s);
28 free(mbf);
29 return rc;
30}
31#define CALL_STAT(f, s) __call_stat(f, s)
32#else
33#define CALL_STAT(f, s) NX_STAT(f, s)
34#endif
35
36#endif