| 1 | /* Copyright (C) MariaDB Corporation Ab */ |
| 2 | #ifndef _OS_H_INCLUDED |
| 3 | #define _OS_H_INCLUDED |
| 4 | |
| 5 | #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) |
| 6 | typedef off_t off64_t; |
| 7 | #define lseek64(fd, offset, whence) lseek((fd), (offset), (whence)) |
| 8 | #define open64(path, flags, mode) open((path), (flags), (mode)) |
| 9 | #define ftruncate64(fd, length) ftruncate((fd), (length)) |
| 10 | #define O_LARGEFILE 0 |
| 11 | #endif |
| 12 | |
| 13 | #ifdef _AIX |
| 14 | #ifndef O_LARGEFILE |
| 15 | #define O_LARGEFILE 0 |
| 16 | #endif |
| 17 | #endif |
| 18 | |
| 19 | #if defined(__WIN__) |
| 20 | typedef __int64 BIGINT; |
| 21 | typedef _Null_terminated_ const char *PCSZ; |
| 22 | #else // !__WIN__ |
| 23 | typedef longlong BIGINT; |
| 24 | #define FILE_BEGIN SEEK_SET |
| 25 | #define FILE_CURRENT SEEK_CUR |
| 26 | #define FILE_END SEEK_END |
| 27 | typedef const char *PCSZ; |
| 28 | #endif // !__WIN__ |
| 29 | |
| 30 | |
| 31 | #if !defined(__WIN__) |
| 32 | typedef const void *LPCVOID; |
| 33 | typedef const char *LPCTSTR; |
| 34 | typedef const char *LPCSTR; |
| 35 | typedef unsigned char BYTE; |
| 36 | typedef char *LPSTR; |
| 37 | typedef char *LPTSTR; |
| 38 | typedef char *PSZ; |
| 39 | typedef long BOOL; |
| 40 | typedef int INT; |
| 41 | #if !defined(NODW) |
| 42 | /* |
| 43 | sqltypes.h from unixODBC incorrectly defines |
| 44 | DWORD as "unsigned int" instead of "unsigned long" on 64-bit platforms. |
| 45 | Add "#define NODW" into all files including this file that include |
| 46 | sqltypes.h (through sql.h or sqlext.h). |
| 47 | */ |
| 48 | typedef unsigned long DWORD; |
| 49 | #endif // !NODW |
| 50 | #undef HANDLE |
| 51 | typedef int HANDLE; |
| 52 | |
| 53 | #define stricmp strcasecmp |
| 54 | #define _stricmp strcasecmp |
| 55 | #define strnicmp strncasecmp |
| 56 | #define _strnicmp strncasecmp |
| 57 | #ifdef PATH_MAX |
| 58 | #define _MAX_PATH PATH_MAX |
| 59 | #else |
| 60 | #define _MAX_PATH FN_REFLEN |
| 61 | #endif |
| 62 | #define _MAX_DRIVE 3 |
| 63 | #define _MAX_DIR FN_REFLEN |
| 64 | #define _MAX_FNAME FN_HEADLEN |
| 65 | #define _MAX_EXT FN_EXTLEN |
| 66 | #define INVALID_HANDLE_VALUE (-1) |
| 67 | #define __stdcall |
| 68 | #endif /* !__WIN__ */ |
| 69 | |
| 70 | #endif /* _OS_H_INCLUDED */ |
| 71 | |