Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
f400ae70
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看板
未验证
提交
f400ae70
编写于
5月 29, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 29, 2023
浏览文件
操作
浏览文件
下载
差异文件
!1987 FIX:修改静态告警
Merge pull request !1987 from cheng_jinsong/0525_codeCkeck
上级
e6b61401
ed6d0341
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
35 addition
and
432 deletion
+35
-432
device_info/device_info_stub.cpp
device_info/device_info_stub.cpp
+1
-1
interfaces/innerkits/fs_manager/libfs_dm/fs_dm.c
interfaces/innerkits/fs_manager/libfs_dm/fs_dm.c
+1
-1
interfaces/innerkits/include/service_watcher.h
interfaces/innerkits/include/service_watcher.h
+1
-1
interfaces/kits/jskits/@ohos.deviceInfo.d.ts
interfaces/kits/jskits/@ohos.deviceInfo.d.ts
+0
-245
interfaces/kits/jskits/@ohos.systemparameter.d.ts
interfaces/kits/jskits/@ohos.systemparameter.d.ts
+0
-157
services/begetctl/begetctl_cmd.c
services/begetctl/begetctl_cmd.c
+5
-5
services/init/init_common_service.c
services/init/init_common_service.c
+11
-3
services/log/init_log.c
services/log/init_log.c
+2
-2
services/modules/init_eng/init_eng.c
services/modules/init_eng/init_eng.c
+1
-3
services/modules/init_eng/init_eng_static.c
services/modules/init_eng/init_eng_static.c
+0
-1
services/modules/init_hook/init_hook.c
services/modules/init_hook/init_hook.c
+8
-8
test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp
...iceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp
+1
-1
test/unittest/param/watcher_agent_unittest.cpp
test/unittest/param/watcher_agent_unittest.cpp
+4
-4
未找到文件。
device_info/device_info_stub.cpp
浏览文件 @
f400ae70
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "device_info_stub.h"
#include "device_info_stub.h"
#include <chrono>
#include <chrono>
#include <
signal.h
>
#include <
csignal
>
#include <unistd.h>
#include <unistd.h>
#include "beget_ext.h"
#include "beget_ext.h"
...
...
interfaces/innerkits/fs_manager/libfs_dm/fs_dm.c
浏览文件 @
f400ae70
...
@@ -145,7 +145,7 @@ static int LoadDmDeviceTable(int fd, const char *devName,
...
@@ -145,7 +145,7 @@ static int LoadDmDeviceTable(int fd, const char *devName,
break
;
break
;
}
}
err
=
strcpy_s
(
paras
,
target
->
paras_len
+
1
,
target
->
paras
);
err
=
strcpy_s
(
paras
,
target
->
paras_len
+
1
,
target
->
paras
);
if
(
err
!=
EOK
)
{
if
(
err
!=
EOK
)
{
rc
=
-
1
;
rc
=
-
1
;
BEGET_LOGE
(
"error 0x%x, cp target paras"
,
err
);
BEGET_LOGE
(
"error 0x%x, cp target paras"
,
err
);
...
...
interfaces/innerkits/include/service_watcher.h
浏览文件 @
f400ae70
...
@@ -28,7 +28,7 @@ extern "C" {
...
@@ -28,7 +28,7 @@ extern "C" {
#define INVALID_PID 0
#define INVALID_PID 0
typedef
struct
serviceInfo
{
typedef
struct
serviceInfo
_
{
ServiceStatus
status
;
ServiceStatus
status
;
pid_t
pid
;
pid_t
pid
;
}
ServiceInfo
;
}
ServiceInfo
;
...
...
interfaces/kits/jskits/@ohos.deviceInfo.d.ts
已删除
100755 → 0
浏览文件 @
e6b61401
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* A static class pertaining to the product information.
*
* @devices phone, tablet
* @since 6
* @Syscap SystemCapability.Startup.SysInfo
*/
declare
namespace
deviceInfo
{
/**
* Obtains the device type represented by a string,
* which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable},
* {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}.
*
* @since 6
*/
const
deviceType
:
string
;
/**
* Obtains the device manufacturer represented by a string.
*
* @since 6
*/
const
manufacture
:
string
;
/**
* Obtains the device brand represented by a string.
*
* @since 6
*/
const
brand
:
string
;
/**
* Obtains the external product series represented by a string.
*
* @since 6
*/
const
marketName
:
string
;
/**
* Obtains the product series represented by a string.
*
* @since 6
*/
const
productSeries
:
string
;
/**
* Obtains the product model represented by a string.
*
* @since 6
*/
const
productModel
:
string
;
/**
* Obtains the software model represented by a string.
*
* @since 6
*/
const
softwareModel
:
string
;
/**
* Obtains the hardware model represented by a string.
*
* @since 6
*/
const
hardwareModel
:
string
;
/**
* Obtains the hardware profile represented by a string.
*
* @since 6
*/
const
hardwareProfile
:
string
;
/**
* Obtains the device serial number represented by a string.
*
* @since 6
*/
const
serial
:
string
;
/**
* Obtains the bootloader version number represented by a string.
*
* @since 6
*/
const
bootloaderVersion
:
string
;
/**
* Obtains the application binary interface (Abi) list represented by a string.
*
* @since 6
*/
const
abiList
:
string
;
/**
* Obtains the security patch level represented by a string.
*
* @since 6
*/
const
securityPatchTag
:
string
;
/**
* Obtains the product version represented by a string.
*
* @since 6
*/
const
displayVersion
:
string
;
/**
* Obtains the incremental version represented by a string.
*
* @since 6
*/
const
incrementalVersion
:
string
;
/**
* Obtains the OS release type represented by a string.
*
* <p>The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}.
* The specific release type may be {@code Release}, {@code Beta1}, or others alike.
*
* @since 6
*/
const
osReleaseType
:
string
;
/**
* Obtains the OS version represented by a string.
*
* @since 6
*/
const
osFullName
:
string
;
/**
* Obtains the major (M) version number, which increases with any updates to the overall architecture.
* <p>The M version number monotonically increases from 1 to 99.
*
* @since 6
*/
const
majorVersion
:
number
;
/**
* Obtains the senior (S) version number, which increases with any updates to the partial
* architecture or major features.
* <p>The S version number monotonically increases from 0 to 99.
*
* @since 6
*/
const
seniorVersion
:
number
;
/**
* Obtains the feature (F) version number, which increases with any planned new features.
* <p>The F version number monotonically increases from 0 or 1 to 99.
*
* @since 6
*/
const
featureVersion
:
number
;
/**
* Obtains the build (B) version number, which increases with each new development build.
* <p>The B version number monotonically increases from 0 or 1 to 999.
*
* @since 6
*/
const
buildVersion
:
number
;
/**
* Obtains the SDK API version number.
*
* @since 6
*/
const
sdkApiVersion
:
number
;
/**
* Obtains the first API version number.
*
* @since 6
*/
const
firstApiVersion
:
number
;
/**
* Obtains the version ID by a string.
*
* @since 6
*/
const
versionId
:
string
;
/**
* Obtains the build types of the same baseline code.
*
* @since 6
*/
const
buildType
:
string
;
/**
* Obtains the different build user of the same baseline code.
*
* @since 6
*/
const
buildUser
:
string
;
/**
* Obtains the different build host of the same baseline code.
*
* @since 6
*/
const
buildHost
:
string
;
/**
* Obtains the build time.
*
* @since 6
*/
const
buildTime
:
string
;
/**
* Obtains the version hash.
*
* @since 6
*/
const
buildRootHash
:
string
;
/**
* Obtains the device udid.
*
* @since 7
*/
const
udid
:
string
;
}
export
default
deviceInfo
;
interfaces/kits/jskits/@ohos.systemparameter.d.ts
已删除
100755 → 0
浏览文件 @
e6b61401
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
/**
* The interface of system parameters class.
*
* @devices phone, tablet
* @since 6
* @Syscap SystemCapability.Startup.SysInfo
* @systemapi
*/
declare
namespace
systemParameter
{
/**
* Gets the value of the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param def Default value.
* @return if the parameter is empty or doesn't exist, empty string will be returned.
* @since 6
*/
function
getSync
(
key
:
string
,
def
?:
string
):
string
;
/**
* Gets the value of the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param callback Callback function.
* @since 6
*/
function
get
(
key
:
string
,
callback
:
AsyncCallback
<
string
>
):
void
;
/**
* Gets the value of the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param def Default value.
* @param callback Callback function.
* @since 6
*/
function
get
(
key
:
string
,
def
:
string
,
callback
:
AsyncCallback
<
string
>
):
void
;
/**
* Gets the value of the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param def Default value.
* @return Promise, which is used to obtain the result asynchronously.
* @since 6
*/
function
get
(
key
:
string
,
def
?:
string
):
Promise
<
string
>
;
/**
* Sets a value for the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param value System attribute value to set.
* @since 6
*/
function
setSync
(
key
:
string
,
value
:
string
):
void
;
/**
* Sets a value for the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param value System attribute value to set.
* @param callback Callback function.
* @since 6
*/
function
set
(
key
:
string
,
value
:
string
,
callback
:
AsyncCallback
<
void
>
):
void
;
/**
* Sets a value for the attribute with the specified key.
*
* @param key Key of the system attribute.
* @param value Default value.
* @return Promise, which is used to obtain the result asynchronously.
* @since 6
*/
function
set
(
key
:
string
,
value
:
string
):
Promise
<
void
>
;
/**
* Wait for a parameter with specified value.
*
* @param key Key of the system parameter.
* @param value System parameter value to be wait.
* @param timeout Indicates the timeout value, in seconds.
* <=0 means wait for ever.
* >0 means wait for specified seconds
* @param callback Callback function.
* @since 7
*/
function
wait
(
key
:
string
,
value
:
string
,
timeout
:
number
,
callback
:
AsyncCallback
<
void
>
):
void
;
/**
* Sets a value for the parameter with the specified key.
*
* @param key Key of the system parameter.
* @param value System parameter value to be wait.
* @param timeout Indicates the timeout value, in seconds.
* <=0 means wait for ever.
* >0 means wait for specified seconds
* @return Promise, which is used to obtain the result asynchronously.
* @since 7
*/
function
wait
(
key
:
string
,
value
:
string
,
timeout
:
number
):
Promise
<
void
>
;
/**
* Wait for a parameter with specified value.
*
* @param keyPrefix Key prefix of the system parameters to be watched.
* @param callback Callback function.
* @since 7
*/
function
getWatcher
(
keyPrefix
:
string
):
Watcher
;
/**
* Called when the system parameter value changes. You need to implement this method in a child class.
*
* @param key Indicates changed system parameter key name.
* @param value Indicates changed system parameter value.
* @since 7
*/
export
interface
ParameterChangeCallback
{
(
key
:
string
,
value
:
string
):
void
;
}
export
interface
Watcher
{
/**
* Subscribe to parameter value changess
*
* @since 7
*/
on
(
eventType
:
'
valueChange
'
,
callback
:
ParameterChangeCallback
):
void
;
/**
* Unsubscribe to parameter value changess
*
* @since 7
*/
off
(
eventType
:
'
valueChange
'
,
callback
?:
ParameterChangeCallback
):
void
;
}
}
export
default
systemParameter
;
services/begetctl/begetctl_cmd.c
浏览文件 @
f400ae70
...
@@ -66,12 +66,12 @@ static int SetInitLogLevelFromParam(BShellHandle shell, int argc, char **argv)
...
@@ -66,12 +66,12 @@ static int SetInitLogLevelFromParam(BShellHandle shell, int argc, char **argv)
return
-
1
;
return
-
1
;
}
}
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
const
char
*
LOG_LEVEL_STR
[]
=
{
"DEBUG"
,
"INFO"
,
"WARNING"
,
"ERROR"
,
"FATAL"
};
const
char
*
logLevelStr
[]
=
{
"DEBUG"
,
"INFO"
,
"WARNING"
,
"ERROR"
,
"FATAL"
};
int
ret
=
HandleCmd
(
shell
,
"setloglevel"
,
argc
-
1
,
&
argv
[
1
]);
int
ret
=
HandleCmd
(
shell
,
"setloglevel"
,
argc
-
1
,
&
argv
[
1
]);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
printf
(
"Failed to set log level %s.
\n
"
,
LOG_LEVEL_STR
[
level
]);
printf
(
"Failed to set log level %s.
\n
"
,
logLevelStr
[
level
]);
}
else
{
}
else
{
printf
(
"Success to set log level %s.
\n
"
,
LOG_LEVEL_STR
[
level
]);
printf
(
"Success to set log level %s.
\n
"
,
logLevelStr
[
level
]);
}
}
}
else
{
}
else
{
printf
(
"%s is invalid.
\n
"
,
argv
[
1
]);
printf
(
"%s is invalid.
\n
"
,
argv
[
1
]);
...
@@ -83,8 +83,8 @@ static int32_t GetInitLogLevelFromParam(BShellHandle shell, int argc, char **arg
...
@@ -83,8 +83,8 @@ static int32_t GetInitLogLevelFromParam(BShellHandle shell, int argc, char **arg
{
{
int
level
=
GetIntParameter
(
INIT_DEBUG_LEVEL
,
(
int
)
INIT_ERROR
);
int
level
=
GetIntParameter
(
INIT_DEBUG_LEVEL
,
(
int
)
INIT_ERROR
);
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
const
char
*
LOG_LEVEL_STR
[]
=
{
"DEBUG"
,
"INFO"
,
"WARNING"
,
"ERROR"
,
"FATAL"
};
const
char
*
logLevelStr
[]
=
{
"DEBUG"
,
"INFO"
,
"WARNING"
,
"ERROR"
,
"FATAL"
};
printf
(
"Init log level: %s
\n
"
,
LOG_LEVEL_STR
[
level
]);
printf
(
"Init log level: %s
\n
"
,
logLevelStr
[
level
]);
}
}
return
0
;
return
0
;
}
}
...
...
services/init/init_common_service.c
浏览文件 @
f400ae70
...
@@ -134,10 +134,8 @@ static void ServiceHookExecute(const char *serviceName, const char *info, int st
...
@@ -134,10 +134,8 @@ static void ServiceHookExecute(const char *serviceName, const char *info, int st
}
}
#endif
#endif
static
int
Se
tPerms
(
const
Service
*
service
)
static
int
Se
rviceCheck
(
const
Service
*
service
)
{
{
INIT_CHECK_RETURN_VALUE
(
KeepCapability
()
==
0
,
SERVICE_FAILURE
);
if
(
service
->
servPerm
.
gIDCnt
==
0
)
{
if
(
service
->
servPerm
.
gIDCnt
==
0
)
{
// use uid as gid
// use uid as gid
INIT_ERROR_CHECK
(
setgid
(
service
->
servPerm
.
uID
)
==
0
,
return
SERVICE_FAILURE
,
INIT_ERROR_CHECK
(
setgid
(
service
->
servPerm
.
uID
)
==
0
,
return
SERVICE_FAILURE
,
...
@@ -153,6 +151,16 @@ static int SetPerms(const Service *service)
...
@@ -153,6 +151,16 @@ static int SetPerms(const Service *service)
"SetPerms, setgroups failed. errno = %d, gIDCnt=%d"
,
errno
,
service
->
servPerm
.
gIDCnt
);
"SetPerms, setgroups failed. errno = %d, gIDCnt=%d"
,
errno
,
service
->
servPerm
.
gIDCnt
);
}
}
return
SERVICE_SUCCESS
;
}
static
int
SetPerms
(
const
Service
*
service
)
{
INIT_CHECK_RETURN_VALUE
(
KeepCapability
()
==
0
,
SERVICE_FAILURE
);
INIT_ERROR_CHECK
(
ServiceCheck
(
service
)
==
SERVICE_SUCCESS
,
return
SERVICE_FAILURE
,
"set seccomp policy failed for service %s"
,
service
->
name
);
// set seccomp policy before setuid
// set seccomp policy before setuid
INIT_ERROR_CHECK
(
SetSystemSeccompPolicy
(
service
)
==
SERVICE_SUCCESS
,
return
SERVICE_FAILURE
,
INIT_ERROR_CHECK
(
SetSystemSeccompPolicy
(
service
)
==
SERVICE_SUCCESS
,
return
SERVICE_FAILURE
,
"set seccomp policy failed for service %s"
,
service
->
name
);
"set seccomp policy failed for service %s"
,
service
->
name
);
...
...
services/log/init_log.c
浏览文件 @
f400ae70
...
@@ -113,7 +113,7 @@ static void PrintLog(InitLogLevel logLevel, unsigned int domain, const char *tag
...
@@ -113,7 +113,7 @@ static void PrintLog(InitLogLevel logLevel, unsigned int domain, const char *tag
#endif
#endif
}
}
static
void
PrintLog
_
(
int
logLevel
,
unsigned
int
domain
,
const
char
*
tag
,
const
char
*
fmt
,
va_list
vargs
)
static
void
PrintLog
Fmt
(
int
logLevel
,
unsigned
int
domain
,
const
char
*
tag
,
const
char
*
fmt
,
va_list
vargs
)
{
{
char
tmpFmt
[
DEF_LOG_SIZE
]
=
{
0
};
char
tmpFmt
[
DEF_LOG_SIZE
]
=
{
0
};
if
(
vsnprintf_s
(
tmpFmt
,
sizeof
(
tmpFmt
),
sizeof
(
tmpFmt
)
-
1
,
fmt
,
vargs
)
==
-
1
)
{
if
(
vsnprintf_s
(
tmpFmt
,
sizeof
(
tmpFmt
),
sizeof
(
tmpFmt
)
-
1
,
fmt
,
vargs
)
==
-
1
)
{
...
@@ -128,7 +128,7 @@ INIT_LOCAL_API void InitLog(int logLevel, unsigned int domain, const char *tag,
...
@@ -128,7 +128,7 @@ INIT_LOCAL_API void InitLog(int logLevel, unsigned int domain, const char *tag,
if
((
int
)
g_logLevel
>
logLevel
)
{
if
((
int
)
g_logLevel
>
logLevel
)
{
return
;
return
;
}
}
PrintLog
_
((
InitLogLevel
)
logLevel
,
domain
,
tag
,
fmt
,
vargs
);
PrintLog
Fmt
((
InitLogLevel
)
logLevel
,
domain
,
tag
,
fmt
,
vargs
);
}
}
INIT_PUBLIC_API
void
SetInitLogLevel
(
InitLogLevel
level
)
INIT_PUBLIC_API
void
SetInitLogLevel
(
InitLogLevel
level
)
...
...
services/modules/init_eng/init_eng.c
浏览文件 @
f400ae70
...
@@ -81,13 +81,11 @@ ENG_STATIC void BuildMountCmd(char *buffer, size_t len, const char *mp, const ch
...
@@ -81,13 +81,11 @@ ENG_STATIC void BuildMountCmd(char *buffer, size_t len, const char *mp, const ch
ENG_STATIC
void
MountEngPartitions
(
void
)
ENG_STATIC
void
MountEngPartitions
(
void
)
{
{
char
mountCmd
[
MOUNT_CMD_MAX_LEN
]
=
{};
char
mountCmd
[
MOUNT_CMD_MAX_LEN
]
=
{};
// Mount eng_system
// Mount eng_system
BuildMountCmd
(
mountCmd
,
MOUNT_CMD_MAX_LEN
,
"/eng_system"
,
BuildMountCmd
(
mountCmd
,
MOUNT_CMD_MAX_LEN
,
"/eng_system"
,
"/dev/block/by-name/eng_system"
,
"ext4"
);
"/dev/block/by-name/eng_system"
,
"ext4"
);
WaitForFile
(
ENG_SYSTEM_DEVICE_PATH
,
WAIT_MAX_SECOND
);
WaitForFile
(
ENG_SYSTEM_DEVICE_PATH
,
WAIT_MAX_SECOND
);
DoCmdByName
(
"mount "
,
mountCmd
);
DoCmdByName
(
"mount "
,
mountCmd
);
// Mount eng_chipset
// Mount eng_chipset
BuildMountCmd
(
mountCmd
,
MOUNT_CMD_MAX_LEN
,
"/eng_chipset"
,
BuildMountCmd
(
mountCmd
,
MOUNT_CMD_MAX_LEN
,
"/eng_chipset"
,
"/dev/block/by-name/eng_chipset"
,
"ext4"
);
"/dev/block/by-name/eng_chipset"
,
"ext4"
);
...
@@ -156,7 +154,7 @@ ENG_STATIC void DebugFilesOverlay(const char *source, const char *target)
...
@@ -156,7 +154,7 @@ ENG_STATIC void DebugFilesOverlay(const char *source, const char *target)
if
(
de
->
d_name
[
0
]
==
'.'
)
{
if
(
de
->
d_name
[
0
]
==
'.'
)
{
continue
;
continue
;
}
}
if
(
snprintf_s
(
srcPath
,
PATH_MAX
,
PATH_MAX
-
1
,
"%s/%s"
,
source
,
de
->
d_name
)
==
-
1
)
{
if
(
snprintf_s
(
srcPath
,
PATH_MAX
,
PATH_MAX
-
1
,
"%s/%s"
,
source
,
de
->
d_name
)
==
-
1
)
{
PLUGIN_LOGE
(
"Failed to build path for overlaying"
);
PLUGIN_LOGE
(
"Failed to build path for overlaying"
);
break
;
break
;
}
}
...
...
services/modules/init_eng/init_eng_static.c
浏览文件 @
f400ae70
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
static
int
InitEngEarlyHook
(
const
HOOK_INFO
*
info
,
void
*
cookie
)
static
int
InitEngEarlyHook
(
const
HOOK_INFO
*
info
,
void
*
cookie
)
{
{
char
value
[
MAX_BUFFER_LEN
]
=
{
0
};
char
value
[
MAX_BUFFER_LEN
]
=
{
0
};
int
ret
=
GetParameterFromCmdLine
(
"eng_mode"
,
value
,
MAX_BUFFER_LEN
);
int
ret
=
GetParameterFromCmdLine
(
"eng_mode"
,
value
,
MAX_BUFFER_LEN
);
if
(
ret
==
0
&&
strcmp
(
value
,
"on"
)
==
0
)
{
if
(
ret
==
0
&&
strcmp
(
value
,
"on"
)
==
0
)
{
...
...
services/modules/init_hook/init_hook.c
浏览文件 @
f400ae70
...
@@ -143,7 +143,7 @@ static int CmdClear(int id, const char *name, int argc, const char **argv)
...
@@ -143,7 +143,7 @@ static int CmdClear(int id, const char *name, int argc, const char **argv)
return
0
;
return
0
;
}
}
static
void
SetLogLevel
_
(
const
char
*
value
)
static
void
SetLogLevel
Func
(
const
char
*
value
)
{
{
unsigned
int
level
;
unsigned
int
level
;
int
ret
=
StringToUint
(
value
,
&
level
);
int
ret
=
StringToUint
(
value
,
&
level
);
...
@@ -159,20 +159,20 @@ static int CmdSetLogLevel(int id, const char *name, int argc, const char **argv)
...
@@ -159,20 +159,20 @@ static int CmdSetLogLevel(int id, const char *name, int argc, const char **argv)
PLUGIN_CHECK
(
argc
>=
1
,
return
-
1
,
"Invalid input args"
);
PLUGIN_CHECK
(
argc
>=
1
,
return
-
1
,
"Invalid input args"
);
const
char
*
value
=
strrchr
(
argv
[
0
],
'.'
);
const
char
*
value
=
strrchr
(
argv
[
0
],
'.'
);
PLUGIN_CHECK
(
value
!=
NULL
,
return
-
1
,
"Failed get
\'
.
\'
from string %s"
,
argv
[
0
]);
PLUGIN_CHECK
(
value
!=
NULL
,
return
-
1
,
"Failed get
\'
.
\'
from string %s"
,
argv
[
0
]);
SetLogLevel
_
(
value
+
1
);
SetLogLevel
Func
(
value
+
1
);
return
0
;
return
0
;
}
}
static
int
i
nitCmd
(
int
id
,
const
char
*
name
,
int
argc
,
const
char
**
argv
)
static
int
I
nitCmd
(
int
id
,
const
char
*
name
,
int
argc
,
const
char
**
argv
)
{
{
UNUSED
(
id
);
UNUSED
(
id
);
// process cmd by name
// process cmd by name
PLUGIN_LOGI
(
"
i
nitCmd %s argc %d"
,
name
,
argc
);
PLUGIN_LOGI
(
"
I
nitCmd %s argc %d"
,
name
,
argc
);
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
PLUGIN_LOGI
(
"
i
nitCmd %s"
,
argv
[
i
]);
PLUGIN_LOGI
(
"
I
nitCmd %s"
,
argv
[
i
]);
}
}
if
(
argc
>
1
&&
strcmp
(
argv
[
0
],
"setloglevel"
)
==
0
)
{
if
(
argc
>
1
&&
strcmp
(
argv
[
0
],
"setloglevel"
)
==
0
)
{
SetLogLevel
_
(
argv
[
1
]);
SetLogLevel
Func
(
argv
[
1
]);
}
}
return
0
;
return
0
;
}
}
...
@@ -181,7 +181,7 @@ static int ParamSetInitCmdHook(const HOOK_INFO *hookInfo, void *cookie)
...
@@ -181,7 +181,7 @@ static int ParamSetInitCmdHook(const HOOK_INFO *hookInfo, void *cookie)
{
{
AddCmdExecutor
(
"clear"
,
CmdClear
);
AddCmdExecutor
(
"clear"
,
CmdClear
);
AddCmdExecutor
(
"setloglevel"
,
CmdSetLogLevel
);
AddCmdExecutor
(
"setloglevel"
,
CmdSetLogLevel
);
AddCmdExecutor
(
"initcmd"
,
i
nitCmd
);
AddCmdExecutor
(
"initcmd"
,
I
nitCmd
);
return
0
;
return
0
;
}
}
...
@@ -213,7 +213,7 @@ static void InitLogLevelFromPersist(void)
...
@@ -213,7 +213,7 @@ static void InitLogLevelFromPersist(void)
uint32_t
len
=
sizeof
(
logLevel
);
uint32_t
len
=
sizeof
(
logLevel
);
int
ret
=
SystemReadParam
(
INIT_DEBUG_LEVEL
,
logLevel
,
&
len
);
int
ret
=
SystemReadParam
(
INIT_DEBUG_LEVEL
,
logLevel
,
&
len
);
INIT_INFO_CHECK
(
ret
==
0
,
return
,
"Can not get log level from param, keep the original loglevel."
);
INIT_INFO_CHECK
(
ret
==
0
,
return
,
"Can not get log level from param, keep the original loglevel."
);
SetLogLevel
_
(
logLevel
);
SetLogLevel
Func
(
logLevel
);
return
;
return
;
}
}
...
...
test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp
浏览文件 @
f400ae70
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "service_watcher.h"
#include "service_watcher.h"
#include "fuzz_utils.h"
#include "fuzz_utils.h"
void
callback
(
const
char
*
key
,
const
ServiceInfo
*
status
)
static
void
callback
(
const
char
*
key
,
const
ServiceInfo
*
status
)
{
{
printf
(
"key is: %s, ServiceStatus is: %d
\n
"
,
key
,
status
->
status
);
printf
(
"key is: %s, ServiceStatus is: %d
\n
"
,
key
,
status
->
status
);
}
}
...
...
test/unittest/param/watcher_agent_unittest.cpp
浏览文件 @
f400ae70
...
@@ -172,16 +172,16 @@ public:
...
@@ -172,16 +172,16 @@ public:
instance
.
remoteWatcher_
->
OnRemoteRequest
(
IWatcher
::
PARAM_CHANGE
,
data
,
reply
,
option
);
instance
.
remoteWatcher_
->
OnRemoteRequest
(
IWatcher
::
PARAM_CHANGE
,
data
,
reply
,
option
);
instance
.
remoteWatcher_
->
OnRemoteRequest
(
IWatcher
::
PARAM_CHANGE
+
1
,
data
,
reply
,
option
);
instance
.
remoteWatcher_
->
OnRemoteRequest
(
IWatcher
::
PARAM_CHANGE
+
1
,
data
,
reply
,
option
);
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname"
,
"testvalue"
);
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname"
,
"testvalue"
);
EXPECT_EQ
(
g_callbackCount
,
2
);
EXPECT_EQ
(
g_callbackCount
,
2
);
// 2 is callback Count
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname.2"
,
"testvalue"
);
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname.2"
,
"testvalue"
);
EXPECT_EQ
(
g_callbackCount
,
3
);
EXPECT_EQ
(
g_callbackCount
,
3
);
// 3 is callback Count
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname.2"
,
"testvalue"
);
instance
.
remoteWatcher_
->
OnParameterChange
(
name
.
c_str
(),
"testname.2"
,
"testvalue"
);
EXPECT_EQ
(
g_callbackCount
,
3
);
EXPECT_EQ
(
g_callbackCount
,
3
);
// 3 is callback Count
// prefix not exit
// prefix not exit
instance
.
remoteWatcher_
->
OnParameterChange
(
"44444444444444444444"
,
"testname.2"
,
"testvalue"
);
instance
.
remoteWatcher_
->
OnParameterChange
(
"44444444444444444444"
,
"testname.2"
,
"testvalue"
);
}
}
EXPECT_EQ
(
g_callbackCount
,
3
);
EXPECT_EQ
(
g_callbackCount
,
3
);
// 3 is callback Count
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录