Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
d0a1179a
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
接近 2 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d0a1179a
编写于
5月 31, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 31, 2023
浏览文件
操作
浏览文件
下载
差异文件
!2003 fix codex
Merge pull request !2003 from cheng_jinsong/master_cc
上级
4eb2d4bd
ac8e2135
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
12 deletion
+31
-12
services/init/init_common_service.c
services/init/init_common_service.c
+2
-1
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+4
-0
services/modules/sysevent/startup_time_event.c
services/modules/sysevent/startup_time_event.c
+4
-4
services/modules/trace/init_trace.c
services/modules/trace/init_trace.c
+15
-5
ueventd/ueventd_firmware_handler.c
ueventd/ueventd_firmware_handler.c
+3
-2
watchdog/init_watchdog.c
watchdog/init_watchdog.c
+3
-0
未找到文件。
services/init/init_common_service.c
浏览文件 @
d0a1179a
...
@@ -433,7 +433,7 @@ static int32_t CheckTraceStatus(void)
...
@@ -433,7 +433,7 @@ static int32_t CheckTraceStatus(void)
return
(
-
errno
);
return
(
-
errno
);
}
}
char
data
[
1024
]
=
{
0
};
char
data
[
1024
]
=
{
0
};
// 1024 data len
ssize_t
dataNum
=
read
(
fd
,
data
,
sizeof
(
data
));
ssize_t
dataNum
=
read
(
fd
,
data
,
sizeof
(
data
));
if
(
close
(
fd
)
<
0
)
{
if
(
close
(
fd
)
<
0
)
{
INIT_LOGE
(
"lldb: close fd error: %{public}d"
,
errno
);
INIT_LOGE
(
"lldb: close fd error: %{public}d"
,
errno
);
...
@@ -446,6 +446,7 @@ static int32_t CheckTraceStatus(void)
...
@@ -446,6 +446,7 @@ static int32_t CheckTraceStatus(void)
}
}
const
char
*
tracerPid
=
"TracerPid:
\t
"
;
const
char
*
tracerPid
=
"TracerPid:
\t
"
;
data
[
1023
]
=
'\0'
;
// 1023 data last position
char
*
traceStr
=
strstr
(
data
,
tracerPid
);
char
*
traceStr
=
strstr
(
data
,
tracerPid
);
if
(
traceStr
==
NULL
)
{
if
(
traceStr
==
NULL
)
{
INIT_LOGE
(
"lldb: fail to find %{public}s"
,
tracerPid
);
INIT_LOGE
(
"lldb: fail to find %{public}s"
,
tracerPid
);
...
...
services/init/standard/init_cmds.c
浏览文件 @
d0a1179a
...
@@ -82,6 +82,10 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u
...
@@ -82,6 +82,10 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u
// copy param name
// copy param name
ret
=
strncpy_s
(
tmpName
,
PARAM_NAME_LEN_MAX
,
begin
,
left
-
begin
);
ret
=
strncpy_s
(
tmpName
,
PARAM_NAME_LEN_MAX
,
begin
,
left
-
begin
);
INIT_ERROR_CHECK
(
ret
==
EOK
,
return
-
1
,
"Invalid param name %s"
,
symValue
);
INIT_ERROR_CHECK
(
ret
==
EOK
,
return
-
1
,
"Invalid param name %s"
,
symValue
);
if
(
paramLen
<
curr
)
{
INIT_LOGE
(
"Failed to get param value over max length"
);
return
-
1
;
}
uint32_t
valueLen
=
paramLen
-
curr
;
uint32_t
valueLen
=
paramLen
-
curr
;
ret
=
SystemReadParam
(
tmpName
,
paramValue
+
curr
,
&
valueLen
);
ret
=
SystemReadParam
(
tmpName
,
paramValue
+
curr
,
&
valueLen
);
INIT_ERROR_CHECK
(
ret
==
0
,
return
-
1
,
"Failed to get param %s"
,
tmpName
);
INIT_ERROR_CHECK
(
ret
==
0
,
return
-
1
,
"Failed to get param %s"
,
tmpName
);
...
...
services/modules/sysevent/startup_time_event.c
浏览文件 @
d0a1179a
...
@@ -54,8 +54,8 @@ static int TraversalEvent(ListNode *node, void *root)
...
@@ -54,8 +54,8 @@ static int TraversalEvent(ListNode *node, void *root)
return
0
;
return
0
;
}
}
EventArgs
*
args
=
(
EventArgs
*
)
root
;
EventArgs
*
args
=
(
EventArgs
*
)
root
;
uint32_
t
len
=
GetServiceName
(
item
->
paramName
,
args
->
buffer
+
args
->
currLen
,
args
->
bufferLen
-
args
->
currLen
);
in
t
len
=
GetServiceName
(
item
->
paramName
,
args
->
buffer
+
args
->
currLen
,
args
->
bufferLen
-
args
->
currLen
);
PLUGIN_CHECK
(
len
>
0
&&
((
len
+
args
->
currLen
)
<
args
->
bufferLen
),
return
-
1
,
PLUGIN_CHECK
(
len
>
0
&&
((
(
uint32_t
)
len
+
args
->
currLen
)
<
args
->
bufferLen
),
return
-
1
,
"Failed to format service name %s"
,
item
->
paramName
);
"Failed to format service name %s"
,
item
->
paramName
);
args
->
currLen
+=
len
;
args
->
currLen
+=
len
;
...
@@ -64,9 +64,9 @@ static int TraversalEvent(ListNode *node, void *root)
...
@@ -64,9 +64,9 @@ static int TraversalEvent(ListNode *node, void *root)
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
MSECTONSEC
),
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
MSECTONSEC
),
(
uint32_t
)
item
->
timestamp
[
BOOTEVENT_READY
].
tv_sec
,
(
uint32_t
)
item
->
timestamp
[
BOOTEVENT_READY
].
tv_sec
,
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
MSECTONSEC
));
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
MSECTONSEC
));
PLUGIN_CHECK
(
len
>
0
&&
((
len
+
args
->
currLen
)
<
args
->
bufferLen
),
return
-
1
,
PLUGIN_CHECK
(
len
>
0
&&
((
(
uint32_t
)
len
+
args
->
currLen
)
<
args
->
bufferLen
),
return
-
1
,
"Failed to format service time %s"
,
item
->
paramName
);
"Failed to format service time %s"
,
item
->
paramName
);
args
->
currLen
+=
len
;
args
->
currLen
+=
(
uint32_t
)
len
;
return
0
;
return
0
;
}
}
...
...
services/modules/trace/init_trace.c
浏览文件 @
d0a1179a
...
@@ -88,7 +88,9 @@ static char *ReadFile(const char *path)
...
@@ -88,7 +88,9 @@ static char *ReadFile(const char *path)
PLUGIN_LOGE
(
"Invalid file %s or buffer %zu"
,
path
,
fileStat
.
st_size
);
PLUGIN_LOGE
(
"Invalid file %s or buffer %zu"
,
path
,
fileStat
.
st_size
);
return
NULL
;
return
NULL
;
}
}
FILE
*
fd
=
fopen
(
path
,
"r"
);
char
realPath
[
PATH_MAX
]
=
""
;
realpath
(
path
,
realPath
);
FILE
*
fd
=
fopen
(
realPath
,
"r"
);
PLUGIN_CHECK
(
fd
!=
NULL
,
return
NULL
,
"Failed to fopen path %s"
,
path
);
PLUGIN_CHECK
(
fd
!=
NULL
,
return
NULL
,
"Failed to fopen path %s"
,
path
);
char
*
buffer
=
NULL
;
char
*
buffer
=
NULL
;
do
{
do
{
...
@@ -171,7 +173,9 @@ static bool WriteStrToFile(const char *filename, const char *str)
...
@@ -171,7 +173,9 @@ static bool WriteStrToFile(const char *filename, const char *str)
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
"%s%s"
,
workspace
->
traceRootPath
,
filename
);
"%s%s"
,
workspace
->
traceRootPath
,
filename
);
PLUGIN_CHECK
(
len
>
0
,
return
false
,
"Failed to format path %s"
,
filename
);
PLUGIN_CHECK
(
len
>
0
,
return
false
,
"Failed to format path %s"
,
filename
);
FILE
*
outfile
=
fopen
(
workspace
->
buffer
,
"w"
);
char
realPath
[
PATH_MAX
]
=
""
;
realpath
(
workspace
->
buffer
,
realPath
);
FILE
*
outfile
=
fopen
(
realPath
,
"w"
);
PLUGIN_CHECK
(
outfile
!=
NULL
,
return
false
,
"Failed to open file %s."
,
workspace
->
buffer
);
PLUGIN_CHECK
(
outfile
!=
NULL
,
return
false
,
"Failed to open file %s."
,
workspace
->
buffer
);
(
void
)
fprintf
(
outfile
,
"%s"
,
str
);
(
void
)
fprintf
(
outfile
,
"%s"
,
str
);
(
void
)
fflush
(
outfile
);
(
void
)
fflush
(
outfile
);
...
@@ -328,8 +332,10 @@ static bool ClearTrace(void)
...
@@ -328,8 +332,10 @@ static bool ClearTrace(void)
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
"%s%s"
,
workspace
->
traceRootPath
,
TRACE_PATH
);
"%s%s"
,
workspace
->
traceRootPath
,
TRACE_PATH
);
PLUGIN_CHECK
(
len
>
0
,
return
false
,
"Failed to format path %s"
,
TRACE_PATH
);
PLUGIN_CHECK
(
len
>
0
,
return
false
,
"Failed to format path %s"
,
TRACE_PATH
);
char
realPath
[
PATH_MAX
]
=
""
;
realpath
(
workspace
->
buffer
,
realPath
);
// clear old trace file
// clear old trace file
int
fd
=
open
(
workspace
->
buffer
,
O_RDWR
);
int
fd
=
open
(
realPath
,
O_RDWR
);
PLUGIN_CHECK
(
fd
>=
0
,
return
false
,
"Failed to open file %s errno %d"
,
workspace
->
buffer
,
errno
);
PLUGIN_CHECK
(
fd
>=
0
,
return
false
,
"Failed to open file %s errno %d"
,
workspace
->
buffer
,
errno
);
(
void
)
ftruncate
(
fd
,
0
);
(
void
)
ftruncate
(
fd
,
0
);
close
(
fd
);
close
(
fd
);
...
@@ -379,7 +385,9 @@ static void DumpTrace(const TraceWorkspace *workspace, int outFd, const char *pa
...
@@ -379,7 +385,9 @@ static void DumpTrace(const TraceWorkspace *workspace, int outFd, const char *pa
{
{
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
"%s%s"
,
workspace
->
traceRootPath
,
path
);
int
len
=
sprintf_s
((
char
*
)
workspace
->
buffer
,
sizeof
(
workspace
->
buffer
),
"%s%s"
,
workspace
->
traceRootPath
,
path
);
PLUGIN_CHECK
(
len
>
0
,
return
,
"Failed to format path %s"
,
path
);
PLUGIN_CHECK
(
len
>
0
,
return
,
"Failed to format path %s"
,
path
);
int
traceFd
=
open
(
workspace
->
buffer
,
O_RDWR
);
char
realPath
[
PATH_MAX
]
=
""
;
realpath
(
workspace
->
buffer
,
realPath
);
int
traceFd
=
open
(
realPath
,
O_RDWR
);
PLUGIN_CHECK
(
traceFd
>=
0
,
return
,
"Failed to open file %s errno %d"
,
workspace
->
buffer
,
errno
);
PLUGIN_CHECK
(
traceFd
>=
0
,
return
,
"Failed to open file %s errno %d"
,
workspace
->
buffer
,
errno
);
ssize_t
bytesWritten
;
ssize_t
bytesWritten
;
...
@@ -421,7 +429,9 @@ static bool MarkOthersClockSync(void)
...
@@ -421,7 +429,9 @@ static bool MarkOthersClockSync(void)
const
float
nanoToSecond
=
1000000000
.
0
f
;
// consistent with the ftrace timestamp format
const
float
nanoToSecond
=
1000000000
.
0
f
;
// consistent with the ftrace timestamp format
PLUGIN_LOGE
(
"MarkOthersClockSync %s"
,
workspace
->
buffer
);
PLUGIN_LOGE
(
"MarkOthersClockSync %s"
,
workspace
->
buffer
);
FILE
*
file
=
fopen
(
workspace
->
buffer
,
"wt+"
);
char
realPath
[
PATH_MAX
]
=
{
0
};
realpath
(
workspace
->
buffer
,
realPath
);
FILE
*
file
=
fopen
(
realPath
,
"wt+"
);
PLUGIN_CHECK
(
file
!=
NULL
,
return
false
,
"Error: opening %s, errno: %d"
,
TRACE_MARKER_PATH
,
errno
);
PLUGIN_CHECK
(
file
!=
NULL
,
return
false
,
"Error: opening %s, errno: %d"
,
TRACE_MARKER_PATH
,
errno
);
do
{
do
{
int64_t
realtime
=
(
int64_t
)((
rts
.
tv_sec
*
nanoSeconds
+
rts
.
tv_nsec
)
/
nanoToMill
);
int64_t
realtime
=
(
int64_t
)((
rts
.
tv_sec
*
nanoSeconds
+
rts
.
tv_nsec
)
/
nanoToMill
);
...
...
ueventd/ueventd_firmware_handler.c
浏览文件 @
d0a1179a
...
@@ -32,8 +32,9 @@ void HandleFimwareDeviceEvent(const struct Uevent *uevent)
...
@@ -32,8 +32,9 @@ void HandleFimwareDeviceEvent(const struct Uevent *uevent)
INIT_LOGE
(
"Failed to build firmware loading path"
);
INIT_LOGE
(
"Failed to build firmware loading path"
);
return
;
return
;
}
}
char
realPath
[
PATH_MAX
]
=
{
0
};
int
fd
=
open
(
fwLoadingPath
,
O_WRONLY
|
O_CLOEXEC
);
realpath
(
fwLoadingPath
,
realPath
);
int
fd
=
open
(
realPath
,
O_WRONLY
|
O_CLOEXEC
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
INIT_LOGE
(
"Failed to open %s, err = %d"
,
fwLoadingPath
,
errno
);
INIT_LOGE
(
"Failed to open %s, err = %d"
,
fwLoadingPath
,
errno
);
return
;
return
;
...
...
watchdog/init_watchdog.c
浏览文件 @
d0a1179a
...
@@ -91,6 +91,9 @@ int main(int argc, const char *argv[])
...
@@ -91,6 +91,9 @@ int main(int argc, const char *argv[])
int
interval
=
0
;
int
interval
=
0
;
if
(
argc
>=
2
)
{
// Argument nums greater than or equal to 2.
if
(
argc
>=
2
)
{
// Argument nums greater than or equal to 2.
interval
=
atoi
(
argv
[
1
]);
interval
=
atoi
(
argv
[
1
]);
if
(
interval
<
0
||
interval
>
INT16_MAX
)
{
interval
=
DEFAULT_INTERVAL
;
}
}
}
interval
=
(
interval
>
0
)
?
interval
:
DEFAULT_INTERVAL
;
interval
=
(
interval
>
0
)
?
interval
:
DEFAULT_INTERVAL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录