Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
2868f22f
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看板
提交
2868f22f
编写于
6月 18, 2022
作者:
N
Neil Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix invalid type in OAT.xml and other typos
Signed-off-by:
N
Neil Chen
<
jingsi.chen@petalmail.com
>
上级
5cde4ec3
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
70 addition
and
70 deletion
+70
-70
OAT.xml
OAT.xml
+1
-1
interfaces/innerkits/control_fd/control_fd_client.c
interfaces/innerkits/control_fd/control_fd_client.c
+1
-1
interfaces/innerkits/control_fd/control_fd_service.c
interfaces/innerkits/control_fd/control_fd_service.c
+2
-2
interfaces/innerkits/fd_holder/fd_holder_internal.c
interfaces/innerkits/fd_holder/fd_holder_internal.c
+3
-3
interfaces/innerkits/sandbox/sandbox.c
interfaces/innerkits/sandbox/sandbox.c
+1
-1
interfaces/kits/jskits/src/native_parameters_watch.cpp
interfaces/kits/jskits/src/native_parameters_watch.cpp
+3
-3
services/begetctl/param_cmd.c
services/begetctl/param_cmd.c
+1
-1
services/begetctl/sandbox.cpp
services/begetctl/sandbox.cpp
+2
-2
services/begetctl/shell/shell_bas.c
services/begetctl/shell/shell_bas.c
+2
-2
services/begetctl/shell/shell_main.c
services/begetctl/shell/shell_main.c
+1
-1
services/init/init_common_cmds.c
services/init/init_common_cmds.c
+3
-3
services/init/init_common_service.c
services/init/init_common_service.c
+4
-4
services/init/init_service_manager.c
services/init/init_service_manager.c
+2
-2
services/init/init_service_socket.c
services/init/init_service_socket.c
+1
-1
services/init/standard/fd_holder_service.c
services/init/standard/fd_holder_service.c
+2
-2
services/init/standard/init.c
services/init/standard/init.c
+2
-2
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+2
-2
services/init/standard/init_control_fd_service.c
services/init/standard/init_control_fd_service.c
+1
-1
services/param/adapter/param_dac.c
services/param/adapter/param_dac.c
+2
-2
services/param/linux/param_service.c
services/param/linux/param_service.c
+2
-2
services/param/liteos/param_client.c
services/param/liteos/param_client.c
+2
-2
services/param/liteos/param_hal.c
services/param/liteos/param_hal.c
+2
-2
services/param/liteos/param_service.c
services/param/liteos/param_service.c
+1
-1
services/param/manager/param_server.c
services/param/manager/param_server.c
+1
-1
services/utils/init_utils.c
services/utils/init_utils.c
+2
-2
services/utils/list.c
services/utils/list.c
+1
-1
test/exec_test/sa_service_ondemand_test.cpp
test/exec_test/sa_service_ondemand_test.cpp
+2
-2
test/unittest/init/sandbox_unittest.cpp
test/unittest/init/sandbox_unittest.cpp
+2
-2
test/unittest/lite/cmd_func_test.cpp
test/unittest/lite/cmd_func_test.cpp
+2
-2
test/unittest/param/param_stub.cpp
test/unittest/param/param_stub.cpp
+3
-3
test/unittest/param/paramservice_unittest.cpp
test/unittest/param/paramservice_unittest.cpp
+3
-3
test/unittest/syspara/syspara_unittest.cpp
test/unittest/syspara/syspara_unittest.cpp
+1
-1
test/unittest/test_data/system/etc/param/ohos.para.dac
test/unittest/test_data/system/etc/param/ohos.para.dac
+2
-2
test/unittest/test_data/system/etc/param/ohos.para.selinux
test/unittest/test_data/system/etc/param/ohos.para.selinux
+2
-2
test/unittest/tools/prepare_testdata.sh
test/unittest/tools/prepare_testdata.sh
+1
-1
ueventd/ueventd.c
ueventd/ueventd.c
+2
-2
ueventd/ueventd_device_handler.c
ueventd/ueventd_device_handler.c
+1
-1
ueventd/ueventd_read_cfg.c
ueventd/ueventd_read_cfg.c
+1
-1
ueventd/ueventd_socket.c
ueventd/ueventd_socket.c
+1
-1
未找到文件。
OAT.xml
浏览文件 @
2868f22f
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
<filteritem
type=
"filname"
name=
"*.jpg|*.png|*.gif|*.pdf"
desc=
"already checked"
/>
<filteritem
type=
"fil
e
name"
name=
"*.jpg|*.png|*.gif|*.pdf"
desc=
"already checked"
/>
<filteritem
type=
"filepath"
name=
"services/test/unittest/test_data/proc/*"
desc=
"启动功能UT测试的资源文件"
/>
<filteritem
type=
"filepath"
name=
"services/test/unittest/test_data/proc/*"
desc=
"启动功能UT测试的资源文件"
/>
</filefilter>
</filefilter>
...
...
interfaces/innerkits/control_fd/control_fd_client.c
浏览文件 @
2868f22f
...
@@ -43,7 +43,7 @@ static void ProcessFifoWrite(const WatcherHandle taskHandle, int fd, uint32_t *e
...
@@ -43,7 +43,7 @@ static void ProcessFifoWrite(const WatcherHandle taskHandle, int fd, uint32_t *e
}
}
int
fifow
=
*
((
int
*
)
context
);
int
fifow
=
*
((
int
*
)
context
);
if
(
fifow
<
0
)
{
if
(
fifow
<
0
)
{
BEGET_LOGE
(
"[control_fd] inva
il
d fifo write fd"
);
BEGET_LOGE
(
"[control_fd] inva
li
d fifo write fd"
);
return
;
return
;
}
}
char
rbuf
[
FIFO_BUF_SIZE
]
=
{
0
};
char
rbuf
[
FIFO_BUF_SIZE
]
=
{
0
};
...
...
interfaces/innerkits/control_fd/control_fd_service.c
浏览文件 @
2868f22f
...
@@ -95,7 +95,7 @@ static void CmdOnRecvMessage(const TaskHandle task, const uint8_t *buffer, uint3
...
@@ -95,7 +95,7 @@ static void CmdOnRecvMessage(const TaskHandle task, const uint8_t *buffer, uint3
static
int
SendMessage
(
LoopHandle
loop
,
TaskHandle
task
,
const
char
*
message
)
static
int
SendMessage
(
LoopHandle
loop
,
TaskHandle
task
,
const
char
*
message
)
{
{
if
(
message
==
NULL
)
{
if
(
message
==
NULL
)
{
BEGET_LOGE
(
"[control_fd] Inva
il
d parameter"
);
BEGET_LOGE
(
"[control_fd] Inva
li
d parameter"
);
return
-
1
;
return
-
1
;
}
}
BufferHandle
handle
=
NULL
;
BufferHandle
handle
=
NULL
;
...
@@ -135,7 +135,7 @@ static int CmdOnIncommingConntect(const LoopHandle loop, const TaskHandle server
...
@@ -135,7 +135,7 @@ static int CmdOnIncommingConntect(const LoopHandle loop, const TaskHandle server
void
CmdServiceInit
(
const
char
*
socketPath
,
CallbackControlFdProcess
func
)
void
CmdServiceInit
(
const
char
*
socketPath
,
CallbackControlFdProcess
func
)
{
{
if
((
socketPath
==
NULL
)
||
(
func
==
NULL
))
{
if
((
socketPath
==
NULL
)
||
(
func
==
NULL
))
{
BEGET_LOGE
(
"[control_fd] Inva
il
d parameter"
);
BEGET_LOGE
(
"[control_fd] Inva
li
d parameter"
);
return
;
return
;
}
}
LE_StreamServerInfo
info
=
{};
LE_StreamServerInfo
info
=
{};
...
...
interfaces/innerkits/fd_holder/fd_holder_internal.c
浏览文件 @
2868f22f
...
@@ -55,7 +55,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
...
@@ -55,7 +55,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
cmsg
->
cmsg_len
=
CMSG_LEN
(
sizeof
(
int
)
*
fdCount
);
cmsg
->
cmsg_len
=
CMSG_LEN
(
sizeof
(
int
)
*
fdCount
);
int
ret
=
memcpy_s
(
CMSG_DATA
(
cmsg
),
cmsg
->
cmsg_len
,
fds
,
sizeof
(
int
)
*
fdCount
);
int
ret
=
memcpy_s
(
CMSG_DATA
(
cmsg
),
cmsg
->
cmsg_len
,
fds
,
sizeof
(
int
)
*
fdCount
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
BEGET_LOGE
(
"Control
l
message is not valid"
);
BEGET_LOGE
(
"Control message is not valid"
);
free
(
msghdr
->
msg_control
);
free
(
msghdr
->
msg_control
);
return
-
1
;
return
-
1
;
}
}
...
@@ -65,7 +65,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
...
@@ -65,7 +65,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
if
(
sendUcred
)
{
if
(
sendUcred
)
{
if
(
cmsg
==
NULL
)
{
if
(
cmsg
==
NULL
)
{
BEGET_LOGE
(
"Control
l
message is not valid"
);
BEGET_LOGE
(
"Control message is not valid"
);
free
(
msghdr
->
msg_control
);
free
(
msghdr
->
msg_control
);
return
-
1
;
return
-
1
;
}
}
...
@@ -106,7 +106,7 @@ int *ReceiveFds(int sock, struct iovec iovec, size_t *outFdCount, bool nonblock,
...
@@ -106,7 +106,7 @@ int *ReceiveFds(int sock, struct iovec iovec, size_t *outFdCount, bool nonblock,
BEGET_ERROR_CHECK
(
rc
>=
0
,
return
NULL
,
"Failed to get fds from remote, err = %d"
,
errno
);
BEGET_ERROR_CHECK
(
rc
>=
0
,
return
NULL
,
"Failed to get fds from remote, err = %d"
,
errno
);
if
((
msghdr
.
msg_flags
)
&
MSG_TRUNC
)
{
if
((
msghdr
.
msg_flags
)
&
MSG_TRUNC
)
{
BEGET_LOGE
(
"Message was trucated when receiving fds"
);
BEGET_LOGE
(
"Message was tru
n
cated when receiving fds"
);
return
NULL
;
return
NULL
;
}
}
...
...
interfaces/innerkits/sandbox/sandbox.c
浏览文件 @
2868f22f
...
@@ -231,7 +231,7 @@ static int GetSandboxInfo(sandbox_t *sandbox, cJSON *root, const char *itemName)
...
@@ -231,7 +231,7 @@ static int GetSandboxInfo(sandbox_t *sandbox, cJSON *root, const char *itemName)
static
int
ParseSandboxConfig
(
cJSON
*
root
,
sandbox_t
*
sandbox
)
static
int
ParseSandboxConfig
(
cJSON
*
root
,
sandbox_t
*
sandbox
)
{
{
BEGET_ERROR_CHECK
(
!
(
root
==
NULL
||
sandbox
==
NULL
),
return
-
1
,
"Inva
il
d parameter."
);
BEGET_ERROR_CHECK
(
!
(
root
==
NULL
||
sandbox
==
NULL
),
return
-
1
,
"Inva
li
d parameter."
);
cJSON
*
sandboxRoot
=
cJSON_GetObjectItem
(
root
,
SANDBOX_ROOT_TAG
);
cJSON
*
sandboxRoot
=
cJSON_GetObjectItem
(
root
,
SANDBOX_ROOT_TAG
);
BEGET_ERROR_CHECK
(
sandboxRoot
!=
NULL
,
return
-
1
,
BEGET_ERROR_CHECK
(
sandboxRoot
!=
NULL
,
return
-
1
,
...
...
interfaces/kits/jskits/src/native_parameters_watch.cpp
浏览文件 @
2868f22f
...
@@ -232,7 +232,7 @@ static void AddWatcherCallback(ParamWatcherPtr watcher, napi_ref callbackRef)
...
@@ -232,7 +232,7 @@ static void AddWatcherCallback(ParamWatcherPtr watcher, napi_ref callbackRef)
static
void
DelWatcherCallback
(
ParamWatcherPtr
watcher
,
uint32_t
next
)
static
void
DelWatcherCallback
(
ParamWatcherPtr
watcher
,
uint32_t
next
)
{
{
PARAM_JS_LOGV
(
"JSApp watcher key %s delete callack %u"
,
watcher
->
keyPrefix
,
next
);
PARAM_JS_LOGV
(
"JSApp watcher key %s delete call
b
ack %u"
,
watcher
->
keyPrefix
,
next
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
watcher
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
watcher
->
mutex
);
watcher
->
callbackReferences
.
erase
(
next
);
watcher
->
callbackReferences
.
erase
(
next
);
}
}
...
@@ -490,7 +490,7 @@ static napi_value SwithWatchOn(napi_env env, napi_callback_info info)
...
@@ -490,7 +490,7 @@ static napi_value SwithWatchOn(napi_env env, napi_callback_info info)
{
{
napi_value
callback
=
nullptr
;
napi_value
callback
=
nullptr
;
ParamWatcherPtr
watcher
=
GetWatcherInfo
(
env
,
info
,
&
callback
);
ParamWatcherPtr
watcher
=
GetWatcherInfo
(
env
,
info
,
&
callback
);
PARAM_JS_CHECK
(
watcher
!=
nullptr
,
return
GetNapiValue
(
env
,
-
1
),
"Failed to get watcher swith param"
);
PARAM_JS_CHECK
(
watcher
!=
nullptr
,
return
GetNapiValue
(
env
,
-
1
),
"Failed to get watcher swit
c
h param"
);
if
(
CheckCallbackEqual
(
env
,
callback
,
watcher
))
{
if
(
CheckCallbackEqual
(
env
,
callback
,
watcher
))
{
PARAM_JS_LOGE
(
"JSApp watcher repeater switch on %s"
,
watcher
->
keyPrefix
);
PARAM_JS_LOGE
(
"JSApp watcher repeater switch on %s"
,
watcher
->
keyPrefix
);
...
@@ -553,4 +553,4 @@ napi_value RegisterWatcher(napi_env env, napi_value exports)
...
@@ -553,4 +553,4 @@ napi_value RegisterWatcher(napi_env env, napi_value exports)
napi_set_named_property
(
env
,
exports
,
"paramWatcher"
,
result
);
napi_set_named_property
(
env
,
exports
,
"paramWatcher"
,
result
);
napi_create_reference
(
env
,
result
,
1
,
&
g_paramWatchRef
);
napi_create_reference
(
env
,
result
,
1
,
&
g_paramWatchRef
);
return
exports
;
return
exports
;
}
}
\ No newline at end of file
services/begetctl/param_cmd.c
浏览文件 @
2868f22f
...
@@ -158,7 +158,7 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value)
...
@@ -158,7 +158,7 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value)
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
int
ret
=
GetParamSecurityAuditData
(
name
,
0
,
&
auditData
);
int
ret
=
GetParamSecurityAuditData
(
name
,
0
,
&
auditData
);
BSH_CHECK
(
ret
==
0
,
return
,
"Failed to get param security for %s"
,
name
);
BSH_CHECK
(
ret
==
0
,
return
,
"Failed to get param security for %s"
,
name
);
BShellEnvOutput
(
shell
,
"Parameter infomation:
\r\n
"
);
BShellEnvOutput
(
shell
,
"Parameter info
r
mation:
\r\n
"
);
#ifdef PARAM_SUPPORT_SELINUX
#ifdef PARAM_SUPPORT_SELINUX
BShellEnvOutput
(
shell
,
"selinux : %s
\r\n
"
,
auditData
.
label
);
BShellEnvOutput
(
shell
,
"selinux : %s
\r\n
"
,
auditData
.
label
);
#endif
#endif
...
...
services/begetctl/sandbox.cpp
浏览文件 @
2868f22f
...
@@ -170,10 +170,10 @@ static int main_cmd(BShellHandle shell, int argc, char **argv)
...
@@ -170,10 +170,10 @@ static int main_cmd(BShellHandle shell, int argc, char **argv)
processName
=
optarg
;
processName
=
optarg
;
break
;
break
;
case
'?'
:
case
'?'
:
std
::
cout
<<
"Invalid ar
ug
ment
\n
"
;
std
::
cout
<<
"Invalid ar
gu
ment
\n
"
;
break
;
break
;
default:
default:
std
::
cout
<<
"Invalid ar
ug
ment
\n
"
;
std
::
cout
<<
"Invalid ar
gu
ment
\n
"
;
break
;
break
;
}
}
}
}
...
...
services/begetctl/shell/shell_bas.c
浏览文件 @
2868f22f
...
@@ -720,7 +720,7 @@ const ParamInfo *BShellEnvGetReservedParam(BShellHandle handle, const char *name
...
@@ -720,7 +720,7 @@ const ParamInfo *BShellEnvGetReservedParam(BShellHandle handle, const char *name
{
{
BSH_CHECK
(
handle
!=
NULL
,
return
NULL
,
"Invalid shell env"
);
BSH_CHECK
(
handle
!=
NULL
,
return
NULL
,
"Invalid shell env"
);
static
ParamInfo
reservedParams
[]
=
{
static
ParamInfo
reservedParams
[]
=
{
{
PARAM_REVERESD_NAME_CURR_PARAMETER
,
"current param
a
ter"
,
PARAM_STRING
}
{
PARAM_REVERESD_NAME_CURR_PARAMETER
,
"current param
e
ter"
,
PARAM_STRING
}
};
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
reservedParams
)
/
sizeof
(
reservedParams
[
0
]);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
reservedParams
)
/
sizeof
(
reservedParams
[
0
]);
i
++
)
{
if
(
strcmp
(
name
,
reservedParams
[
i
].
name
)
==
0
)
{
if
(
strcmp
(
name
,
reservedParams
[
i
].
name
)
==
0
)
{
...
@@ -744,4 +744,4 @@ int32_t BShellEnvDirectExecute(BShellHandle handle, int argc, char *args[])
...
@@ -744,4 +744,4 @@ int32_t BShellEnvDirectExecute(BShellHandle handle, int argc, char *args[])
BShellCmdHelp
(
handle
,
argc
,
args
);
BShellCmdHelp
(
handle
,
argc
,
args
);
}
}
return
0
;
return
0
;
}
}
\ No newline at end of file
services/begetctl/shell/shell_main.c
浏览文件 @
2868f22f
...
@@ -72,7 +72,7 @@ int main(int argc, char *args[])
...
@@ -72,7 +72,7 @@ int main(int argc, char *args[])
return
0
;
return
0
;
}
}
const
ParamInfo
*
param
=
BShellEnvGetReservedParam
(
handle
,
PARAM_REVERESD_NAME_CURR_PARAMETER
);
const
ParamInfo
*
param
=
BShellEnvGetReservedParam
(
handle
,
PARAM_REVERESD_NAME_CURR_PARAMETER
);
BSH_CHECK
(
param
!=
NULL
&&
param
->
type
==
PARAM_STRING
,
break
,
"Failed to get revered param"
);
BSH_CHECK
(
param
!=
NULL
&&
param
->
type
==
PARAM_STRING
,
break
,
"Failed to get rever
s
ed param"
);
BShellEnvSetParam
(
handle
,
param
->
name
,
param
->
desc
,
param
->
type
,
(
void
*
)
""
);
BShellEnvSetParam
(
handle
,
param
->
name
,
param
->
desc
,
param
->
type
,
(
void
*
)
""
);
if
(
argc
>
1
)
{
if
(
argc
>
1
)
{
int
ret
=
SetParamShellPrompt
(
handle
,
args
[
1
]);
int
ret
=
SetParamShellPrompt
(
handle
,
args
[
1
]);
...
...
services/init/init_common_cmds.c
浏览文件 @
2868f22f
...
@@ -173,7 +173,7 @@ static void DoSleep(const struct CmdArgs *ctx)
...
@@ -173,7 +173,7 @@ static void DoSleep(const struct CmdArgs *ctx)
{
{
errno
=
0
;
errno
=
0
;
unsigned
long
sleepTime
=
strtoul
(
ctx
->
argv
[
0
],
NULL
,
DECIMAL_BASE
);
unsigned
long
sleepTime
=
strtoul
(
ctx
->
argv
[
0
],
NULL
,
DECIMAL_BASE
);
INIT_ERROR_CHECK
(
errno
==
0
,
return
,
"cannot covert sleep time in command
\"
sleep
\"
"
);
INIT_ERROR_CHECK
(
errno
==
0
,
return
,
"cannot co
n
vert sleep time in command
\"
sleep
\"
"
);
// Limit sleep time in 5 seconds
// Limit sleep time in 5 seconds
const
unsigned
long
sleepTimeLimit
=
5
;
const
unsigned
long
sleepTimeLimit
=
5
;
...
@@ -192,7 +192,7 @@ static void DoWait(const struct CmdArgs *ctx)
...
@@ -192,7 +192,7 @@ static void DoWait(const struct CmdArgs *ctx)
errno
=
0
;
errno
=
0
;
waitSecond
=
strtoul
(
ctx
->
argv
[
timePos
],
NULL
,
DECIMAL_BASE
);
waitSecond
=
strtoul
(
ctx
->
argv
[
timePos
],
NULL
,
DECIMAL_BASE
);
INIT_ERROR_CHECK
(
errno
==
0
,
INIT_ERROR_CHECK
(
errno
==
0
,
return
,
"cannot covert sleep time in command
\"
wait
\"
"
);
return
,
"cannot co
n
vert sleep time in command
\"
wait
\"
"
);
}
}
INIT_LOGI
(
"Waiting %s %lu second(s)"
,
ctx
->
argv
[
filePos
],
waitSecond
);
INIT_LOGI
(
"Waiting %s %lu second(s)"
,
ctx
->
argv
[
filePos
],
waitSecond
);
...
@@ -548,7 +548,7 @@ static void DoSetrlimit(const struct CmdArgs *ctx)
...
@@ -548,7 +548,7 @@ static void DoSetrlimit(const struct CmdArgs *ctx)
}
}
}
}
if
(
rcs
==
-
1
)
{
if
(
rcs
==
-
1
)
{
INIT_LOGE
(
"DoSetrlimit failed, resouces :%s not support."
,
ctx
->
argv
[
0
]);
INIT_LOGE
(
"DoSetrlimit failed, resou
r
ces :%s not support."
,
ctx
->
argv
[
0
]);
return
;
return
;
}
}
INIT_CHECK_ONLY_ELOG
(
setrlimit
(
rcs
,
&
limit
)
==
0
,
"DoSetrlimit failed : %d"
,
errno
);
INIT_CHECK_ONLY_ELOG
(
setrlimit
(
rcs
,
&
limit
)
==
0
,
"DoSetrlimit failed : %d"
,
errno
);
...
...
services/init/init_common_service.c
浏览文件 @
2868f22f
...
@@ -106,13 +106,13 @@ static int SetPerms(const Service *service)
...
@@ -106,13 +106,13 @@ static int SetPerms(const Service *service)
}
}
INIT_ERROR_CHECK
(
capset
(
&
capHeader
,
capData
)
==
0
,
return
SERVICE_FAILURE
,
INIT_ERROR_CHECK
(
capset
(
&
capHeader
,
capData
)
==
0
,
return
SERVICE_FAILURE
,
"capset faild for service: %s, error: %d"
,
service
->
name
,
errno
);
"capset fail
e
d for service: %s, error: %d"
,
service
->
name
,
errno
);
for
(
unsigned
int
i
=
0
;
i
<
service
->
servPerm
.
capsCnt
;
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
service
->
servPerm
.
capsCnt
;
++
i
)
{
if
(
service
->
servPerm
.
caps
[
i
]
==
FULL_CAP
)
{
if
(
service
->
servPerm
.
caps
[
i
]
==
FULL_CAP
)
{
return
SetAllAmbientCapability
();
return
SetAllAmbientCapability
();
}
}
INIT_ERROR_CHECK
(
SetAmbientCapability
(
service
->
servPerm
.
caps
[
i
])
==
0
,
return
SERVICE_FAILURE
,
INIT_ERROR_CHECK
(
SetAmbientCapability
(
service
->
servPerm
.
caps
[
i
])
==
0
,
return
SERVICE_FAILURE
,
"SetAmbientCapability faild for service: %s"
,
service
->
name
);
"SetAmbientCapability fail
e
d for service: %s"
,
service
->
name
);
}
}
return
SERVICE_SUCCESS
;
return
SERVICE_SUCCESS
;
}
}
...
@@ -267,7 +267,7 @@ static void ClearEnvironment(Service *service)
...
@@ -267,7 +267,7 @@ static void ClearEnvironment(Service *service)
static
int
InitServicePropertys
(
Service
*
service
)
static
int
InitServicePropertys
(
Service
*
service
)
{
{
INIT_ERROR_CHECK
(
service
!=
NULL
,
return
-
1
,
"Inva
il
d parameter."
);
INIT_ERROR_CHECK
(
service
!=
NULL
,
return
-
1
,
"Inva
li
d parameter."
);
SetServiceEnterSandbox
(
service
->
pathArgs
.
argv
[
0
],
service
->
attribute
);
SetServiceEnterSandbox
(
service
->
pathArgs
.
argv
[
0
],
service
->
attribute
);
INIT_CHECK_ONLY_ELOG
(
SetAccessToken
(
service
)
==
SERVICE_SUCCESS
,
"access token failed %s"
,
service
->
name
);
INIT_CHECK_ONLY_ELOG
(
SetAccessToken
(
service
)
==
SERVICE_SUCCESS
,
"access token failed %s"
,
service
->
name
);
// deal start job
// deal start job
...
@@ -427,7 +427,7 @@ static void CheckServiceSocket(Service *service)
...
@@ -427,7 +427,7 @@ static void CheckServiceSocket(Service *service)
ServiceSocket
*
tmpSock
=
service
->
socketCfg
;
ServiceSocket
*
tmpSock
=
service
->
socketCfg
;
while
(
tmpSock
!=
NULL
)
{
while
(
tmpSock
!=
NULL
)
{
if
(
tmpSock
->
sockFd
<=
0
)
{
if
(
tmpSock
->
sockFd
<=
0
)
{
INIT_LOGE
(
"Invaid socket %s for service"
,
service
->
name
);
INIT_LOGE
(
"Inva
l
id socket %s for service"
,
service
->
name
);
tmpSock
=
tmpSock
->
next
;
tmpSock
=
tmpSock
->
next
;
}
}
SocketAddWatcher
(
&
tmpSock
->
watcher
,
service
,
tmpSock
->
sockFd
);
SocketAddWatcher
(
&
tmpSock
->
watcher
,
service
,
tmpSock
->
sockFd
);
...
...
services/init/init_service_manager.c
浏览文件 @
2868f22f
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
# include "init_selinux_param.h"
# include "init_selinux_param.h"
#endif // WITH_SELINUX
#endif // WITH_SELINUX
// All ser
iv
ce processes that init will fork+exec.
// All ser
vi
ce processes that init will fork+exec.
static
ServiceSpace
g_serviceSpace
=
{
0
};
static
ServiceSpace
g_serviceSpace
=
{
0
};
static
const
int
CRITICAL_DEFAULT_CRASH_TIME
=
20
;
static
const
int
CRITICAL_DEFAULT_CRASH_TIME
=
20
;
// maximum number of crashes within time CRITICAL_DEFAULT_CRASH_TIME for one service
// maximum number of crashes within time CRITICAL_DEFAULT_CRASH_TIME for one service
...
@@ -1042,7 +1042,7 @@ void StartAllServices(int startMode)
...
@@ -1042,7 +1042,7 @@ void StartAllServices(int startMode)
}
}
node
=
GetNextGroupNode
(
NODE_TYPE_SERVICES
,
node
);
node
=
GetNextGroupNode
(
NODE_TYPE_SERVICES
,
node
);
}
}
INIT_LOGI
(
"StartAllServices %d finsh"
,
startMode
);
INIT_LOGI
(
"StartAllServices %d fin
i
sh"
,
startMode
);
}
}
void
LoadAccessTokenId
(
void
)
void
LoadAccessTokenId
(
void
)
...
...
services/init/init_service_socket.c
浏览文件 @
2868f22f
...
@@ -52,7 +52,7 @@ static int SetSocketAddr(ServiceSocket *sockopt, sockaddr_union *addr)
...
@@ -52,7 +52,7 @@ static int SetSocketAddr(ServiceSocket *sockopt, sockaddr_union *addr)
if
(
sockopt
->
family
==
AF_NETLINK
)
{
if
(
sockopt
->
family
==
AF_NETLINK
)
{
#ifndef __LITEOS_A__
#ifndef __LITEOS_A__
if
(
memset_s
(
&
(
addr
->
addrnl
),
sizeof
(
addr
->
addrnl
),
0
,
sizeof
(
addr
->
addrnl
))
!=
EOK
)
{
if
(
memset_s
(
&
(
addr
->
addrnl
),
sizeof
(
addr
->
addrnl
),
0
,
sizeof
(
addr
->
addrnl
))
!=
EOK
)
{
INIT_LOGE
(
"Faild to clear socket address"
);
INIT_LOGE
(
"Fail
e
d to clear socket address"
);
return
-
1
;
return
-
1
;
}
}
addr
->
addrnl
.
nl_family
=
AF_NETLINK
;
addr
->
addrnl
.
nl_family
=
AF_NETLINK
;
...
...
services/init/standard/fd_holder_service.c
浏览文件 @
2868f22f
...
@@ -116,7 +116,7 @@ static void SendFdsInfo(int sock, Service *service)
...
@@ -116,7 +116,7 @@ static void SendFdsInfo(int sock, Service *service)
};
};
if
(
BuildControlMessage
(
&
msghdr
,
service
->
fds
,
service
->
fdCount
,
false
)
<
0
)
{
if
(
BuildControlMessage
(
&
msghdr
,
service
->
fds
,
service
->
fdCount
,
false
)
<
0
)
{
SendErrorInfo
(
sock
,
"Faild to build send message"
,
service
->
name
);
SendErrorInfo
(
sock
,
"Fail
e
d to build send message"
,
service
->
name
);
}
else
{
}
else
{
if
(
TEMP_FAILURE_RETRY
(
sendmsg
(
sock
,
&
msghdr
,
MSG_NOSIGNAL
))
<
0
)
{
if
(
TEMP_FAILURE_RETRY
(
sendmsg
(
sock
,
&
msghdr
,
MSG_NOSIGNAL
))
<
0
)
{
INIT_LOGE
(
"Failed to send fd info to service
\'
%s
\'
, err = %d"
,
service
->
name
,
errno
);
INIT_LOGE
(
"Failed to send fd info to service
\'
%s
\'
, err = %d"
,
service
->
name
,
errno
);
...
@@ -220,7 +220,7 @@ static void HandlerFdHolder(int sock)
...
@@ -220,7 +220,7 @@ static void HandlerFdHolder(int sock)
// In this case, ignore fds, just close them if fd passed to init
// In this case, ignore fds, just close them if fd passed to init
HandlerGetFds
(
sock
,
service
);
HandlerGetFds
(
sock
,
service
);
}
else
{
}
else
{
INIT_LOGE
(
"Unexpect action: %s"
,
action
);
INIT_LOGE
(
"Unexpect
ed
action: %s"
,
action
);
}
}
FreeFds
(
fds
);
FreeFds
(
fds
);
CloseFds
(
fds
,
fdCount
);
CloseFds
(
fds
,
fdCount
);
...
...
services/init/standard/init.c
浏览文件 @
2868f22f
...
@@ -74,7 +74,7 @@ static int FdHolderSockInit(void)
...
@@ -74,7 +74,7 @@ static int FdHolderSockInit(void)
addr
.
sun_family
=
AF_UNIX
;
addr
.
sun_family
=
AF_UNIX
;
if
(
strncpy_s
(
addr
.
sun_path
,
sizeof
(
addr
.
sun_path
),
if
(
strncpy_s
(
addr
.
sun_path
,
sizeof
(
addr
.
sun_path
),
INIT_HOLDER_SOCKET_PATH
,
strlen
(
INIT_HOLDER_SOCKET_PATH
))
!=
0
)
{
INIT_HOLDER_SOCKET_PATH
,
strlen
(
INIT_HOLDER_SOCKET_PATH
))
!=
0
)
{
INIT_LOGE
(
"Faild to copy fd hoder socket path"
);
INIT_LOGE
(
"Fail
e
d to copy fd hoder socket path"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -193,7 +193,7 @@ static void StartInitSecondStage(void)
...
@@ -193,7 +193,7 @@ static void StartInitSecondStage(void)
// If mount required partitions failure.
// If mount required partitions failure.
// There is no necessary to continue.
// There is no necessary to continue.
// Just abort
// Just abort
INIT_LOGE
(
"Mount requ
ri
ed partitions failed; please check fstab file"
);
INIT_LOGE
(
"Mount requ
ir
ed partitions failed; please check fstab file"
);
// Execute sh for debugging
// Execute sh for debugging
execv
(
"/bin/sh"
,
NULL
);
execv
(
"/bin/sh"
,
NULL
);
abort
();
abort
();
...
...
services/init/standard/init_cmds.c
浏览文件 @
2868f22f
...
@@ -377,7 +377,7 @@ static void DoTimerStart(const struct CmdArgs *ctx)
...
@@ -377,7 +377,7 @@ static void DoTimerStart(const struct CmdArgs *ctx)
}
}
if
(
count
!=
expectedCount
)
{
if
(
count
!=
expectedCount
)
{
INIT_LOGE
(
"Call timer_start with unexpect arguments %s"
,
arg
);
INIT_LOGE
(
"Call timer_start with unexpect
ed
arguments %s"
,
arg
);
FreeStringVector
(
splitArgs
,
count
);
FreeStringVector
(
splitArgs
,
count
);
return
;
return
;
}
}
...
@@ -515,7 +515,7 @@ static void DoMkSandbox(const struct CmdArgs *ctx)
...
@@ -515,7 +515,7 @@ static void DoMkSandbox(const struct CmdArgs *ctx)
const
char
*
sandbox
=
ctx
->
argv
[
0
];
const
char
*
sandbox
=
ctx
->
argv
[
0
];
if
(
sandbox
==
NULL
)
{
if
(
sandbox
==
NULL
)
{
INIT_LOGE
(
"Inva
il
d sandbox name."
);
INIT_LOGE
(
"Inva
li
d sandbox name."
);
return
;
return
;
}
}
InitDefaultNamespace
();
InitDefaultNamespace
();
...
...
services/init/standard/init_control_fd_service.c
浏览文件 @
2868f22f
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
static
void
ProcessSandboxControlFd
(
uint16_t
type
,
const
char
*
serviceCmd
)
static
void
ProcessSandboxControlFd
(
uint16_t
type
,
const
char
*
serviceCmd
)
{
{
if
((
type
!=
ACTION_SANDBOX
)
||
(
serviceCmd
==
NULL
))
{
if
((
type
!=
ACTION_SANDBOX
)
||
(
serviceCmd
==
NULL
))
{
INIT_LOGE
(
"Inva
il
d parameter"
);
INIT_LOGE
(
"Inva
li
d parameter"
);
return
;
return
;
}
}
Service
*
service
=
GetServiceByName
(
serviceCmd
);
Service
*
service
=
GetServiceByName
(
serviceCmd
);
...
...
services/param/adapter/param_dac.c
浏览文件 @
2868f22f
...
@@ -118,7 +118,7 @@ static int LoadParamLabels(const char *fileName)
...
@@ -118,7 +118,7 @@ static int LoadParamLabels(const char *fileName)
buff
[
buffSize
-
1
]
=
'\0'
;
buff
[
buffSize
-
1
]
=
'\0'
;
int
ret
=
SpliteString
(
buff
,
NULL
,
0
,
LoadOneParam_
,
NULL
);
int
ret
=
SpliteString
(
buff
,
NULL
,
0
,
LoadOneParam_
,
NULL
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
PARAM_LOGE
(
"Failed to split
e
string %s fileName %s"
,
buff
,
fileName
);
PARAM_LOGE
(
"Failed to split string %s fileName %s"
,
buff
,
fileName
);
continue
;
continue
;
}
}
infoCount
++
;
infoCount
++
;
...
@@ -298,4 +298,4 @@ INIT_LOCAL_API void LoadGroupUser(void)
...
@@ -298,4 +298,4 @@ INIT_LOCAL_API void LoadGroupUser(void)
}
}
PARAM_LOGV
(
"LoadGroupUser getgrent fail errnor %d "
,
errno
);
PARAM_LOGV
(
"LoadGroupUser getgrent fail errnor %d "
,
errno
);
endgrent
();
endgrent
();
}
}
\ No newline at end of file
services/param/linux/param_service.c
浏览文件 @
2868f22f
...
@@ -142,7 +142,7 @@ static int SystemSetParam(const char *name, const char *value, const ParamSecuri
...
@@ -142,7 +142,7 @@ static int SystemSetParam(const char *name, const char *value, const ParamSecuri
PARAM_LOGV
(
"SystemWriteParam name %s value: %s"
,
name
,
value
);
PARAM_LOGV
(
"SystemWriteParam name %s value: %s"
,
name
,
value
);
int
ctrlService
=
0
;
int
ctrlService
=
0
;
int
ret
=
CheckParameterSet
(
name
,
value
,
srcLabel
,
&
ctrlService
);
int
ret
=
CheckParameterSet
(
name
,
value
,
srcLabel
,
&
ctrlService
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
t
to set parameter %s"
,
name
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
d
to set parameter %s"
,
name
);
if
(
ctrlService
&
PARAM_CTRL_SERVICE
)
{
// ctrl param
if
(
ctrlService
&
PARAM_CTRL_SERVICE
)
{
// ctrl param
PostParamTrigger
(
EVENT_TRIGGER_PARAM
,
name
,
value
);
PostParamTrigger
(
EVENT_TRIGGER_PARAM
,
name
,
value
);
...
@@ -431,4 +431,4 @@ ParamService *GetParamService()
...
@@ -431,4 +431,4 @@ ParamService *GetParamService()
{
{
return
&
g_paramService
;
return
&
g_paramService
;
}
}
#endif
#endif
\ No newline at end of file
services/param/liteos/param_client.c
浏览文件 @
2868f22f
...
@@ -78,7 +78,7 @@ int SystemSetParameter(const char *name, const char *value)
...
@@ -78,7 +78,7 @@ int SystemSetParameter(const char *name, const char *value)
InitParamClient
();
InitParamClient
();
int
ctrlService
=
0
;
int
ctrlService
=
0
;
int
ret
=
CheckParameterSet
(
name
,
value
,
GetParamSecurityLabel
(),
&
ctrlService
);
int
ret
=
CheckParameterSet
(
name
,
value
,
GetParamSecurityLabel
(),
&
ctrlService
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
t
to set parameter %s"
,
name
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
d
to set parameter %s"
,
name
);
PARAM_LOGV
(
"SystemSetParameter name %s value: %s ctrlService %d"
,
name
,
value
,
ctrlService
);
PARAM_LOGV
(
"SystemSetParameter name %s value: %s ctrlService %d"
,
name
,
value
,
ctrlService
);
if
((
ctrlService
&
PARAM_CTRL_SERVICE
)
!=
PARAM_CTRL_SERVICE
)
{
// ctrl param
if
((
ctrlService
&
PARAM_CTRL_SERVICE
)
!=
PARAM_CTRL_SERVICE
)
{
// ctrl param
uint32_t
dataIndex
=
0
;
uint32_t
dataIndex
=
0
;
...
@@ -152,4 +152,4 @@ int SystemFindParameter(const char *name, ParamHandle *handle)
...
@@ -152,4 +152,4 @@ int SystemFindParameter(const char *name, ParamHandle *handle)
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbid to access parameter %s"
,
name
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbid to access parameter %s"
,
name
);
}
}
return
ret
;
return
ret
;
}
}
\ No newline at end of file
services/param/liteos/param_hal.c
浏览文件 @
2868f22f
...
@@ -63,7 +63,7 @@ static int LoadPersistParam(void)
...
@@ -63,7 +63,7 @@ static int LoadPersistParam(void)
uint32_t
currLen
=
0
;
uint32_t
currLen
=
0
;
while
(
currLen
<
fileSize
)
{
while
(
currLen
<
fileSize
)
{
if
(
buffer
[
currLen
]
==
'\n'
)
{
// split
e
line
if
(
buffer
[
currLen
]
==
'\n'
)
{
// split line
buffer
[
currLen
]
=
'\0'
;
buffer
[
currLen
]
=
'\0'
;
int
ret
=
SpliteString
(
buffer
,
NULL
,
0
,
LoadOnePersistParam_
,
NULL
);
int
ret
=
SpliteString
(
buffer
,
NULL
,
0
,
LoadOnePersistParam_
,
NULL
);
PARAM_CHECK
(
ret
==
0
,
continue
,
"Failed to set param %d %s"
,
ret
,
buffer
);
PARAM_CHECK
(
ret
==
0
,
continue
,
"Failed to set param %d %s"
,
ret
,
buffer
);
...
@@ -160,4 +160,4 @@ int RegisterPersistParamOps(PersistParamOps *ops)
...
@@ -160,4 +160,4 @@ int RegisterPersistParamOps(PersistParamOps *ops)
ops
->
batchSave
=
BatchSavePersistParam
;
ops
->
batchSave
=
BatchSavePersistParam
;
ops
->
batchSaveEnd
=
BatchSavePersistParamEnd
;
ops
->
batchSaveEnd
=
BatchSavePersistParamEnd
;
return
0
;
return
0
;
}
}
\ No newline at end of file
services/param/liteos/param_service.c
浏览文件 @
2868f22f
...
@@ -48,7 +48,7 @@ int SystemWriteParam(const char *name, const char *value)
...
@@ -48,7 +48,7 @@ int SystemWriteParam(const char *name, const char *value)
{
{
int
ctrlService
=
0
;
int
ctrlService
=
0
;
int
ret
=
CheckParameterSet
(
name
,
value
,
GetParamSecurityLabel
(),
&
ctrlService
);
int
ret
=
CheckParameterSet
(
name
,
value
,
GetParamSecurityLabel
(),
&
ctrlService
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
t
to set parameter %s"
,
name
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbi
d
to set parameter %s"
,
name
);
PARAM_LOGV
(
"SystemWriteParam name %s value: %s ctrlService %d"
,
name
,
value
,
ctrlService
);
PARAM_LOGV
(
"SystemWriteParam name %s value: %s ctrlService %d"
,
name
,
value
,
ctrlService
);
if
((
ctrlService
&
PARAM_CTRL_SERVICE
)
!=
PARAM_CTRL_SERVICE
)
{
// ctrl param
if
((
ctrlService
&
PARAM_CTRL_SERVICE
)
!=
PARAM_CTRL_SERVICE
)
{
// ctrl param
uint32_t
dataIndex
=
0
;
uint32_t
dataIndex
=
0
;
...
...
services/param/manager/param_server.c
浏览文件 @
2868f22f
...
@@ -23,7 +23,7 @@ static int LoadSecurityLabel(const char *fileName)
...
@@ -23,7 +23,7 @@ static int LoadSecurityLabel(const char *fileName)
ParamWorkSpace
*
paramSpace
=
GetParamWorkSpace
();
ParamWorkSpace
*
paramSpace
=
GetParamWorkSpace
();
PARAM_CHECK
(
paramSpace
!=
NULL
,
return
-
1
,
"Invalid paramSpace"
);
PARAM_CHECK
(
paramSpace
!=
NULL
,
return
-
1
,
"Invalid paramSpace"
);
PARAM_WORKSPACE_CHECK
(
paramSpace
,
return
-
1
,
"Invalid space"
);
PARAM_WORKSPACE_CHECK
(
paramSpace
,
return
-
1
,
"Invalid space"
);
PARAM_CHECK
(
fileName
!=
NULL
,
return
-
1
,
"Invalid fi
el
name for load"
);
PARAM_CHECK
(
fileName
!=
NULL
,
return
-
1
,
"Invalid fi
le
name for load"
);
#if !(defined __LITEOS_A__ || defined __LITEOS_M__)
#if !(defined __LITEOS_A__ || defined __LITEOS_M__)
// load security label
// load security label
ParamSecurityOps
*
ops
=
GetParamSecurityOps
(
PARAM_SECURITY_DAC
);
ParamSecurityOps
*
ops
=
GetParamSecurityOps
(
PARAM_SECURITY_DAC
);
...
...
services/utils/init_utils.c
浏览文件 @
2868f22f
...
@@ -220,7 +220,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
...
@@ -220,7 +220,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
{
{
INIT_CHECK_RETURN_VALUE
((
maxItemCount
>=
0
)
&&
(
buffer
!=
NULL
)
&&
(
del
!=
NULL
)
&&
(
returnCount
!=
NULL
),
NULL
);
INIT_CHECK_RETURN_VALUE
((
maxItemCount
>=
0
)
&&
(
buffer
!=
NULL
)
&&
(
del
!=
NULL
)
&&
(
returnCount
!=
NULL
),
NULL
);
// Why is this number?
// Why is this number?
// Now we use this function to split a string with a given delim
e
ter
// Now we use this function to split a string with a given delim
i
ter
// We do not know how many sub-strings out there after splitting.
// We do not know how many sub-strings out there after splitting.
// 50 is just a guess value.
// 50 is just a guess value.
const
int
defaultItemCounts
=
50
;
const
int
defaultItemCounts
=
50
;
...
@@ -512,4 +512,4 @@ uint32_t GetRandom()
...
@@ -512,4 +512,4 @@ uint32_t GetRandom()
}
}
close
(
fd
);
close
(
fd
);
return
ulSeed
;
return
ulSeed
;
}
}
\ No newline at end of file
services/utils/list.c
浏览文件 @
2868f22f
...
@@ -144,7 +144,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
...
@@ -144,7 +144,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @param head list head, make sure head is valid pointer.
* @param head list head, make sure head is valid pointer.
* @param cookie optional traversing data.
* @param cookie optional traversing data.
* @param traversalProc comparing function, return 0 if matched.
* @param traversalProc comparing function, return 0 if matched.
* @param flags optinal traversing flags:
* @param flags opti
o
nal traversing flags:
* TRAVERSE_REVERSE_ORDER: traversing from last node to first node;
* TRAVERSE_REVERSE_ORDER: traversing from last node to first node;
* default behaviour is from first node to last node
* default behaviour is from first node to last node
* TRAVERSE_STOP_WHEN_ERROR: stop traversing if traversalProc return non-zero
* TRAVERSE_STOP_WHEN_ERROR: stop traversing if traversalProc return non-zero
...
...
test/exec_test/sa_service_ondemand_test.cpp
浏览文件 @
2868f22f
...
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
...
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
};
};
int
parameterNum
=
2
;
int
parameterNum
=
2
;
if
((
argc
!=
parameterNum
)
||
(
argv
[
1
]
==
nullptr
))
{
if
((
argc
!=
parameterNum
)
||
(
argv
[
1
]
==
nullptr
))
{
cout
<<
"Inva
il
d parameter"
<<
endl
;
cout
<<
"Inva
li
d parameter"
<<
endl
;
}
}
const
string
name
=
argv
[
1
];
const
string
name
=
argv
[
1
];
int
abilityId
=
0
;
int
abilityId
=
0
;
...
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
...
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
cout
<<
"sa service name "
<<
item
->
first
<<
"ability id "
<<
item
->
second
<<
endl
;
cout
<<
"sa service name "
<<
item
->
first
<<
"ability id "
<<
item
->
second
<<
endl
;
abilityId
=
item
->
second
;
abilityId
=
item
->
second
;
}
else
{
}
else
{
cout
<<
"Inva
il
d sa service name"
<<
endl
;
cout
<<
"Inva
li
d sa service name"
<<
endl
;
return
0
;
return
0
;
}
}
...
...
test/unittest/init/sandbox_unittest.cpp
浏览文件 @
2868f22f
...
@@ -194,9 +194,9 @@ HWTEST_F(SandboxUnitTest, TestEnterErrorSandbox, TestSize.Level1) {
...
@@ -194,9 +194,9 @@ HWTEST_F(SandboxUnitTest, TestEnterErrorSandbox, TestSize.Level1) {
HWTEST_F
(
SandboxUnitTest
,
TestCreateErrorSandbox1
,
TestSize
.
Level1
)
{
HWTEST_F
(
SandboxUnitTest
,
TestCreateErrorSandbox1
,
TestSize
.
Level1
)
{
const
char
*
pname
=
nullptr
;
const
char
*
pname
=
nullptr
;
std
::
cout
<<
"test dest
or
y nullptr"
<<
std
::
endl
;
std
::
cout
<<
"test dest
ro
y nullptr"
<<
std
::
endl
;
DestroySandbox
(
pname
);
DestroySandbox
(
pname
);
std
::
cout
<<
"test dest
or
y xapp"
<<
std
::
endl
;
std
::
cout
<<
"test dest
ro
y xapp"
<<
std
::
endl
;
DestroySandbox
(
"xapp"
);
DestroySandbox
(
"xapp"
);
std
::
cout
<<
"test enter xapp"
<<
std
::
endl
;
std
::
cout
<<
"test enter xapp"
<<
std
::
endl
;
int
ret1
=
EnterSandbox
(
"xapp"
);
int
ret1
=
EnterSandbox
(
"xapp"
);
...
...
test/unittest/lite/cmd_func_test.cpp
浏览文件 @
2868f22f
...
@@ -45,7 +45,7 @@ const gid_t TEST_FILE_GID = 999;
...
@@ -45,7 +45,7 @@ const gid_t TEST_FILE_GID = 999;
const
mode_t
TEST_FILE_MODE
=
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
;
const
mode_t
TEST_FILE_MODE
=
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
;
#endif
#endif
// init.cfg rel
e
ated
// init.cfg related
const
std
::
string
CFG_FILE
=
"/etc/init.cfg"
;
const
std
::
string
CFG_FILE
=
"/etc/init.cfg"
;
const
std
::
string
SERVICE_ARR_NAME_IN_JSON
=
"services"
;
const
std
::
string
SERVICE_ARR_NAME_IN_JSON
=
"services"
;
const
std
::
string
JOBS_ARR_NAME_IN_JSON
=
"jobs"
;
const
std
::
string
JOBS_ARR_NAME_IN_JSON
=
"jobs"
;
...
@@ -62,7 +62,7 @@ const int TEST_MAX_PATH_ARGS_CNT = 20; // max path and args count
...
@@ -62,7 +62,7 @@ const int TEST_MAX_PATH_ARGS_CNT = 20; // max path and args count
const
int
TEST_MAX_ONE_ARG_LEN
=
64
;
// max length of one param/path
const
int
TEST_MAX_ONE_ARG_LEN
=
64
;
// max length of one param/path
const
int
CAT_BUF_SIZE
=
512
;
// standard Cat buffer size from vfs_shell_cmd
const
int
CAT_BUF_SIZE
=
512
;
// standard Cat buffer size from vfs_shell_cmd
// job test rel
e
ated
// job test related
const
std
::
string
PRE_INIT_DIR
=
ROOT_DIR
+
"preInitDir/"
;
const
std
::
string
PRE_INIT_DIR
=
ROOT_DIR
+
"preInitDir/"
;
const
std
::
string
INIT_DIR
=
PRE_INIT_DIR
+
"initDir"
;
const
std
::
string
INIT_DIR
=
PRE_INIT_DIR
+
"initDir"
;
const
std
::
string
POST_INIT_DIR
=
INIT_DIR
+
"postInitDir"
;
const
std
::
string
POST_INIT_DIR
=
INIT_DIR
+
"postInitDir"
;
...
...
test/unittest/param/param_stub.cpp
浏览文件 @
2868f22f
...
@@ -63,7 +63,7 @@ static const char *forbitWriteParamName[] = {
...
@@ -63,7 +63,7 @@ static const char *forbitWriteParamName[] = {
static
int
TestSetParamCheck
(
const
char
*
paraName
,
struct
ucred
*
uc
)
static
int
TestSetParamCheck
(
const
char
*
paraName
,
struct
ucred
*
uc
)
{
{
// forbi
t
to read ohos.servicectrl.
// forbi
d
to read ohos.servicectrl.
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
forbitWriteParamName
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
forbitWriteParamName
);
i
++
)
{
if
(
strncmp
(
paraName
,
forbitWriteParamName
[
i
],
strlen
(
forbitWriteParamName
[
i
]))
==
0
)
{
if
(
strncmp
(
paraName
,
forbitWriteParamName
[
i
],
strlen
(
forbitWriteParamName
[
i
]))
==
0
)
{
return
1
;
return
1
;
...
@@ -91,7 +91,7 @@ static const char *forbitReadParamName[] = {
...
@@ -91,7 +91,7 @@ static const char *forbitReadParamName[] = {
};
};
static
int
TestReadParamCheck
(
const
char
*
paraName
)
static
int
TestReadParamCheck
(
const
char
*
paraName
)
{
{
// forbi
t
to read ohos.servicectrl.
// forbi
d
to read ohos.servicectrl.
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
forbitReadParamName
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
ARRAY_LENGTH
(
forbitReadParamName
);
i
++
)
{
if
(
strncmp
(
paraName
,
forbitReadParamName
[
i
],
strlen
(
forbitReadParamName
[
i
]))
==
0
)
{
if
(
strncmp
(
paraName
,
forbitReadParamName
[
i
],
strlen
(
forbitReadParamName
[
i
]))
==
0
)
{
return
1
;
return
1
;
...
@@ -415,4 +415,4 @@ static __attribute__((constructor(101))) void ParamTestStubInit(void)
...
@@ -415,4 +415,4 @@ static __attribute__((constructor(101))) void ParamTestStubInit(void)
#if __cplusplus
#if __cplusplus
}
}
#endif
#endif
#endif
#endif
\ No newline at end of file
test/unittest/param/paramservice_unittest.cpp
浏览文件 @
2868f22f
...
@@ -447,7 +447,7 @@ public:
...
@@ -447,7 +447,7 @@ public:
int
TestServiceCtrl
(
const
char
*
serviceName
,
int
mode
)
int
TestServiceCtrl
(
const
char
*
serviceName
,
int
mode
)
{
{
// service forbi
t
// service forbi
d
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
...
@@ -459,7 +459,7 @@ public:
...
@@ -459,7 +459,7 @@ public:
int
TestPowerCtrl
(
const
char
*
reboot
,
int
mode
)
int
TestPowerCtrl
(
const
char
*
reboot
,
int
mode
)
{
{
// service forbi
t
// service forbi
d
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
...
@@ -573,4 +573,4 @@ HWTEST_F(ParamServiceUnitTest, TestPowerCtrl, TestSize.Level0)
...
@@ -573,4 +573,4 @@ HWTEST_F(ParamServiceUnitTest, TestPowerCtrl, TestSize.Level0)
ret
=
test
.
TestPowerCtrl
(
"reboot"
,
0772
);
ret
=
test
.
TestPowerCtrl
(
"reboot"
,
0772
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
}
// namespace init_ut
}
// namespace init_ut
\ No newline at end of file
test/unittest/syspara/syspara_unittest.cpp
浏览文件 @
2868f22f
...
@@ -62,7 +62,7 @@ HWTEST_F(SysparaUnitTest, parameterTest001_1, TestSize.Level0)
...
@@ -62,7 +62,7 @@ HWTEST_F(SysparaUnitTest, parameterTest001_1, TestSize.Level0)
printf
(
"SDK api version =%d
\n
"
,
GetSdkApiVersion
());
printf
(
"SDK api version =%d
\n
"
,
GetSdkApiVersion
());
printf
(
"Incremental version = %s
\n
"
,
GetIncrementalVersion
());
printf
(
"Incremental version = %s
\n
"
,
GetIncrementalVersion
());
printf
(
"formal id =%s
\n
"
,
GetVersionId
());
printf
(
"formal id =%s
\n
"
,
GetVersionId
());
printf
(
"build ty
ep
=%s
\n
"
,
GetBuildType
());
printf
(
"build ty
pe
=%s
\n
"
,
GetBuildType
());
printf
(
"build user =%s
\n
"
,
GetBuildUser
());
printf
(
"build user =%s
\n
"
,
GetBuildUser
());
printf
(
"Build host = %s
\n
"
,
GetBuildHost
());
printf
(
"Build host = %s
\n
"
,
GetBuildHost
());
printf
(
"build time =%s
\n
"
,
GetBuildTime
());
printf
(
"build time =%s
\n
"
,
GetBuildTime
());
...
...
test/unittest/test_data/system/etc/param/ohos.para.dac
浏览文件 @
2868f22f
...
@@ -25,10 +25,10 @@ const.allow.mock.location root:root:0777
...
@@ -25,10 +25,10 @@ const.allow.mock.location root:root:0777
const.debuggable root:root:0777
const.debuggable root:root:0777
persist.sys.usb.config root:root:0777
persist.sys.usb.config root:root:0777
# default forbi
t
other user to start service
# default forbi
d
other user to start service
ohos.servicectrl. root:root:0777
ohos.servicectrl. root:root:0777
test.permission. root:root:0770
test.permission. root:root:0770
test.permission.read. root:root:0774
test.permission.read. root:root:0774
test.permission.write. root:root:0772
test.permission.write. root:root:0772
test.permission.watcher. root:root:0771
test.permission.watcher. root:root:0771
\ No newline at end of file
test/unittest/test_data/system/etc/param/ohos.para.selinux
浏览文件 @
2868f22f
...
@@ -25,5 +25,5 @@ const.allow.mock.location root:root:0777
...
@@ -25,5 +25,5 @@ const.allow.mock.location root:root:0777
const.debuggable root:root:0777
const.debuggable root:root:0777
persist.sys.usb.config root:root:0777
persist.sys.usb.config root:root:0777
# default forbit other user to start service
# default forbid other user to start service
ohos.servicectrl. root:root:0777
ohos.servicectrl. root:root:0777
\ No newline at end of file
test/unittest/tools/prepare_testdata.sh
浏览文件 @
2868f22f
...
@@ -36,7 +36,7 @@ function hdc_push_cmd() {
...
@@ -36,7 +36,7 @@ function hdc_push_cmd() {
if
[
$#
-ne
2
]
;
then
if
[
$#
-ne
2
]
;
then
return
;
return
;
fi
fi
echo
"Pushing resouces to device"
echo
"Pushing resou
r
ces to device"
hdc file send
$@
hdc file send
$@
sleep
0.2
sleep
0.2
}
}
...
...
ueventd/ueventd.c
浏览文件 @
2868f22f
...
@@ -169,7 +169,7 @@ static void HandleRequiredDynamicDeviceNodes(const struct Uevent *uevent)
...
@@ -169,7 +169,7 @@ static void HandleRequiredDynamicDeviceNodes(const struct Uevent *uevent)
static
void
HandleUeventRequired
(
const
struct
Uevent
*
uevent
,
char
**
devices
,
int
num
)
static
void
HandleUeventRequired
(
const
struct
Uevent
*
uevent
,
char
**
devices
,
int
num
)
{
{
const
char
*
deviceName
;
const
char
*
deviceName
;
INIT_ERROR_CHECK
(
devices
!=
NULL
&&
num
>
0
,
return
,
"Fault paramters"
);
INIT_ERROR_CHECK
(
devices
!=
NULL
&&
num
>
0
,
return
,
"Fault param
e
ters"
);
if
(
uevent
->
action
==
ACTION_ADD
)
{
if
(
uevent
->
action
==
ACTION_ADD
)
{
ChangeSysAttributePermissions
(
uevent
->
syspath
);
ChangeSysAttributePermissions
(
uevent
->
syspath
);
}
}
...
@@ -332,7 +332,7 @@ static void Trigger(const char *path, int sockFd, char **devices, int num)
...
@@ -332,7 +332,7 @@ static void Trigger(const char *path, int sockFd, char **devices, int num)
}
}
char
ueventBuffer
[
PATH_MAX
];
char
ueventBuffer
[
PATH_MAX
];
if
(
snprintf_s
(
ueventBuffer
,
PATH_MAX
,
PATH_MAX
-
1
,
"%s/%s"
,
path
,
"uevent"
)
==
-
1
)
{
if
(
snprintf_s
(
ueventBuffer
,
PATH_MAX
,
PATH_MAX
-
1
,
"%s/%s"
,
path
,
"uevent"
)
==
-
1
)
{
INIT_LOGW
(
"Cann
n
ot build uevent path under %s"
,
path
);
INIT_LOGW
(
"Cannot build uevent path under %s"
,
path
);
continue
;
continue
;
}
}
DoTrigger
(
ueventBuffer
,
sockFd
,
devices
,
num
);
DoTrigger
(
ueventBuffer
,
sockFd
,
devices
,
num
);
...
...
ueventd/ueventd_device_handler.c
浏览文件 @
2868f22f
...
@@ -307,7 +307,7 @@ static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent)
...
@@ -307,7 +307,7 @@ static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent)
return
NULL
;
return
NULL
;
}
}
// Reverse walk through sysPath, and check subystem file under each directory.
// Reverse walk through sysPath, and check sub
s
ystem file under each directory.
char
*
parent
=
dirname
(
sysPath
);
char
*
parent
=
dirname
(
sysPath
);
while
(
parent
!=
NULL
&&
!
STRINGEQUAL
(
parent
,
"/"
)
&&
!
STRINGEQUAL
(
parent
,
"."
))
{
while
(
parent
!=
NULL
&&
!
STRINGEQUAL
(
parent
,
"/"
)
&&
!
STRINGEQUAL
(
parent
,
"."
))
{
char
subsystem
[
SYSPATH_SIZE
];
char
subsystem
[
SYSPATH_SIZE
];
...
...
ueventd/ueventd_read_cfg.c
浏览文件 @
2868f22f
...
@@ -155,7 +155,7 @@ static int ParseFirmwareConfig(char *p)
...
@@ -155,7 +155,7 @@ static int ParseFirmwareConfig(char *p)
// Sanity checks
// Sanity checks
struct
stat
st
=
{};
struct
stat
st
=
{};
INIT_ERROR_CHECK
(
stat
(
p
,
&
st
)
==
0
,
return
-
1
,
"Invalid firware file: %s, err = %d"
,
p
,
errno
);
INIT_ERROR_CHECK
(
stat
(
p
,
&
st
)
==
0
,
return
-
1
,
"Invalid fir
m
ware file: %s, err = %d"
,
p
,
errno
);
INIT_ERROR_CHECK
(
S_ISDIR
(
st
.
st_mode
),
return
-
1
,
"Expect directory in firmware config"
);
INIT_ERROR_CHECK
(
S_ISDIR
(
st
.
st_mode
),
return
-
1
,
"Expect directory in firmware config"
);
struct
FirmwareUdevConf
*
config
=
calloc
(
1
,
sizeof
(
struct
FirmwareUdevConf
));
struct
FirmwareUdevConf
*
config
=
calloc
(
1
,
sizeof
(
struct
FirmwareUdevConf
));
INIT_CHECK
(
config
!=
NULL
,
errno
=
ENOMEM
;
INIT_CHECK
(
config
!=
NULL
,
errno
=
ENOMEM
;
...
...
ueventd/ueventd_socket.c
浏览文件 @
2868f22f
...
@@ -39,7 +39,7 @@ int UeventdSocketInit(void)
...
@@ -39,7 +39,7 @@ int UeventdSocketInit(void)
int
on
=
1
;
int
on
=
1
;
if
(
memset_s
(
&
addr
,
sizeof
(
addr
),
0
,
sizeof
(
addr
))
!=
EOK
)
{
if
(
memset_s
(
&
addr
,
sizeof
(
addr
),
0
,
sizeof
(
addr
))
!=
EOK
)
{
INIT_LOGE
(
"Faild to clear socket address"
);
INIT_LOGE
(
"Fail
e
d to clear socket address"
);
return
-
1
;
return
-
1
;
}
}
addr
.
nl_family
=
AF_NETLINK
;
addr
.
nl_family
=
AF_NETLINK
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录