Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
ef2dfae1
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,发现更多精彩内容 >>
提交
ef2dfae1
编写于
9月 28, 2021
作者:
S
sun_fan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init: fix codedex ..
Signed-off-by:
N
sun_fan
<
sun_fan1@hoperun.com
>
上级
be920288
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
50 addition
and
31 deletion
+50
-31
interfaces/innerkits/dynamic_service/dynamic_service.c
interfaces/innerkits/dynamic_service/dynamic_service.c
+0
-1
interfaces/innerkits/socket/init_socket.c
interfaces/innerkits/socket/init_socket.c
+1
-0
services/cmds/reboot/init_cmd_reboot.c
services/cmds/reboot/init_cmd_reboot.c
+1
-1
services/include/device.h
services/include/device.h
+2
-1
services/log/init_log.c
services/log/init_log.c
+1
-0
services/log/init_log.h
services/log/init_log.h
+8
-2
services/src/init_capability.c
services/src/init_capability.c
+1
-1
services/src/init_cmds.c
services/src/init_cmds.c
+9
-9
services/src/init_import.c
services/src/init_import.c
+1
-1
services/src/init_service.c
services/src/init_service.c
+2
-2
services/src/init_service_manager.c
services/src/init_service_manager.c
+3
-1
services/src/init_service_socket.c
services/src/init_service_socket.c
+1
-0
services/src/main.c
services/src/main.c
+1
-3
ueventd/ueventd_device_handler.c
ueventd/ueventd_device_handler.c
+19
-9
未找到文件。
interfaces/innerkits/dynamic_service/dynamic_service.c
浏览文件 @
ef2dfae1
...
...
@@ -15,7 +15,6 @@
#include "dynamic_service.h"
#include <stdio.h>
#include "hilog/log.h"
#include "parameter.h"
...
...
interfaces/innerkits/socket/init_socket.c
浏览文件 @
ef2dfae1
...
...
@@ -14,6 +14,7 @@
*/
#include "init_socket.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
...
...
services/cmds/reboot/init_cmd_reboot.c
浏览文件 @
ef2dfae1
...
...
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
printf
(
"%s"
,
USAGE_INFO
);
return
0
;
}
int
ret
=
0
;
int
ret
;
if
(
argc
==
REBOOT_CMD_NUMBER
)
{
ret
=
DoReboot
(
argv
[
1
]);
}
else
{
...
...
services/include/device.h
浏览文件 @
ef2dfae1
...
...
@@ -16,12 +16,13 @@
#ifndef BASE_STARTUP_INITLITE_DEVICE_H
#define BASE_STARTUP_INITLITE_DEVICE_H
#include <sys/types.h>
#ifdef __cplusplus
#if __cplusplus
extern
"C"
{
#endif
#endif
#include <sys/types.h>
#define DEV_KMSG_MINOR 11
#define DEV_NULL_MINOR 3
...
...
services/log/init_log.c
浏览文件 @
ef2dfae1
...
...
@@ -14,6 +14,7 @@
*/
#include "init_log.h"
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
...
...
services/log/init_log.h
浏览文件 @
ef2dfae1
...
...
@@ -19,6 +19,13 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef OHOS_LITE
#include "hilog/log.h"
#else
#ifdef INIT_AGENT
#include "hilog/log.h"
#endif
#endif
#ifdef __cplusplus
#if __cplusplus
...
...
@@ -43,7 +50,6 @@ typedef enum InitLogLevel {
#endif
#ifdef OHOS_LITE
#include "hilog/log.h"
#undef LOG_DOMAIN
#define LOG_DOMAIN 0xD000719
...
...
@@ -74,7 +80,7 @@ void SetHiLogLevel(LogLevel logLevel);
#define STARTUP_LOGI(LABEL, fmt, ...) InitLog(INIT_INFO, (FILE_NAME), (__LINE__), "<6>", fmt "\n", ##__VA_ARGS__)
#define STARTUP_LOGE(LABEL, fmt, ...) InitLog(INIT_ERROR, (FILE_NAME), (__LINE__), "<3>", fmt "\n", ##__VA_ARGS__)
#else
#include "hilog/log.h"
#define PARAM_AGENT_LOG_PATH "/data/init_agent/init_agent.log"
#define STARTUP_LOGD(LABEL, fmt, ...) \
...
...
services/src/init_capability.c
浏览文件 @
ef2dfae1
...
...
@@ -109,7 +109,7 @@ static int GetServiceStringCaps(const cJSON* filedJ, Service* curServ)
return
SERVICE_FAILURE
;
}
}
int
ret
=
(
i
==
curServ
->
servPerm
.
capsCnt
?
SERVICE_SUCCESS
:
SERVICE_FAILURE
);
int
ret
=
(
(
i
==
curServ
->
servPerm
.
capsCnt
)
?
SERVICE_SUCCESS
:
SERVICE_FAILURE
);
return
ret
;
}
...
...
services/src/init_cmds.c
浏览文件 @
ef2dfae1
...
...
@@ -403,9 +403,8 @@ static void DoCopyInernal(const char *source, const char *target)
if
(
dstFd
>=
0
)
{
char
buf
[
MAX_COPY_BUF_SIZE
]
=
{
0
};
ssize_t
readn
=
-
1
;
ssize_t
writen
=
-
1
;
while
((
readn
=
read
(
srcFd
,
buf
,
MAX_COPY_BUF_SIZE
-
1
))
>
0
)
{
writen
=
WriteAll
(
dstFd
,
buf
,
(
size_t
)
readn
);
ssize_t
writen
=
WriteAll
(
dstFd
,
buf
,
(
size_t
)
readn
);
if
(
writen
!=
readn
)
{
isSuccess
=
false
;
break
;
...
...
@@ -499,7 +498,7 @@ static void DoMkDir(const char *cmdContent, int maxArg)
FreeCmd
(
ctx
);
return
;
}
int
rc
=
-
1
;
int
rc
;
do
{
int
index
=
0
;
rc
=
mkdir
(
ctx
->
argv
[
index
],
DEFAULT_DIR_MODE
);
...
...
@@ -519,12 +518,13 @@ static void DoMkDir(const char *cmdContent, int maxArg)
break
;
}
index
=
index
+
1
;
if
(
ctx
->
argv
[
index
]
!=
NULL
)
{
if
(
ctx
->
argv
[
index
+
1
]
!=
NULL
)
{
rc
=
Chown
(
ctx
->
argv
[
0
],
ctx
->
argv
[
index
],
ctx
->
argv
[
index
+
1
]);
}
else
{
rc
=
-
1
;
}
if
(
ctx
->
argv
[
index
]
==
NULL
)
{
break
;
}
if
(
ctx
->
argv
[
index
+
1
]
!=
NULL
)
{
rc
=
Chown
(
ctx
->
argv
[
0
],
ctx
->
argv
[
index
],
ctx
->
argv
[
index
+
1
]);
}
else
{
rc
=
-
1
;
}
}
}
while
(
0
);
...
...
services/src/init_import.c
浏览文件 @
ef2dfae1
...
...
@@ -14,7 +14,7 @@
*/
#include "init_import.h"
#include <stdio.h>
#include <unistd.h>
#include "cJSON.h"
#include "init_cmds.h"
...
...
services/src/init_service.c
浏览文件 @
ef2dfae1
...
...
@@ -220,8 +220,8 @@ int ServiceStart(Service *service)
service
->
pid
=
pid
;
#ifndef OHOS_LITE
char
paramName
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
INIT_CHECK_ONLY_ELOG
(
snprintf_s
(
paramName
,
PARAM_NAME_LEN_MAX
,
PARAM_NAME_LEN_MAX
-
1
,
"init.svc.%s"
,
service
->
name
)
>=
0
,
"snprintf_s paramName error %d "
,
errno
);
int
ret
=
snprintf_s
(
paramName
,
PARAM_NAME_LEN_MAX
,
PARAM_NAME_LEN_MAX
-
1
,
"init.svc.%s"
,
service
->
name
);
INIT_CHECK_ONLY_ELOG
(
ret
>=
0
,
"snprintf_s paramName error %d "
,
errno
);
SystemWriteParam
(
paramName
,
"running"
);
#endif
return
SERVICE_SUCCESS
;
...
...
services/src/init_service_manager.c
浏览文件 @
ef2dfae1
...
...
@@ -768,7 +768,9 @@ void ParseAllServices(const cJSON* fileRoot)
tmp
[
i
].
socketCfg
=
NULL
;
}
}
(
void
)
GetServiceOnRestart
(
curItem
,
&
tmp
[
i
]);
if
(
GetServiceOnRestart
(
curItem
,
&
tmp
[
i
])
==
SERVICE_FAILURE
)
{
INIT_LOGE
(
"Failed Get Service OnRestart service"
);
}
}
// Increase service counter.
RegisterServices
(
retServices
,
servArrSize
);
...
...
services/src/init_service_socket.c
浏览文件 @
ef2dfae1
...
...
@@ -14,6 +14,7 @@
*/
#include "init_service_socket.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
...
...
services/src/main.c
浏览文件 @
ef2dfae1
...
...
@@ -67,9 +67,7 @@ static long TimeDiffMs(const struct timespec* tmBefore, const struct timespec* t
int
main
(
int
argc
,
char
**
argv
)
{
#ifndef OHOS_LITE
if
(
setenv
(
"UV_THREADPOOL_SIZE"
,
"1"
,
1
)
!=
0
)
{
INIT_LOGE
(
"set UV_THREADPOOL_SIZE error : %d."
,
errno
);
}
INIT_CHECK_ONLY_ELOG
(
setenv
(
"UV_THREADPOOL_SIZE"
,
"1"
,
1
)
==
0
,
"set UV_THREADPOOL_SIZE error : %d."
,
errno
);
CloseStdio
();
OpenLogDevice
();
#endif
...
...
ueventd/ueventd_device_handler.c
浏览文件 @
ef2dfae1
...
...
@@ -167,23 +167,33 @@ static char *FindPlatformDeviceName(char *path)
return
NULL
;
}
static
void
BuildDeviceSymbolLinks
(
char
**
links
,
int
linkNum
,
const
char
*
parent
,
const
char
*
partitionName
)
static
void
BuildDeviceSymbolLinks
(
char
**
links
,
int
linkNum
,
const
char
*
parent
,
const
char
*
partitionName
,
const
char
*
deviceName
)
{
if
(
linkNum
>
BLOCKDEVICE_LINKS
-
1
)
{
INIT_LOGW
(
"Too many links, ignore"
);
if
((
linkNum
>
BLOCKDEVICE_LINKS
-
1
)
||
(
linkNum
<
0
))
{
INIT_LOGW
(
"Failed set linkNum, links ignore"
);
return
;
}
if
(
parent
==
NULL
||
partitionName
==
NULL
||
deviceName
==
NULL
)
{
return
;
}
links
[
linkNum
]
=
calloc
(
sizeof
(
char
),
DEVICE_FILE_SIZE
);
if
(
links
[
linkNum
]
==
NULL
)
{
INIT_LOGE
(
"Failed to allocate memory for link, err = %d"
,
errno
);
return
;
}
// If a block device without partition name.
// For now, we will not create symbol link for it.
if
(
!
INVALIDSTRING
(
partitionName
))
{
links
[
linkNum
]
=
calloc
(
sizeof
(
char
),
DEVICE_FILE_SIZE
);
if
(
links
[
linkNum
]
==
NULL
)
{
INIT_LOGE
(
"Failed to allocate memory for link, err = %d"
,
errno
);
return
;
if
(
snprintf_s
(
links
[
linkNum
],
DEVICE_FILE_SIZE
,
DEVICE_FILE_SIZE
-
1
,
"/dev/block/platform/%s/by-name/%s"
,
parent
,
partitionName
)
==
-
1
)
{
INIT_LOGE
(
"Failed to build link"
);
}
}
else
if
(
!
INVALIDSTRING
(
deviceName
))
{
// If a device does not have a partition name, create a symbol link for it separately.
if
(
snprintf_s
(
links
[
linkNum
],
DEVICE_FILE_SIZE
,
DEVICE_FILE_SIZE
-
1
,
"/dev/block/platform/%s/by-name/%s"
,
parent
,
partition
Name
)
==
-
1
)
{
"/dev/block/platform/%s/%s"
,
parent
,
device
Name
)
==
-
1
)
{
INIT_LOGE
(
"Failed to build link"
);
}
}
...
...
@@ -232,7 +242,7 @@ static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent)
INIT_LOGD
(
"Find a platform device: %s"
,
parent
);
parent
=
FindPlatformDeviceName
(
parent
);
if
(
parent
!=
NULL
)
{
BuildDeviceSymbolLinks
(
links
,
linkNum
,
parent
,
uevent
->
partitionName
);
BuildDeviceSymbolLinks
(
links
,
linkNum
,
parent
,
uevent
->
partitionName
,
uevent
->
deviceName
);
}
linkNum
++
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录