working on #149
[platform/upstream/ejdb.git] / src / tcutil / win32 / platform.h
1 /*
2  * File:   platform.h
3  * Author: adam
4  *
5  * Created on March 31, 2013, 9:34 PM
6  */
7
8 #ifndef PLATFORM_H
9 #define PLATFORM_H
10
11 #include "basedefs.h"
12 #include <stddef.h>
13 #include <time.h>
14 #include <direct.h>
15 #include <sys/stat.h>
16
17 typedef struct {
18     size_t gl_pathc; /* Count of paths matched so far  */
19     char **gl_pathv; /* List of matched pathnames.  */
20     size_t gl_offs; /* Slots to reserve in gl_pathv.  */
21 } glob_t;
22
23 #define GLOB_ERR 1
24 #define GLOB_MARK 0
25 #define GLOB_NOSORT 2
26 #define GLOB_DOOFFS 0
27 #define GLOB_NOCHECK 0
28 #define GLOB_APPEND 0
29 #define GLOB_NOESCAPE 0
30 #define GLOB_PERIOD 0
31 #define GLOB_ALTDIRFUNC 0
32 #define GLOB_BRACE 0
33 #define GLOB_NOMAGIC 0
34 #define GLOB_TILDE 0
35 #define GLOB_TILDE_CHECK 0
36 #define GLOB_ONLYDIR 4
37
38 #define GLOB_NOSPACE -1
39 #define GLOB_ABORTED -2
40 #define GLOB_NOMATCH -3
41
42 int glob(const char *pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob);
43 void globfree(glob_t *pglob);
44 int win_fstat(HANDLE fh, struct stat *buf);
45 ssize_t win_pwrite(HANDLE fd, const void *buf, size_t count, off_t offset);
46 ssize_t win_pread(HANDLE fd, void *buf, size_t size, off_t off);
47
48 #define mkdir(a, b) _mkdir(a)
49 #undef fstat
50 #define fstat win_fstat
51 #define lstat stat
52 #define sysconf_SC_CLK_TCK 64
53 #define fsync(a) !FlushFileBuffers(a)
54 #define pwrite win_pwrite
55 #define pread win_pread
56
57
58 #ifndef WIFEXITED
59 #define WIFEXITED(S) 1
60 #endif
61
62 #ifndef WEXITSTATUS
63 #define WEXITSTATUS(S) (S)
64 #endif
65
66 #endif  /* PLATFORM_H */
67