Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
86fd70c2
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86fd70c2
编写于
7月 31, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-992]
上级
22c9d652
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
102 deletion
+76
-102
src/os/inc/osDarwin64.h
src/os/inc/osDarwin64.h
+1
-2
src/os/inc/osFile.h
src/os/inc/osFile.h
+4
-3
src/os/src/detail/osCoredump.c
src/os/src/detail/osCoredump.c
+0
-97
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+71
-0
未找到文件。
src/os/inc/osDarwin64.h
浏览文件 @
86fd70c2
...
@@ -71,8 +71,7 @@ extern "C" {
...
@@ -71,8 +71,7 @@ extern "C" {
#include <fcntl.h>
#include <fcntl.h>
#include <sys/utsname.h>
#include <sys/utsname.h>
#define TAOS_OS_FUNC_CORE
#define TAOS_OS_FUNC_FILE_TSENDIFLE
#define TAOS_OS_FUNC_FILEOP
#define taosFSendFile(outfile, infile, offset, count) taosFSendFileImp(outfile, infile, offset, size)
#define taosFSendFile(outfile, infile, offset, count) taosFSendFileImp(outfile, infile, offset, size)
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
...
...
src/os/inc/osFile.h
浏览文件 @
86fd70c2
...
@@ -23,12 +23,13 @@ extern "C" {
...
@@ -23,12 +23,13 @@ extern "C" {
ssize_t
taosTReadImp
(
int
fd
,
void
*
buf
,
size_t
count
);
ssize_t
taosTReadImp
(
int
fd
,
void
*
buf
,
size_t
count
);
ssize_t
taosTWriteImp
(
int
fd
,
void
*
buf
,
size_t
count
);
ssize_t
taosTWriteImp
(
int
fd
,
void
*
buf
,
size_t
count
);
// TAOS_OS_FUNC_FILE_TSENDIFLE
ssize_t
taosTSendFileImp
(
int
dfd
,
int
sfd
,
off_t
*
offset
,
size_t
size
);
ssize_t
taosTSendFileImp
(
int
dfd
,
int
sfd
,
off_t
*
offset
,
size_t
size
);
int
taosFSendFileImp
(
FILE
*
out_file
,
FILE
*
in_file
,
int64_t
*
offset
,
int32_t
count
);
int
taosFSendFileImp
(
FILE
*
out_file
,
FILE
*
in_file
,
int64_t
*
offset
,
int32_t
count
);
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
#ifndef TAOS_OS_FUNC_FILE_TSENDIFLE
#define taosFSendFile(outfile, infile, offset, count) taosTSendFileImp(fileno(outfile), fileno(infile), offset, size)
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
#define taosFSendFile(outfile, infile, offset, count) taosTSendFileImp(fileno(outfile), fileno(infile), offset, size)
#endif
#define taosTRead(fd, buf, count) taosTReadImp(fd, buf, count)
#define taosTRead(fd, buf, count) taosTReadImp(fd, buf, count)
#define taosTWrite(fd, buf, count) taosTWriteImp(fd, buf, count)
#define taosTWrite(fd, buf, count) taosTWriteImp(fd, buf, count)
...
...
src/os/src/detail/osCoredump.c
已删除
100644 → 0
浏览文件 @
22c9d652
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tulog.h"
#include "tsystem.h"
#ifndef TAOS_OS_FUNC_CORE
int
_sysctl
(
struct
__sysctl_args
*
args
);
void
taosSetCoreDump
()
{
if
(
0
==
tsEnableCoreFile
)
{
return
;
}
// 1. set ulimit -c unlimited
struct
rlimit
rlim
;
struct
rlimit
rlim_new
;
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uInfo
(
"the old unlimited para: rlim_cur=%"
PRIu64
", rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
rlim_new
.
rlim_cur
=
RLIM_INFINITY
;
rlim_new
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
)
!=
0
)
{
uInfo
(
"set unlimited fail, error: %s"
,
strerror
(
errno
));
rlim_new
.
rlim_cur
=
rlim
.
rlim_max
;
rlim_new
.
rlim_max
=
rlim
.
rlim_max
;
(
void
)
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
);
}
}
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uInfo
(
"the new unlimited para: rlim_cur=%"
PRIu64
", rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
}
#ifndef _TD_ARM_
// 2. set the path for saving core file
struct
__sysctl_args
args
;
int
old_usespid
=
0
;
size_t
old_len
=
0
;
int
new_usespid
=
1
;
size_t
new_len
=
sizeof
(
new_usespid
);
int
name
[]
=
{
CTL_KERN
,
KERN_CORE_USES_PID
};
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
args
.
newval
=
&
new_usespid
;
args
.
newlen
=
new_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
uInfo
(
"_sysctl(kern_core_uses_pid) set fail: %s"
,
strerror
(
errno
));
}
uInfo
(
"The old core_uses_pid[%"
PRIu64
"]: %d"
,
old_len
,
old_usespid
);
old_usespid
=
0
;
old_len
=
0
;
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
uInfo
(
"_sysctl(kern_core_uses_pid) get fail: %s"
,
strerror
(
errno
));
}
uInfo
(
"The new core_uses_pid[%"
PRIu64
"]: %d"
,
old_len
,
old_usespid
);
#endif
}
#endif
\ No newline at end of file
src/os/src/detail/osSysinfo.c
浏览文件 @
86fd70c2
...
@@ -570,4 +570,75 @@ int taosSystem(const char *cmd) {
...
@@ -570,4 +570,75 @@ int taosSystem(const char *cmd) {
}
}
}
}
int
_sysctl
(
struct
__sysctl_args
*
args
);
void
taosSetCoreDump
()
{
if
(
0
==
tsEnableCoreFile
)
{
return
;
}
// 1. set ulimit -c unlimited
struct
rlimit
rlim
;
struct
rlimit
rlim_new
;
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uInfo
(
"the old unlimited para: rlim_cur=%"
PRIu64
", rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
rlim_new
.
rlim_cur
=
RLIM_INFINITY
;
rlim_new
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
)
!=
0
)
{
uInfo
(
"set unlimited fail, error: %s"
,
strerror
(
errno
));
rlim_new
.
rlim_cur
=
rlim
.
rlim_max
;
rlim_new
.
rlim_max
=
rlim
.
rlim_max
;
(
void
)
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
);
}
}
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uInfo
(
"the new unlimited para: rlim_cur=%"
PRIu64
", rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
}
#ifndef _TD_ARM_
// 2. set the path for saving core file
struct
__sysctl_args
args
;
int
old_usespid
=
0
;
size_t
old_len
=
0
;
int
new_usespid
=
1
;
size_t
new_len
=
sizeof
(
new_usespid
);
int
name
[]
=
{
CTL_KERN
,
KERN_CORE_USES_PID
};
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
args
.
newval
=
&
new_usespid
;
args
.
newlen
=
new_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
uInfo
(
"_sysctl(kern_core_uses_pid) set fail: %s"
,
strerror
(
errno
));
}
uInfo
(
"The old core_uses_pid[%"
PRIu64
"]: %d"
,
old_len
,
old_usespid
);
old_usespid
=
0
;
old_len
=
0
;
memset
(
&
args
,
0
,
sizeof
(
struct
__sysctl_args
));
args
.
name
=
name
;
args
.
nlen
=
sizeof
(
name
)
/
sizeof
(
name
[
0
]);
args
.
oldval
=
&
old_usespid
;
args
.
oldlenp
=
&
old_len
;
old_len
=
sizeof
(
old_usespid
);
if
(
syscall
(
SYS__sysctl
,
&
args
)
==
-
1
)
{
uInfo
(
"_sysctl(kern_core_uses_pid) get fail: %s"
,
strerror
(
errno
));
}
uInfo
(
"The new core_uses_pid[%"
PRIu64
"]: %d"
,
old_len
,
old_usespid
);
#endif
}
#endif
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录