Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
033c830d
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
大约 1 年 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
033c830d
编写于
8月 31, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1165 支持命令行显示trigger信息
Merge pull request !1165 from cheng_jinsong/dumptrigger
上级
39764fde
e36489b0
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
57 addition
and
43 deletion
+57
-43
device_info/device_info.cpp
device_info/device_info.cpp
+1
-0
services/begetctl/bootchart_cmd.c
services/begetctl/bootchart_cmd.c
+1
-1
services/begetctl/dump_service.c
services/begetctl/dump_service.c
+20
-8
services/begetctl/init_cmd_reboot.c
services/begetctl/init_cmd_reboot.c
+1
-1
services/begetctl/misc_daemon.cpp
services/begetctl/misc_daemon.cpp
+1
-1
services/begetctl/modulectl.c
services/begetctl/modulectl.c
+1
-1
services/begetctl/param_cmd.c
services/begetctl/param_cmd.c
+2
-2
services/begetctl/partitionslot.cpp
services/begetctl/partitionslot.cpp
+1
-1
services/begetctl/sandbox.cpp
services/begetctl/sandbox.cpp
+1
-1
services/begetctl/service_control.c
services/begetctl/service_control.c
+1
-1
services/begetctl/shell/shell.h
services/begetctl/shell/shell.h
+1
-1
services/begetctl/shell/shell_bas.c
services/begetctl/shell/shell_bas.c
+2
-2
services/init/standard/init_control_fd_service.c
services/init/standard/init_control_fd_service.c
+7
-0
services/param/include/param_utils.h
services/param/include/param_utils.h
+0
-5
services/param/trigger/trigger_manager.c
services/param/trigger/trigger_manager.c
+14
-15
test/moduletest/param_test_cmds.c
test/moduletest/param_test_cmds.c
+2
-2
test/moduletest/syspara.cpp
test/moduletest/syspara.cpp
+1
-1
未找到文件。
device_info/device_info.cpp
浏览文件 @
033c830d
...
...
@@ -30,6 +30,7 @@ int AclGetDevUdid(char *udid, int size)
if
(
udid
==
nullptr
||
size
<
UDID_LEN
)
{
return
-
1
;
}
(
void
)
memset_s
(
udid
,
size
,
0
,
size
);
#ifdef PARAM_FEATURE_DEVICEINFO
std
::
string
result
=
{};
OHOS
::
device_info
::
DeviceInfoKits
&
instance
=
OHOS
::
device_info
::
DeviceInfoKits
::
GetInstance
();
...
...
services/begetctl/bootchart_cmd.c
浏览文件 @
033c830d
...
...
@@ -74,6 +74,6 @@ MODULE_CONSTRUCTOR(void)
{
"bootchart"
,
bootchartCmdStop
,
"bootchart stop"
,
"bootchart stop"
,
"bootchart stop"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/dump_service.c
浏览文件 @
033c830d
...
...
@@ -30,14 +30,17 @@ static int main_cmd(BShellHandle shell, int argc, char **argv)
printf
(
"dump service info
\n
"
);
CmdClientInit
(
INIT_CONTROL_FD_SOCKET_PATH
,
ACTION_DUMP
,
argv
[
1
]);
}
else
if
(
argc
==
DUMP_SERVICE_BOOTEVENT_CMD_ARGS
)
{
printf
(
"dump service bootevent info
\n
"
);
if
(
strcmp
(
argv
[
1
],
"bootevent"
)
==
0
)
{
printf
(
"dump service bootevent info
\n
"
);
}
else
if
(
strcmp
(
argv
[
1
],
"parameter_service"
)
==
0
)
{
printf
(
"dump parameter service info
\n
"
);
}
size_t
serviceNameLen
=
strlen
(
argv
[
1
])
+
strlen
(
argv
[
2
])
+
2
;
// 2 is \0 and #
char
*
serviceBootevent
=
(
char
*
)
calloc
(
1
,
serviceNameLen
);
BEGET_ERROR_CHECK
(
serviceBootevent
!=
NULL
,
return
0
,
"failed to allocate bootevent memory"
);
BEGET_ERROR_CHECK
(
sprintf_s
(
serviceBootevent
,
serviceNameLen
,
"%s#%s"
,
argv
[
1
],
argv
[
2
])
>=
0
,
free
(
serviceBootevent
);
return
0
,
"dumpservice arg create failed"
);
CmdClientInit
(
INIT_CONTROL_FD_SOCKET_PATH
,
ACTION_DUMP
,
serviceBootevent
);
free
(
serviceBootevent
);
char
*
cmd
=
(
char
*
)
calloc
(
1
,
serviceNameLen
);
BEGET_ERROR_CHECK
(
sprintf_s
(
cmd
,
serviceNameLen
,
"%s#%s"
,
argv
[
1
],
argv
[
2
])
>=
0
,
free
(
cmd
);
return
0
,
"dump service arg create failed"
);
CmdClientInit
(
INIT_CONTROL_FD_SOCKET_PATH
,
ACTION_DUMP
,
cmd
);
free
(
cmd
);
}
else
{
BShellCmdHelp
(
shell
,
argc
,
argv
);
}
...
...
@@ -49,17 +52,26 @@ static int ClearBootEvent(BShellHandle shell, int argc, char **argv)
return
SystemSetParameter
(
"ohos.servicectrl.clear"
,
"bootevent"
);
}
static
int
SaveBootEvent
(
BShellHandle
shell
,
int
argc
,
char
**
argv
)
{
return
SystemSetParameter
(
"ohos.servicectrl.save"
,
"bootevent"
);
}
MODULE_CONSTRUCTOR
(
void
)
{
const
CmdInfo
infos
[]
=
{
{
"dump_service"
,
main_cmd
,
"dump one service info by serviceName"
,
"dump_service serviceName"
,
NULL
},
{
"dump_service"
,
main_cmd
,
"dump one service bootevent"
,
"dump_service serviceName bootevent"
,
NULL
},
{
"dump_service"
,
main_cmd
,
"dump all services info"
,
"dump_service all"
,
NULL
},
{
"dump_service"
,
main_cmd
,
"dump parameter-service trigger"
,
"dump_service parameter_service trigger"
,
"dump_service parameter_service trigger"
},
{
"dump_service"
,
main_cmd
,
"dump all services bootevent"
,
"dump_service all bootevent"
,
NULL
},
{
"service"
,
ClearBootEvent
,
"Clear all services bootevent"
,
"service clear bootevent"
,
"service clear bootevent"
},
{
"service"
,
SaveBootEvent
,
"Save all services bootevent"
,
"service save bootevent"
,
"service save bootevent"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/init_cmd_reboot.c
浏览文件 @
033c830d
...
...
@@ -77,6 +77,6 @@ MODULE_CONSTRUCTOR(void)
#endif
};
for
(
size_t
i
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
>
0
;
i
--
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
-
1
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
-
1
]);
}
}
services/begetctl/misc_daemon.cpp
浏览文件 @
033c830d
...
...
@@ -224,6 +224,6 @@ MODULE_CONSTRUCTOR(void)
}
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/modulectl.c
浏览文件 @
033c830d
...
...
@@ -59,6 +59,6 @@ MODULE_CONSTRUCTOR(void)
"modulectl uninstall moduleName"
,
"modulectl uninstall"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/param_cmd.c
浏览文件 @
033c830d
...
...
@@ -435,7 +435,7 @@ static int32_t BShellParamCmdRegForShell(BShellHandle shell)
{
"pwd"
,
BShellParamCmdPwd
,
"display current parameter"
,
"pwd"
,
NULL
},
};
for
(
size_t
i
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
>
0
;
i
--
)
{
BShellEnvRegi
t
sterCmd
(
shell
,
&
infos
[
i
-
1
]);
BShellEnvRegisterCmd
(
shell
,
&
infos
[
i
-
1
]);
}
return
0
;
}
...
...
@@ -451,7 +451,7 @@ static int32_t BShellParamCmdRegForIndepent(BShellHandle shell)
{
"param"
,
BShellParamCmdShell
,
"shell system parameter"
,
"param shell [name]"
,
"param shell"
},
};
for
(
size_t
i
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
>
0
;
i
--
)
{
BShellEnvRegi
t
sterCmd
(
shell
,
&
infos
[
i
-
1
]);
BShellEnvRegisterCmd
(
shell
,
&
infos
[
i
-
1
]);
}
return
0
;
}
...
...
services/begetctl/partitionslot.cpp
浏览文件 @
033c830d
...
...
@@ -108,6 +108,6 @@ MODULE_CONSTRUCTOR(void)
}
};
for
(
size_t
i
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
>
0
;
i
--
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
-
1
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
-
1
]);
}
}
services/begetctl/sandbox.cpp
浏览文件 @
033c830d
...
...
@@ -201,6 +201,6 @@ MODULE_CONSTRUCTOR(void)
}
};
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
infos
);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/service_control.c
浏览文件 @
033c830d
...
...
@@ -76,6 +76,6 @@ MODULE_CONSTRUCTOR(void)
{
"timer_stop"
,
main_cmd
,
"stop service timer"
,
"timer_stop servicename"
,
""
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
services/begetctl/shell/shell.h
浏览文件 @
033c830d
...
...
@@ -93,7 +93,7 @@ int BShellEnvInit(BShellHandle *handle, const BShellInfo *info);
int
BShellEnvStart
(
BShellHandle
handle
);
void
BShellEnvDestory
(
BShellHandle
handle
);
int
BShellEnvRegi
t
sterCmd
(
BShellHandle
handle
,
const
CmdInfo
*
cmdInfo
);
int
BShellEnvRegisterCmd
(
BShellHandle
handle
,
const
CmdInfo
*
cmdInfo
);
int
BShellEnvSetParam
(
BShellHandle
handle
,
const
char
*
name
,
const
char
*
desc
,
BShellParamType
type
,
void
*
value
);
const
BShellParam
*
BShellEnvGetParam
(
BShellHandle
handle
,
const
char
*
name
);
int
BShellEnvRegisterKeyHandle
(
BShellHandle
handle
,
uint8_t
code
,
BShellkeyHandle
keyHandle
);
...
...
services/begetctl/shell/shell_bas.c
浏览文件 @
033c830d
...
...
@@ -436,7 +436,7 @@ int BShellEnvStart(BShellHandle handle)
{
"help"
,
BShellCmdHelp
,
"help command"
,
"help"
}
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
handle
,
&
infos
[
i
]);
BShellEnvRegisterCmd
(
handle
,
&
infos
[
i
]);
}
return
0
;
}
...
...
@@ -500,7 +500,7 @@ void BShellEnvDestory(BShellHandle handle)
free
(
shell
);
}
int32_t
BShellEnvRegi
t
sterCmd
(
BShellHandle
handle
,
const
CmdInfo
*
cmdInfo
)
int32_t
BShellEnvRegisterCmd
(
BShellHandle
handle
,
const
CmdInfo
*
cmdInfo
)
{
BSH_CHECK
(
handle
!=
NULL
,
return
BSH_INVALID_PARAM
,
"Invalid shell env"
);
BSH_CHECK
(
cmdInfo
!=
NULL
&&
cmdInfo
->
name
!=
NULL
,
return
BSH_INVALID_PARAM
,
"Invalid cmd name"
);
...
...
services/init/standard/init_control_fd_service.c
浏览文件 @
033c830d
...
...
@@ -25,6 +25,7 @@
#include "init_utils.h"
#include "init_log.h"
#include "init_group_manager.h"
#include "init_param.h"
#include "hookmgr.h"
#include "bootstage.h"
...
...
@@ -187,6 +188,12 @@ static void ProcessDumpServiceControlFd(uint16_t type, const char *serviceCmd)
}
return
;
}
if
(
strcmp
(
serviceCmd
,
"parameter_service"
)
==
0
)
{
if
(
cmd
!=
NULL
&&
strcmp
(
cmd
,
"trigger"
)
==
0
)
{
SystemDumpTriggers
(
0
);
}
return
;
}
Service
*
service
=
GetServiceByName
(
serviceCmd
);
if
(
service
!=
NULL
)
{
if
(
cmd
!=
NULL
)
{
...
...
services/param/include/param_utils.h
浏览文件 @
033c830d
...
...
@@ -128,12 +128,7 @@ INIT_LOCAL_API void ParamWorBaseLog(InitLogLevel logLevel, uint32_t domain, cons
exper
;
\
}
#ifdef INIT_AGENT
#define PARAM_DUMP printf
#else
#define PARAM_DUMP PARAM_LOGI
#endif
#define MAX_LABEL_LEN 256
#define PARAM_BUFFER_SIZE 256
...
...
services/param/trigger/trigger_manager.c
浏览文件 @
033c830d
...
...
@@ -474,15 +474,15 @@ int CheckTrigger(TriggerWorkSpace *workSpace, int type,
static
void
DumpJobTrigger_
(
const
TriggerWorkSpace
*
workSpace
,
const
TriggerNode
*
trigger
)
{
const
JobNode
*
node
=
(
const
JobNode
*
)
trigger
;
PARAM_DUMP
(
"trigger 0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger
name
%s
\n
"
,
node
->
name
);
PARAM_DUMP
(
"trigger condition %s
\n
"
,
node
->
condition
);
PARAM_DUMP
(
"trigger
flags:
0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger
name:
%s
\n
"
,
node
->
name
);
PARAM_DUMP
(
"trigger condition
:
%s
\n
"
,
node
->
condition
);
const
int
maxCmd
=
1024
;
int
count
=
0
;
CommandNode
*
cmd
=
GetNextCmdNode
(
node
,
NULL
);
while
(
cmd
!=
NULL
&&
count
<
maxCmd
)
{
PARAM_DUMP
(
"
\t
command name
%s
\n
"
,
GetCmdKey
(
cmd
->
cmdKeyIndex
));
PARAM_DUMP
(
"
\t
command args
%s
\n
"
,
cmd
->
content
);
PARAM_DUMP
(
"
command name:
%s
\n
"
,
GetCmdKey
(
cmd
->
cmdKeyIndex
));
PARAM_DUMP
(
"
command args:
%s
\n
"
,
cmd
->
content
);
cmd
=
GetNextCmdNode
(
node
,
cmd
);
count
++
;
}
...
...
@@ -491,19 +491,19 @@ static void DumpJobTrigger_(const TriggerWorkSpace *workSpace, const TriggerNode
static
void
DumpWatchTrigger_
(
const
TriggerWorkSpace
*
workSpace
,
const
TriggerNode
*
trigger
)
{
const
WatchNode
*
node
=
(
const
WatchNode
*
)
trigger
;
PARAM_DUMP
(
"trigger 0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger condition %s
\n
"
,
trigger
->
condition
);
PARAM_DUMP
(
"trigger
watchId
%d
\n
"
,
node
->
watchId
);
PARAM_DUMP
(
"trigger
flags:
0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger condition
:
%s
\n
"
,
trigger
->
condition
);
PARAM_DUMP
(
"trigger
watchId:
%d
\n
"
,
node
->
watchId
);
}
static
void
DumpWaitTrigger_
(
const
TriggerWorkSpace
*
workSpace
,
const
TriggerNode
*
trigger
)
{
const
WaitNode
*
node
=
(
const
WaitNode
*
)
trigger
;
PARAM_DUMP
(
"trigger 0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger
name
%s
\n
"
,
GetTriggerName
(
trigger
));
PARAM_DUMP
(
"trigger condition %s
\n
"
,
trigger
->
condition
);
PARAM_DUMP
(
"trigger
waitId
%d
\n
"
,
node
->
waitId
);
PARAM_DUMP
(
"trigger
timeout
%d
\n
"
,
node
->
timeout
);
PARAM_DUMP
(
"trigger
flags:
0x%08x
\n
"
,
trigger
->
flags
);
PARAM_DUMP
(
"trigger
name:
%s
\n
"
,
GetTriggerName
(
trigger
));
PARAM_DUMP
(
"trigger condition
:
%s
\n
"
,
trigger
->
condition
);
PARAM_DUMP
(
"trigger
waitId:
%d
\n
"
,
node
->
waitId
);
PARAM_DUMP
(
"trigger
timeout:
%d
\n
"
,
node
->
timeout
);
}
static
void
DumpTrigger_
(
const
TriggerWorkSpace
*
workSpace
,
int
type
)
...
...
@@ -522,7 +522,6 @@ void SystemDumpTriggers(int verbose)
{
TriggerWorkSpace
*
workSpace
=
GetTriggerWorkSpace
();
PARAM_CHECK
(
workSpace
!=
NULL
,
return
,
"Invalid workSpace "
);
PARAM_DUMP
(
"Ready to dump all trigger memory
\n
"
);
PARAM_DUMP
(
"workspace queue BOOT info:
\n
"
);
DumpTrigger_
(
workSpace
,
TRIGGER_BOOT
);
PARAM_DUMP
(
"workspace queue parameter info:
\n
"
);
...
...
@@ -540,7 +539,7 @@ void SystemDumpTriggers(int verbose)
for
(
uint32_t
index
=
workSpace
->
executeQueue
.
startIndex
;
index
<
workSpace
->
executeQueue
.
endIndex
;
index
++
)
{
TriggerNode
*
trigger
=
workSpace
->
executeQueue
.
executeQueue
[
index
%
workSpace
->
executeQueue
.
queueCount
];
if
(
trigger
!=
0
)
{
PARAM_DUMP
(
"queue node trigger name: %s
\n
"
,
GetTriggerName
(
trigger
));
PARAM_DUMP
(
"
queue node trigger name: %s
\n
"
,
GetTriggerName
(
trigger
));
}
}
}
...
...
test/moduletest/param_test_cmds.c
浏览文件 @
033c830d
...
...
@@ -164,7 +164,7 @@ int32_t BShellCmdRegister(BShellHandle shell, int execMode)
{
"init"
,
BShellParamCmdGroupTest
,
"init group test"
,
"init group test [stage]"
,
"init group test"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
shell
,
&
infos
[
i
]);
BShellEnvRegisterCmd
(
shell
,
&
infos
[
i
]);
}
}
else
{
const
CmdInfo
infos
[]
=
{
...
...
@@ -177,7 +177,7 @@ int32_t BShellCmdRegister(BShellHandle shell, int execMode)
{
"display"
,
BShellParamCmdUdidGet
,
"display udid"
,
"display udid"
,
"display udid"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
return
0
;
...
...
test/moduletest/syspara.cpp
浏览文件 @
033c830d
...
...
@@ -93,6 +93,6 @@ MODULE_CONSTRUCTOR(void)
{(
char
*
)
"dump"
,
SysParaApiDumpCmd
,
(
char
*
)
"dump api"
,
(
char
*
)
"dump api"
,
(
char
*
)
"dump api"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
i
++
)
{
BShellEnvRegi
t
sterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
BShellEnvRegisterCmd
(
GetShellHandle
(),
&
infos
[
i
]);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录