osWindows.h 3.1 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

S
slguan 已提交
16 17
#ifndef TDENGINE_OS_WINDOWS_H
#define TDENGINE_OS_WINDOWS_H
S
Shengliang Guan 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <locale.h>
#include <intrin.h>
#include <io.h>
#include <math.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "winsock2.h"
#include <WS2tcpip.h>
#include <winbase.h>
#include <Winsock2.h>
S
TD-1057  
Shengliang Guan 已提交
40 41
#include <time.h>
#include <inttypes.h>
S
TD-1244  
Shengliang Guan 已提交
42
#include <conio.h>
S
Shengliang Guan 已提交
43
#include <math.h>
S
TD-1057  
Shengliang Guan 已提交
44 45 46
#include "msvcProcess.h"
#include "msvcDirect.h"
#include "msvcFcntl.h"
47
#include "msvcLibgen.h"
S
TD-1057  
Shengliang Guan 已提交
48
#include "msvcStdio.h"
S
TD-1207  
Shengliang Guan 已提交
49 50
#include "msvcUnistd.h"
#include "msvcLibgen.h"
S
TD-1057  
Shengliang Guan 已提交
51 52
#include "sys/msvcStat.h"
#include "sys/msvcTypes.h"
S
Shengliang Guan 已提交
53 54 55 56 57

#ifdef __cplusplus
extern "C" {
#endif

S
TD-1057  
Shengliang Guan 已提交
58 59 60
char *stpcpy (char *dest, const char *src);
char *stpncpy (char *dest, const char *src, size_t n);

S
slguan 已提交
61
// specific
S
slguan 已提交
62
typedef int (*__compar_fn_t)(const void *, const void *);
S
slguan 已提交
63 64 65 66 67 68 69 70 71 72
#define ssize_t int
#define bzero(ptr, size) memset((ptr), 0, (size))
#define strcasecmp  _stricmp
#define strncasecmp _strnicmp
#define wcsncasecmp _wcsnicmp
#define strtok_r strtok_s
#define snprintf _snprintf
#define in_addr_t unsigned long
#define socklen_t int

S
slguan 已提交
73 74 75 76 77 78
struct tm *localtime_r(const time_t *timep, struct tm *result);
char *     strptime(const char *buf, const char *fmt, struct tm *tm);
char *     strsep(char **stringp, const char *delim);
char *     getpass(const char *prefix);
int        flock(int fd, int option);
char *     strndup(const char *s, size_t n);
S
TD-1057  
Shengliang Guan 已提交
79
int        gettimeofday(struct timeval *ptv, void *pTimeZone);
S
slguan 已提交
80

S
Shengliang Guan 已提交
81 82 83 84
// for send function in tsocket.c
#define MSG_NOSIGNAL             0
#define SO_NO_CHECK              0x1234
#define SOL_TCP                  0x1234
85 86 87 88 89 90 91 92 93 94 95 96 97

#ifndef TCP_KEEPCNT
  #define TCP_KEEPCNT              0x1234
#endif

#ifndef TCP_KEEPIDLE
  #define TCP_KEEPIDLE             0x1234
#endif

#ifndef TCP_KEEPINTVL
  #define TCP_KEEPINTVL            0x1234
#endif

98 99 100
#define SHUT_RDWR                SD_BOTH
#define SHUT_RD                  SD_RECEIVE
#define SHUT_WR                  SD_SEND
S
Shengliang Guan 已提交
101 102 103 104 105 106 107 108 109 110

#define LOCK_EX 1
#define LOCK_NB 2
#define LOCK_UN 3

#ifndef PATH_MAX
  #define PATH_MAX 256
#endif

typedef struct {
S
slguan 已提交
111
  int    we_wordc;
S
TD-1207  
Shengliang Guan 已提交
112
  char  *we_wordv[1];
S
slguan 已提交
113
  int    we_offs;
S
TD-1207  
Shengliang Guan 已提交
114
  char   wordPos[1025];
S
Shengliang Guan 已提交
115
} wordexp_t;
S
TD-1207  
Shengliang Guan 已提交
116
int  wordexp(char *words, wordexp_t *pwordexp, int flags);
S
Shengliang Guan 已提交
117 118
void wordfree(wordexp_t *pwordexp);

S
TD-1207  
Shengliang Guan 已提交
119 120 121 122 123 124
#define openlog(a, b, c)
#define closelog()
#define LOG_ERR 0
#define LOG_INFO 1
void syslog(int unused, const char *format, ...);

S
Shengliang Guan 已提交
125 126 127
#ifdef __cplusplus
}
#endif
S
TD-1530  
Shengliang Guan 已提交
128
#endif