]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/lib/tokyocabinet/compat.h
Purged was missed, Adding here.
[bacula/bacula] / bacula / src / lib / tokyocabinet / compat.h
1 /*************************************************************************************************
2  * The win32 compat API of Tokyo Cabinet
3  *                                                      Copyright (C) 2006-2008 Mikio Hirabayashi
4  *
5  * Tokyo Cabinet is free software; you can redistribute it and/or modify it under the terms of
6  * the GNU Lesser General Public License as published by the Free Software Foundation; either
7  * version 2.1 of the License or any later version.  Tokyo Cabinet is distributed in the hope
8  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
10  * License for more details.
11  * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12  * Cabinet; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13  * Boston, MA 02111-1307 USA.
14  *************************************************************************************************/
15
16 #ifndef COMPAT_H
17 #define COMPAT_H
18
19 #ifdef HAVE_WIN32
20 #include <sys/types.h>
21
22 typedef int regoff_t;
23
24 typedef struct {
25    regoff_t rm_so;
26    regoff_t rm_eo;
27 } regmatch_t;
28
29 typedef struct {
30    
31 } regex_t;
32
33 #define REG_EXTENDED 0
34 #define REG_NOSUB    0
35 #define REG_ICASE    0
36 #define REG_NOTBOL   0
37 int regcomp(regex_t *preg, const char *regex, int cflags);
38 int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
39 size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);
40 void regfree(regex_t *preg);
41
42
43 /* mmap implementation for tokyodbm */
44 #define PROT_WRITE 0x2             /* Page can be written.  */
45 #define PROT_READ  0x1             /* page can be read */
46 #define MAP_SHARED 0x01            /* Share changes.  */
47 #define MAP_FAILED ((void *) -1)
48 #define MS_SYNC 0
49
50 void *mmap(void *start, size_t length, int prot, int flags,
51            int fd, off_t offset);
52 int munmap(void *start, size_t length);
53 int msync(void *start, size_t length, int flags);
54 int fsync(int fd);
55 ssize_t pread(int fd, void *buf, size_t count, off_t offset);
56 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
57 int rand_r(int *seedp);
58
59 /*
60 struct timezone {
61    int tz_minuteswest;
62    int tz_dsttime;
63 };
64
65 int gettimeofday(struct timeval *tv, struct timezone *tz);
66 */
67
68 typedef struct {
69    size_t   gl_pathc;    /* Count of paths matched so far  */
70    char   **gl_pathv;    /* List of matched pathnames.  */
71    size_t   gl_offs;     /* Slots to reserve in ‘gl_pathv’.  */
72 } glob_t;
73
74 int glob(const char *pattern, int flags,
75          int (*errfunc) (const char *epath, int eerrno),
76          glob_t *pglob);
77
78 void globfree(glob_t *pglob);
79
80 #define GLOB_ERR     0
81 #define GLOB_NOSORT  0
82 #define GLOB_NOMATCH 0
83
84 char *realpath(const char *path, char *resolved_path);
85
86 #define lstat stat
87
88 #endif  /* HAVE_WIN32 */
89 #endif  /* !COMPAT_H */