Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ce6aa6d0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ce6aa6d0
编写于
5月 09, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-4088
上级
b4fa11df
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
17 addition
and
20 deletion
+17
-20
cmake/define.inc
cmake/define.inc
+1
-1
src/os/inc/osSemphone.h
src/os/inc/osSemphone.h
+1
-1
src/os/src/darwin/dwEok.c
src/os/src/darwin/dwEok.c
+2
-2
src/os/src/darwin/dwSemphone.c
src/os/src/darwin/dwSemphone.c
+12
-14
src/os/src/darwin/dwSysInfo.c
src/os/src/darwin/dwSysInfo.c
+0
-1
src/os/src/detail/osTimer.c
src/os/src/detail/osTimer.c
+1
-1
未找到文件。
cmake/define.inc
浏览文件 @
ce6aa6d0
...
@@ -138,7 +138,7 @@ IF (TD_DARWIN_64)
...
@@ -138,7 +138,7 @@ IF (TD_DARWIN_64)
ADD_DEFINITIONS
(
-
D_REENTRANT
-
D__USE_POSIX
-
D_LIBC_REENTRANT
)
ADD_DEFINITIONS
(
-
D_REENTRANT
-
D__USE_POSIX
-
D_LIBC_REENTRANT
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"darwin64 is defined"
)
MESSAGE
(
STATUS
"darwin64 is defined"
)
SET
(
COMMON_FLAGS
"-Wall -Werror -Wno-missing-braces -fPIC -
msse4.2 -
D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
SET
(
COMMON_FLAGS
"-Wall -Werror -Wno-missing-braces -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
SET
(
DEBUG_FLAGS
"-O0 -g3 -DDEBUG"
)
SET
(
DEBUG_FLAGS
"-O0 -g3 -DDEBUG"
)
SET
(
RELEASE_FLAGS
"-Og"
)
SET
(
RELEASE_FLAGS
"-Og"
)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
deps
/
cJson
/
inc
)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
deps
/
cJson
/
inc
)
...
...
src/os/inc/osSemphone.h
浏览文件 @
ce6aa6d0
...
@@ -29,7 +29,7 @@ extern "C" {
...
@@ -29,7 +29,7 @@ extern "C" {
#else
#else
#define tsem_t sem_t
#define tsem_t sem_t
#define tsem_init sem_init
#define tsem_init sem_init
int
32_t
tsem_wait
(
tsem_t
*
sem
);
int
tsem_wait
(
tsem_t
*
sem
);
#define tsem_post sem_post
#define tsem_post sem_post
#define tsem_destroy sem_destroy
#define tsem_destroy sem_destroy
#endif
#endif
...
...
src/os/src/darwin/dwEok.c
浏览文件 @
ce6aa6d0
...
@@ -18,9 +18,9 @@
...
@@ -18,9 +18,9 @@
// https://stackoverflow.com/questions/4393197/erlangs-let-it-crash-philosophy-applicable-elsewhere
// https://stackoverflow.com/questions/4393197/erlangs-let-it-crash-philosophy-applicable-elsewhere
// experimentally, we follow log-and-crash here
// experimentally, we follow log-and-crash here
#include "osEok.h"
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include "osEok.h"
#include <sys/event.h>
#include <sys/event.h>
...
...
src/os/src/darwin/dwSemphone.c
浏览文件 @
ce6aa6d0
...
@@ -20,8 +20,6 @@
...
@@ -20,8 +20,6 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include <stdint.h>
#include <libproc.h>
#include <libproc.h>
// #define SEM_USE_PTHREAD
// #define SEM_USE_PTHREAD
...
@@ -38,7 +36,7 @@
...
@@ -38,7 +36,7 @@
static
pthread_t
sem_thread
;
static
pthread_t
sem_thread
;
static
pthread_once_t
sem_once
;
static
pthread_once_t
sem_once
;
static
task_t
sem_port
;
static
task_t
sem_port
;
static
volatile
int
32_t
sem_inited
=
0
;
static
volatile
int
sem_inited
=
0
;
static
semaphore_t
sem_exit
;
static
semaphore_t
sem_exit
;
static
void
*
sem_thread_routine
(
void
*
arg
)
{
static
void
*
sem_thread_routine
(
void
*
arg
)
{
...
@@ -56,7 +54,7 @@ static void* sem_thread_routine(void *arg) {
...
@@ -56,7 +54,7 @@ static void* sem_thread_routine(void *arg) {
}
}
static
void
once_init
(
void
)
{
static
void
once_init
(
void
)
{
int
32_t
r
=
0
;
int
r
=
0
;
r
=
pthread_create
(
&
sem_thread
,
NULL
,
sem_thread_routine
,
NULL
);
r
=
pthread_create
(
&
sem_thread
,
NULL
,
sem_thread_routine
,
NULL
);
if
(
r
)
{
if
(
r
)
{
fprintf
(
stderr
,
"==%s[%d]%s()==failed to create thread
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
);
fprintf
(
stderr
,
"==%s[%d]%s()==failed to create thread
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
);
...
@@ -82,10 +80,10 @@ struct tsem_s {
...
@@ -82,10 +80,10 @@ struct tsem_s {
dispatch_semaphore_t
sem
;
dispatch_semaphore_t
sem
;
#endif // SEM_USE_PTHREAD
#endif // SEM_USE_PTHREAD
volatile
unsigned
int
32_t
valid
:
1
;
volatile
unsigned
int
valid
:
1
;
};
};
int
32_t
tsem_init
(
tsem_t
*
sem
,
int32_t
pshared
,
unsigned
int32_
t
value
)
{
int
tsem_init
(
tsem_t
*
sem
,
int
pshared
,
unsigned
in
t
value
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==creating\n", basename(__FILE__), __LINE__, __func__, sem);
// fprintf(stderr, "==%s[%d]%s():[%p]==creating\n", basename(__FILE__), __LINE__, __func__, sem);
if
(
*
sem
)
{
if
(
*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==already initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==already initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
...
@@ -98,7 +96,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
...
@@ -98,7 +96,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
}
}
#ifdef SEM_USE_PTHREAD
#ifdef SEM_USE_PTHREAD
int
32_t
r
=
pthread_mutex_init
(
&
p
->
lock
,
NULL
);
int
r
=
pthread_mutex_init
(
&
p
->
lock
,
NULL
);
do
{
do
{
if
(
r
)
break
;
if
(
r
)
break
;
r
=
pthread_cond_init
(
&
p
->
cond
,
NULL
);
r
=
pthread_cond_init
(
&
p
->
cond
,
NULL
);
...
@@ -125,7 +123,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
...
@@ -125,7 +123,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
p
->
sem
=
sem_open
(
name
,
O_CREAT
|
O_EXCL
,
pshared
,
value
);
p
->
sem
=
sem_open
(
name
,
O_CREAT
|
O_EXCL
,
pshared
,
value
);
p
->
id
=
id
;
p
->
id
=
id
;
if
(
p
->
sem
!=
SEM_FAILED
)
break
;
if
(
p
->
sem
!=
SEM_FAILED
)
break
;
int
32_t
e
=
errno
;
int
e
=
errno
;
if
(
e
==
EEXIST
)
continue
;
if
(
e
==
EEXIST
)
continue
;
if
(
e
==
EINTR
)
continue
;
if
(
e
==
EINTR
)
continue
;
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not created[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not created[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
...
@@ -159,7 +157,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
...
@@ -159,7 +157,7 @@ int32_t tsem_init(tsem_t *sem, int32_t pshared, unsigned int32_t value) {
return
0
;
return
0
;
}
}
int
32_t
tsem_wait
(
tsem_t
*
sem
)
{
int
tsem_wait
(
tsem_t
*
sem
)
{
if
(
!*
sem
)
{
if
(
!*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
abort
();
abort
();
...
@@ -195,7 +193,7 @@ int32_t tsem_wait(tsem_t *sem) {
...
@@ -195,7 +193,7 @@ int32_t tsem_wait(tsem_t *sem) {
#endif // SEM_USE_PTHREAD
#endif // SEM_USE_PTHREAD
}
}
int
32_t
tsem_post
(
tsem_t
*
sem
)
{
int
tsem_post
(
tsem_t
*
sem
)
{
if
(
!*
sem
)
{
if
(
!*
sem
)
{
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==not initialized
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
);
abort
();
abort
();
...
@@ -231,7 +229,7 @@ int32_t tsem_post(tsem_t *sem) {
...
@@ -231,7 +229,7 @@ int32_t tsem_post(tsem_t *sem) {
#endif // SEM_USE_PTHREAD
#endif // SEM_USE_PTHREAD
}
}
int
32_t
tsem_destroy
(
tsem_t
*
sem
)
{
int
tsem_destroy
(
tsem_t
*
sem
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==destroying\n", basename(__FILE__), __LINE__, __func__, sem);
// fprintf(stderr, "==%s[%d]%s():[%p]==destroying\n", basename(__FILE__), __LINE__, __func__, sem);
if
(
!*
sem
)
{
if
(
!*
sem
)
{
// fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem);
// fprintf(stderr, "==%s[%d]%s():[%p]==not initialized\n", basename(__FILE__), __LINE__, __func__, sem);
...
@@ -265,9 +263,9 @@ int32_t tsem_destroy(tsem_t *sem) {
...
@@ -265,9 +263,9 @@ int32_t tsem_destroy(tsem_t *sem) {
#elif defined(SEM_USE_POSIX)
#elif defined(SEM_USE_POSIX)
char
name
[
NAME_MAX
-
4
];
char
name
[
NAME_MAX
-
4
];
snprintf
(
name
,
sizeof
(
name
),
"/t%ld"
,
p
->
id
);
snprintf
(
name
,
sizeof
(
name
),
"/t%ld"
,
p
->
id
);
int
32_t
r
=
sem_unlink
(
name
);
int
r
=
sem_unlink
(
name
);
if
(
r
)
{
if
(
r
)
{
int
32_t
e
=
errno
;
int
e
=
errno
;
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==unlink failed[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
fprintf
(
stderr
,
"==%s[%d]%s():[%p]==unlink failed[%d]%s
\n
"
,
basename
(
__FILE__
),
__LINE__
,
__func__
,
sem
,
e
,
strerror
(
e
));
abort
();
abort
();
}
}
...
@@ -285,7 +283,7 @@ int32_t tsem_destroy(tsem_t *sem) {
...
@@ -285,7 +283,7 @@ int32_t tsem_destroy(tsem_t *sem) {
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
uint64_t
id
=
0
;
uint64_t
id
=
0
;
int
32_t
r
=
pthread_threadid_np
(
thread
,
&
id
);
int
r
=
pthread_threadid_np
(
thread
,
&
id
);
return
r
?
false
:
true
;
return
r
?
false
:
true
;
}
}
...
...
src/os/src/darwin/dwSysInfo.c
浏览文件 @
ce6aa6d0
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include <errno.h>
#include <errno.h>
#include <libproc.h>
#include <libproc.h>
static
void
taosGetSystemTimezone
()
{
static
void
taosGetSystemTimezone
()
{
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
if
(
cfg_timezone
==
NULL
)
return
;
if
(
cfg_timezone
==
NULL
)
return
;
...
...
src/os/src/detail/osTimer.c
浏览文件 @
ce6aa6d0
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "ttimer.h"
#include "ttimer.h"
#include "tulog.h"
#include "tulog.h"
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|| defined(_TD_DARWIN_64)
)
static
void
taosDeleteTimer
(
void
*
tharg
)
{
static
void
taosDeleteTimer
(
void
*
tharg
)
{
timer_t
*
pTimer
=
tharg
;
timer_t
*
pTimer
=
tharg
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录