osDarwin.h 2.9 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_DARWIN_H
#define TDENGINE_OS_DARWIN_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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <float.h>
#include <ifaddrs.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <pthread.h>
#include <pwd.h>
#include <regex.h>
#include <semaphore.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/statvfs.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <syslog.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include <wordexp.h>
#include <wctype.h>
#include <inttypes.h>
#include <dispatch/dispatch.h>
#include <fcntl.h>
#include <sys/utsname.h>
S
Shengliang Guan 已提交
73
#include <math.h>
S
Shengliang Guan 已提交
74

S
slguan 已提交
75
#define TAOS_OS_FUNC_FILE_SENDIFLE
S
Shengliang Guan 已提交
76

S
slguan 已提交
77
#define TAOS_OS_FUNC_SEMPHONE
F
freemine 已提交
78 79 80 81 82
  typedef struct tsem_s *tsem_t;
  int tsem_init(tsem_t *sem, int pshared, unsigned int value);
  int tsem_wait(tsem_t *sem);
  int tsem_post(tsem_t *sem);
  int tsem_destroy(tsem_t *sem);
S
Shengliang Guan 已提交
83

S
slguan 已提交
84
#define TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
S
slguan 已提交
85
#define TAOS_OS_FUNC_STRING_STR2INT64
S
slguan 已提交
86 87
#define TAOS_OS_FUNC_SYSINFO
#define TAOS_OS_FUNC_TIMER
F
freemine 已提交
88
#define TAOS_OS_FUNC_SEMPHONE_PTHREAD
S
Shengliang Guan 已提交
89

S
slguan 已提交
90 91
// specific
#define htobe64 htonll
S
Shengliang Guan 已提交
92 93 94
typedef int(*__compar_fn_t)(const void *, const void *);

// for send function in tsocket.c
95 96 97 98 99 100
#if defined(MSG_NOSIGNAL)
#undef MSG_NOSIGNAL
#endif

#define MSG_NOSIGNAL             0

S
Shengliang Guan 已提交
101 102 103 104 105 106 107 108
#define SO_NO_CHECK              0x1234
#define SOL_TCP                  0x1234
#define TCP_KEEPIDLE             0x1234

#ifndef PTHREAD_MUTEX_RECURSIVE_NP
  #define  PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif

S
TD-1207  
Shengliang Guan 已提交
109 110
#define TAOS_OS_FUNC_PTHREAD_RWLOCK

F
eok  
freemine 已提交
111 112 113 114
int64_t tsosStr2int64(char *str);

#include "eok.h"

115 116
void taos_block_sigalrm(void);

S
TD-2837  
Shengliang Guan 已提交
117
#define TAOS_OS_DEF_EPOLL
F
freemine 已提交
118
  #define TAOS_EPOLL_WAIT_TIME 500
S
TD-2837  
Shengliang Guan 已提交
119 120 121
  typedef int32_t SOCKET;
  typedef SOCKET EpollFd;
  #define EpollClose(pollFd) epoll_close(pollFd)
F
eok  
freemine 已提交
122

S
Shengliang Guan 已提交
123 124 125 126 127
#ifdef __cplusplus
}
#endif

#endif