fixed Oracle checks
[public/netxms.git] / include / nxstat.h
CommitLineData
390271e0
VK
1/*
2** NetXMS - Network Management System
3** Copyright (C) 2003-2013 Victor Kirhenshtein
4**
5** This program is free software; you can redistribute it and/or modify
6** it under the terms of the GNU Lesser General Public License as published by
7** the Free Software Foundation; either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU Lesser General Public License
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
19** File: nxstat.h
20**
21**/
22
279cb65b
VK
23#ifndef _nxstat_h_
24#define _nxstat_h_
25
26#ifndef S_ISDIR
27#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
28#endif
29
30#ifndef S_ISREG
31#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
32#endif
33
34#if defined(_WIN32)
390271e0 35
279cb65b 36#define NX_STAT _tstati64
390271e0 37#define NX_FSTAT _fstati64
279cb65b 38#define NX_STAT_STRUCT struct _stati64
390271e0 39
279cb65b 40#elif HAVE_LSTAT64 && HAVE_STRUCT_STAT64
390271e0 41
279cb65b 42#define NX_STAT lstat64
390271e0 43#define NX_FSTAT fstat64
279cb65b 44#define NX_STAT_STRUCT struct stat64
390271e0 45
279cb65b 46#else
390271e0 47
279cb65b 48#define NX_STAT lstat
390271e0 49#define NX_FSTAT fstat
279cb65b 50#define NX_STAT_STRUCT struct stat
390271e0 51
279cb65b
VK
52#endif
53
54#if defined(UNICODE) && !defined(_WIN32)
55inline int __call_stat(const WCHAR *f, NX_STAT_STRUCT *s)
56{
57 char *mbf = MBStringFromWideString(f);
58 int rc = NX_STAT(mbf, s);
59 free(mbf);
60 return rc;
61}
62#define CALL_STAT(f, s) __call_stat(f, s)
63#else
64#define CALL_STAT(f, s) NX_STAT(f, s)
65#endif
66
67#endif