2020-07-28 02:59:54 +00:00
|
|
|
/*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-02-28 11:22:49 +00:00
|
|
|
#ifndef _TD_OS_H_
|
|
|
|
|
#define _TD_OS_H_
|
2020-07-28 02:59:54 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-09-22 02:46:19 +00:00
|
|
|
#include <assert.h>
|
2021-09-30 08:41:02 +00:00
|
|
|
#include <ctype.h>
|
2022-03-11 11:39:20 +00:00
|
|
|
|
2022-03-17 06:22:36 +00:00
|
|
|
#include <regex.h>
|
|
|
|
|
|
2022-03-11 11:39:20 +00:00
|
|
|
#if !defined(WINDOWS)
|
2022-01-04 15:13:08 +00:00
|
|
|
#include <dirent.h>
|
2023-02-10 05:00:55 +00:00
|
|
|
|
|
|
|
|
#if !defined(_ALPINE)
|
2022-12-07 14:24:47 +00:00
|
|
|
#include <execinfo.h>
|
2023-02-10 05:00:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <libgen.h>
|
2022-03-11 11:39:20 +00:00
|
|
|
#include <sched.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <unistd.h>
|
2022-03-11 11:39:20 +00:00
|
|
|
#include <wordexp.h>
|
|
|
|
|
|
2022-03-17 06:22:36 +00:00
|
|
|
#include <sys/ioctl.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/shm.h>
|
2022-03-17 06:22:36 +00:00
|
|
|
#include <sys/stat.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <sys/statvfs.h>
|
2022-03-17 06:22:36 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <sys/types.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <sys/utsname.h>
|
2022-03-29 13:13:09 +00:00
|
|
|
#include <sys/wait.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <termios.h>
|
2022-03-15 13:35:04 +00:00
|
|
|
|
|
|
|
|
#if defined(DARWIN)
|
|
|
|
|
#else
|
|
|
|
|
#include <argp.h>
|
2022-10-13 03:09:43 +00:00
|
|
|
#include <sys/prctl.h>
|
2023-07-24 02:07:15 +00:00
|
|
|
#include <sys/sysinfo.h>
|
2022-11-29 15:42:20 +00:00
|
|
|
#if defined(_TD_X86_)
|
2022-11-29 03:57:12 +00:00
|
|
|
#include <cpuid.h>
|
2022-03-15 13:35:04 +00:00
|
|
|
#endif
|
2022-11-29 15:42:20 +00:00
|
|
|
#endif
|
2022-04-22 01:54:27 +00:00
|
|
|
#else
|
|
|
|
|
|
2022-10-11 06:12:11 +00:00
|
|
|
#ifndef __func__
|
2022-10-13 03:09:43 +00:00
|
|
|
#define __func__ __FUNCTION__
|
2022-10-11 06:12:11 +00:00
|
|
|
#endif
|
2022-06-25 03:14:10 +00:00
|
|
|
#include <malloc.h>
|
2022-04-22 01:54:27 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
#ifndef TD_USE_WINSOCK
|
|
|
|
|
#include <winsock2.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <winsock.h>
|
|
|
|
|
#endif
|
2022-03-11 11:39:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2021-09-30 05:40:57 +00:00
|
|
|
#include <errno.h>
|
2022-01-06 08:39:58 +00:00
|
|
|
#include <fcntl.h>
|
2021-09-30 08:41:02 +00:00
|
|
|
#include <float.h>
|
2021-09-30 05:40:57 +00:00
|
|
|
#include <inttypes.h>
|
2022-01-06 09:09:24 +00:00
|
|
|
#include <limits.h>
|
2021-09-30 08:41:02 +00:00
|
|
|
#include <locale.h>
|
|
|
|
|
#include <math.h>
|
2021-09-30 13:21:51 +00:00
|
|
|
#include <setjmp.h>
|
2021-09-30 08:41:02 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
#include <stdarg.h>
|
2021-09-22 02:32:42 +00:00
|
|
|
#include <stdbool.h>
|
2021-09-30 13:21:51 +00:00
|
|
|
#include <stddef.h>
|
2021-09-22 02:32:42 +00:00
|
|
|
#include <stdint.h>
|
2021-09-22 02:46:19 +00:00
|
|
|
#include <stdio.h>
|
2021-09-22 02:32:42 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2022-01-04 15:13:08 +00:00
|
|
|
#include <wchar.h>
|
|
|
|
|
#include <wctype.h>
|
2022-11-11 06:16:13 +00:00
|
|
|
|
|
|
|
|
#if __AVX__
|
|
|
|
|
#include <immintrin.h>
|
|
|
|
|
#elif __SSE4_2__
|
|
|
|
|
#include <nmmintrin.h>
|
|
|
|
|
#endif
|
2022-01-04 15:13:08 +00:00
|
|
|
|
2024-07-22 10:47:41 +00:00
|
|
|
|
2022-10-13 03:09:43 +00:00
|
|
|
#include "osThread.h"
|
|
|
|
|
|
2021-09-22 03:04:14 +00:00
|
|
|
#include "osAtomic.h"
|
|
|
|
|
#include "osDef.h"
|
2021-09-30 05:40:57 +00:00
|
|
|
#include "osDir.h"
|
2021-09-22 02:46:19 +00:00
|
|
|
#include "osEndian.h"
|
2022-10-13 03:09:43 +00:00
|
|
|
#include "osEnv.h"
|
2021-09-30 05:40:57 +00:00
|
|
|
#include "osFile.h"
|
2022-02-24 05:51:12 +00:00
|
|
|
#include "osLocale.h"
|
2021-09-30 13:21:51 +00:00
|
|
|
#include "osLz4.h"
|
2021-09-30 05:40:57 +00:00
|
|
|
#include "osMath.h"
|
2021-09-22 02:32:42 +00:00
|
|
|
#include "osMemory.h"
|
2021-09-30 09:10:36 +00:00
|
|
|
#include "osRand.h"
|
2021-09-30 05:40:57 +00:00
|
|
|
#include "osSemaphore.h"
|
2022-10-13 03:09:43 +00:00
|
|
|
#include "osSignal.h"
|
2021-09-30 09:10:36 +00:00
|
|
|
#include "osSleep.h"
|
2021-09-30 05:40:57 +00:00
|
|
|
#include "osSocket.h"
|
|
|
|
|
#include "osString.h"
|
2021-09-30 13:21:51 +00:00
|
|
|
#include "osSysinfo.h"
|
|
|
|
|
#include "osSystem.h"
|
2021-09-30 09:10:36 +00:00
|
|
|
#include "osTime.h"
|
|
|
|
|
#include "osTimer.h"
|
2022-02-24 04:19:51 +00:00
|
|
|
#include "osTimezone.h"
|
2022-10-13 03:09:43 +00:00
|
|
|
#include "taoserror.h"
|
2023-01-05 01:20:14 +00:00
|
|
|
#include "tlog.h"
|
2020-07-28 02:59:54 +00:00
|
|
|
|
2024-08-02 05:29:47 +00:00
|
|
|
extern int32_t tsRandErrChance;
|
|
|
|
|
extern threadlocal bool tsEnableRandErr;
|
|
|
|
|
|
2020-07-28 02:59:54 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-28 11:22:49 +00:00
|
|
|
#endif /*_TD_OS_H_*/
|