Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
db4f395b
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,发现更多精彩内容 >>
未验证
提交
db4f395b
编写于
8月 02, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
!974 【OpenHarmony开源贡献者计划2022】 修改单词拼写错误
Merge pull request !974 from Mupceet/init_725
上级
05295b8a
3c45b38c
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
44 addition
and
44 deletion
+44
-44
device_info/device_info_load.cpp
device_info/device_info_load.cpp
+2
-2
interfaces/innerkits/control_fd/control_fd_client.c
interfaces/innerkits/control_fd/control_fd_client.c
+4
-4
interfaces/innerkits/control_fd/control_fd_service.c
interfaces/innerkits/control_fd/control_fd_service.c
+4
-4
interfaces/innerkits/include/service_control.h
interfaces/innerkits/include/service_control.h
+1
-1
services/loopevent/include/loop_event.h
services/loopevent/include/loop_event.h
+7
-7
services/loopevent/task/le_streamtask.c
services/loopevent/task/le_streamtask.c
+11
-11
services/loopevent/task/le_task.h
services/loopevent/task/le_task.h
+4
-4
services/param/linux/param_message.c
services/param/linux/param_message.c
+2
-2
services/param/linux/param_message.h
services/param/linux/param_message.h
+2
-2
services/param/linux/param_msgadp.c
services/param/linux/param_msgadp.c
+2
-2
services/param/linux/param_request.c
services/param/linux/param_request.c
+1
-1
services/param/watcher/proxy/watcher_manager.cpp
services/param/watcher/proxy/watcher_manager.cpp
+1
-1
services/utils/init_utils.c
services/utils/init_utils.c
+1
-1
test/unittest/init/loopevent_unittest.cpp
test/unittest/init/loopevent_unittest.cpp
+2
-2
未找到文件。
device_info/device_info_load.cpp
浏览文件 @
db4f395b
...
...
@@ -28,7 +28,7 @@ void DeviceInfoLoad::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
const
sptr
<
IRemoteObject
>&
remoteObject
)
{
DINFO_CHECK
(
systemAbilityId
==
SYSPARAM_DEVICE_SERVICE_ID
,
return
,
"start
a
ystemabilityId is not deviceinfo! %d"
,
systemAbilityId
);
"start
s
ystemabilityId is not deviceinfo! %d"
,
systemAbilityId
);
DINFO_CHECK
(
remoteObject
!=
nullptr
,
return
,
"remoteObject is null."
);
DINFO_LOGI
(
"OnLoadSystemAbilitySuccess start systemAbilityId: %d success!"
,
systemAbilityId
);
...
...
@@ -38,7 +38,7 @@ void DeviceInfoLoad::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
void
DeviceInfoLoad
::
OnLoadSystemAbilityFail
(
int32_t
systemAbilityId
)
{
DINFO_CHECK
(
systemAbilityId
==
SYSPARAM_DEVICE_SERVICE_ID
,
return
,
"start
a
ystemabilityId is not deviceinfo! %d"
,
systemAbilityId
);
"start
s
ystemabilityId is not deviceinfo! %d"
,
systemAbilityId
);
DINFO_LOGI
(
"OnLoadSystemAbilityFail systemAbilityId: %d failed."
,
systemAbilityId
);
...
...
interfaces/innerkits/control_fd/control_fd_client.c
浏览文件 @
db4f395b
...
...
@@ -68,9 +68,9 @@ static void CmdOnRecvMessage(const TaskHandle task, const uint8_t *buffer, uint3
BEGET_LOGI
(
"[control_fd] CmdOnRecvMessage %s len %d."
,
(
char
*
)
buffer
,
buffLen
);
}
static
void
CmdOnConn
t
ectComplete
(
const
TaskHandle
client
)
static
void
CmdOnConnectComplete
(
const
TaskHandle
client
)
{
BEGET_LOGI
(
"[control_fd] CmdOnConn
t
ectComplete"
);
BEGET_LOGI
(
"[control_fd] CmdOnConnectComplete"
);
}
static
void
CmdOnClose
(
const
TaskHandle
task
)
...
...
@@ -105,8 +105,8 @@ static CmdAgent *CmdAgentCreate(const char *server)
info
.
server
=
(
char
*
)
server
;
info
.
baseInfo
.
userDataSize
=
sizeof
(
CmdAgent
);
info
.
baseInfo
.
close
=
CmdOnClose
;
info
.
disConn
t
ectComplete
=
CmdDisConnectComplete
;
info
.
connectComplete
=
CmdOnConn
t
ectComplete
;
info
.
disConnectComplete
=
CmdDisConnectComplete
;
info
.
connectComplete
=
CmdOnConnectComplete
;
info
.
sendMessageComplete
=
CmdOnSendMessageComplete
;
info
.
recvMessage
=
CmdOnRecvMessage
;
LE_STATUS
status
=
LE_CreateStreamClient
(
LE_GetDefaultLoop
(),
&
task
,
&
info
);
...
...
interfaces/innerkits/control_fd/control_fd_service.c
浏览文件 @
db4f395b
...
...
@@ -88,14 +88,14 @@ static int SendMessage(LoopHandle loop, TaskHandle task, const char *message)
return
0
;
}
static
int
CmdOnIncommingConn
t
ect
(
const
LoopHandle
loop
,
const
TaskHandle
server
)
static
int
CmdOnIncommingConnect
(
const
LoopHandle
loop
,
const
TaskHandle
server
)
{
TaskHandle
client
=
NULL
;
LE_StreamInfo
info
=
{};
info
.
baseInfo
.
flags
=
TASK_STREAM
|
TASK_PIPE
|
TASK_CONNECT
;
info
.
baseInfo
.
close
=
OnClose
;
info
.
baseInfo
.
userDataSize
=
sizeof
(
CmdTask
);
info
.
disConn
t
ectComplete
=
NULL
;
info
.
disConnectComplete
=
NULL
;
info
.
sendMessageComplete
=
NULL
;
info
.
recvMessage
=
CmdOnRecvMessage
;
int
ret
=
LE_AcceptStreamClient
(
LE_GetDefaultLoop
(),
server
,
&
client
,
&
info
);
...
...
@@ -122,8 +122,8 @@ void CmdServiceInit(const char *socketPath, CallbackControlFdProcess func)
info
.
server
=
(
char
*
)
socketPath
;
info
.
socketId
=
-
1
;
info
.
baseInfo
.
close
=
NULL
;
info
.
disConn
t
ectComplete
=
NULL
;
info
.
incommingConn
tect
=
CmdOnIncommingConnt
ect
;
info
.
disConnectComplete
=
NULL
;
info
.
incommingConn
ect
=
CmdOnIncommingConn
ect
;
info
.
sendMessageComplete
=
NULL
;
info
.
recvMessage
=
NULL
;
g_controlFdFunc
=
func
;
...
...
interfaces/innerkits/include/service_control.h
浏览文件 @
db4f395b
...
...
@@ -37,7 +37,7 @@ typedef enum {
SERVICE_SUSPENDED
,
SERVICE_FREEZED
,
SERVICE_DISABLED
,
SERVICE_CRITIAL
SERVICE_CRITI
C
AL
}
ServiceStatus
;
enum
ServiceAction
{
...
...
services/loopevent/include/loop_event.h
浏览文件 @
db4f395b
...
...
@@ -93,17 +93,17 @@ typedef struct {
#define TASK_SERVER (0x01 << 16)
#define TASK_CONNECT (0x02 << 16)
#define TASK_TEST (0x01 << 24)
typedef
void
(
*
LE_DisConn
t
ectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_Conn
t
ectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_DisConnectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_ConnectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_SendMessageComplete
)(
const
TaskHandle
taskHandle
,
BufferHandle
handle
);
typedef
void
(
*
LE_RecvMessage
)(
const
TaskHandle
taskHandle
,
const
uint8_t
*
buffer
,
uint32_t
buffLen
);
typedef
int
(
*
LE_IncommingConn
t
ect
)(
const
LoopHandle
loopHandle
,
const
TaskHandle
serverTask
);
typedef
int
(
*
LE_IncommingConnect
)(
const
LoopHandle
loopHandle
,
const
TaskHandle
serverTask
);
typedef
struct
{
LE_BaseInfo
baseInfo
;
char
*
server
;
int
socketId
;
LE_DisConn
tectComplete
disConnt
ectComplete
;
LE_IncommingConn
tect
incommingConnt
ect
;
LE_DisConn
ectComplete
disConn
ectComplete
;
LE_IncommingConn
ect
incommingConn
ect
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
}
LE_StreamServerInfo
;
...
...
@@ -111,8 +111,8 @@ typedef struct {
typedef
struct
{
LE_BaseInfo
baseInfo
;
char
*
server
;
LE_DisConn
tectComplete
disConnt
ectComplete
;
LE_Conn
t
ectComplete
connectComplete
;
LE_DisConn
ectComplete
disConn
ectComplete
;
LE_ConnectComplete
connectComplete
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
}
LE_StreamInfo
;
...
...
services/loopevent/task/le_streamtask.c
浏览文件 @
db4f395b
...
...
@@ -93,8 +93,8 @@ static LE_STATUS HandleStreamEvent_(const LoopHandle loopHandle, const TaskHandl
}
if
(
status
==
LE_DIS_CONNECTED
)
{
loop
->
delEvent
(
loop
,
GetSocketFd
(
handle
),
Event_Read
|
Event_Write
);
if
(
stream
->
disConn
t
ectComplete
)
{
stream
->
disConn
t
ectComplete
(
handle
);
if
(
stream
->
disConnectComplete
)
{
stream
->
disConnectComplete
(
handle
);
}
LE_CloseStreamTask
(
loopHandle
,
handle
);
}
...
...
@@ -116,8 +116,8 @@ static LE_STATUS HandleClientEvent_(const LoopHandle loopHandle, const TaskHandl
status
=
HandleRecvMsg_
(
loopHandle
,
handle
,
client
->
recvMessage
);
}
if
(
status
==
LE_DIS_CONNECTED
)
{
if
(
client
->
disConn
t
ectComplete
)
{
client
->
disConn
t
ectComplete
(
handle
);
if
(
client
->
disConnectComplete
)
{
client
->
disConnectComplete
(
handle
);
}
client
->
connected
=
0
;
LE_CloseStreamTask
(
loopHandle
,
handle
);
...
...
@@ -141,9 +141,9 @@ static LE_STATUS HandleServerEvent_(const LoopHandle loopHandle, const TaskHandl
return
LE_FAILURE
;
}
StreamServerTask
*
server
=
(
StreamServerTask
*
)
serverTask
;
LE_ONLY_CHECK
(
server
->
incommingConn
t
ect
!=
NULL
,
return
LE_SUCCESS
);
LE_ONLY_CHECK
(
server
->
incommingConnect
!=
NULL
,
return
LE_SUCCESS
);
int
ret
=
server
->
incommingConn
t
ect
(
loopHandle
,
serverTask
);
int
ret
=
server
->
incommingConnect
(
loopHandle
,
serverTask
);
if
(
ret
!=
LE_SUCCESS
)
{
LE_LOGE
(
"HandleServerEvent_ fd %d do not accept socket"
,
GetSocketFd
(
serverTask
));
}
...
...
@@ -157,8 +157,8 @@ LE_STATUS LE_CreateStreamServer(const LoopHandle loopHandle,
{
LE_CHECK
(
loopHandle
!=
NULL
&&
taskHandle
!=
NULL
&&
info
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters"
);
LE_CHECK
(
info
->
server
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters server"
);
LE_CHECK
(
info
->
incommingConn
t
ect
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters incommingConn
t
ect %s"
,
info
->
server
);
LE_CHECK
(
info
->
incommingConnect
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters incommingConnect %s"
,
info
->
server
);
int
fd
=
info
->
socketId
;
if
(
info
->
socketId
<=
0
)
{
...
...
@@ -173,7 +173,7 @@ LE_STATUS LE_CreateStreamServer(const LoopHandle loopHandle,
return
LE_NO_MEMORY
,
"Failed to create task"
);
task
->
base
.
handleEvent
=
HandleServerEvent_
;
task
->
base
.
innerClose
=
HandleStreamTaskClose_
;
task
->
incommingConn
tect
=
info
->
incommingConnt
ect
;
task
->
incommingConn
ect
=
info
->
incommingConn
ect
;
loop
->
addEvent
(
loop
,
(
const
BaseTask
*
)
task
,
Event_Read
);
int
ret
=
memcpy_s
(
task
->
server
,
strlen
(
info
->
server
)
+
1
,
info
->
server
,
strlen
(
info
->
server
)
+
1
);
LE_CHECK
(
ret
==
0
,
return
LE_FAILURE
,
"Failed to copy server name %s"
,
info
->
server
);
...
...
@@ -201,7 +201,7 @@ LE_STATUS LE_CreateStreamClient(const LoopHandle loopHandle,
task
->
connectComplete
=
info
->
connectComplete
;
task
->
sendMessageComplete
=
info
->
sendMessageComplete
;
task
->
recvMessage
=
info
->
recvMessage
;
task
->
disConn
tectComplete
=
info
->
disConnt
ectComplete
;
task
->
disConn
ectComplete
=
info
->
disConn
ectComplete
;
EventLoop
*
loop
=
(
EventLoop
*
)
loopHandle
;
loop
->
addEvent
(
loop
,
(
const
BaseTask
*
)
task
,
Event_Read
);
*
taskHandle
=
(
TaskHandle
)
task
;
...
...
@@ -225,7 +225,7 @@ LE_STATUS LE_AcceptStreamClient(const LoopHandle loopHandle, const TaskHandle se
return
LE_NO_MEMORY
,
"Failed to create task"
);
task
->
stream
.
base
.
handleEvent
=
HandleStreamEvent_
;
task
->
stream
.
base
.
innerClose
=
HandleStreamTaskClose_
;
task
->
disConn
tectComplete
=
info
->
disConnt
ectComplete
;
task
->
disConn
ectComplete
=
info
->
disConn
ectComplete
;
task
->
sendMessageComplete
=
info
->
sendMessageComplete
;
task
->
recvMessage
=
info
->
recvMessage
;
task
->
serverTask
=
(
StreamServerTask
*
)
server
;
...
...
services/loopevent/task/le_task.h
浏览文件 @
db4f395b
...
...
@@ -72,7 +72,7 @@ typedef struct LiteTask_ {
typedef
struct
{
BaseTask
base
;
LE_IncommingConn
tect
incommingConnt
ect
;
LE_IncommingConn
ect
incommingConn
ect
;
char
server
[
0
];
}
StreamServerTask
;
...
...
@@ -91,13 +91,13 @@ typedef struct {
StreamServerTask
*
serverTask
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
LE_DisConn
tectComplete
disConnt
ectComplete
;
LE_DisConn
ectComplete
disConn
ectComplete
;
}
StreamConnectTask
;
typedef
struct
{
StreamTask
stream
;
LE_DisConn
tectComplete
disConnt
ectComplete
;
LE_Conn
t
ectComplete
connectComplete
;
LE_DisConn
ectComplete
disConn
ectComplete
;
LE_ConnectComplete
connectComplete
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
uint32_t
connected
:
1
;
...
...
services/param/linux/param_message.c
浏览文件 @
db4f395b
...
...
@@ -20,7 +20,7 @@
#include "param_utils.h"
#include "securec.h"
int
Conn
t
ectServer
(
int
fd
,
const
char
*
servername
)
int
ConnectServer
(
int
fd
,
const
char
*
servername
)
{
PARAM_CHECK
(
fd
>=
0
,
return
-
1
,
"Invalid fd %d"
,
fd
);
int
opt
=
1
;
...
...
@@ -36,7 +36,7 @@ int ConntectServer(int fd, const char *servername)
int
len
=
offsetof
(
struct
sockaddr_un
,
sun_path
)
+
strlen
(
addr
.
sun_path
);
ret
=
connect
(
fd
,
(
struct
sockaddr
*
)
&
addr
,
len
);
PARAM_CHECK
(
ret
!=
-
1
,
return
-
1
,
"Failed to connect server %s %d"
,
servername
,
errno
);
PARAM_LOGV
(
"Conn
t
ectServer %s success"
,
servername
);
PARAM_LOGV
(
"ConnectServer %s success"
,
servername
);
return
0
;
}
...
...
services/param/linux/param_message.h
浏览文件 @
db4f395b
...
...
@@ -75,7 +75,7 @@ typedef int (*RecvMessage)(const ParamTaskPtr stream, const ParamMessage *msg);
typedef
struct
{
uint32_t
flags
;
char
*
server
;
LE_IncommingConn
t
ect
incomingConnect
;
LE_IncommingConnect
incomingConnect
;
RecvMessage
recvMessage
;
LE_Close
close
;
}
ParamStreamInfo
;
...
...
@@ -97,7 +97,7 @@ int FillParamMsgContent(const ParamMessage *request, uint32_t *start, int type,
ParamMsgContent
*
GetNextContent
(
const
ParamMessage
*
reqest
,
uint32_t
*
offset
);
ParamMessage
*
CreateParamMessage
(
int
type
,
const
char
*
name
,
uint32_t
msgSize
);
int
Conn
t
ectServer
(
int
fd
,
const
char
*
servername
);
int
ConnectServer
(
int
fd
,
const
char
*
servername
);
#ifdef STARTUP_INIT_TEST
int
ProcessMessage
(
const
ParamTaskPtr
worker
,
const
ParamMessage
*
msg
);
...
...
services/param/linux/param_msgadp.c
浏览文件 @
db4f395b
...
...
@@ -52,7 +52,7 @@ int ParamServerCreate(ParamTaskPtr *stream, const ParamStreamInfo *streamInfo)
info
.
baseInfo
.
flags
=
TASK_STREAM
|
TASK_PIPE
|
TASK_SERVER
;
info
.
server
=
streamInfo
->
server
;
info
.
baseInfo
.
close
=
streamInfo
->
close
;
info
.
incommingConn
t
ect
=
streamInfo
->
incomingConnect
;
info
.
incommingConnect
=
streamInfo
->
incomingConnect
;
return
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
stream
,
&
info
);
}
...
...
@@ -69,7 +69,7 @@ int ParamStreamCreate(ParamTaskPtr *stream, ParamTaskPtr server,
info
.
baseInfo
.
flags
|=
TASK_TEST
;
}
info
.
baseInfo
.
close
=
streamInfo
->
close
;
info
.
disConn
t
ectComplete
=
NULL
;
info
.
disConnectComplete
=
NULL
;
info
.
sendMessageComplete
=
NULL
;
info
.
recvMessage
=
OnReceiveRequest
;
g_recvMessage
=
streamInfo
->
recvMessage
;
...
...
services/param/linux/param_request.c
浏览文件 @
db4f395b
...
...
@@ -108,7 +108,7 @@ static int GetClientSocket(int timeout)
time
.
tv_usec
=
0
;
int
clientFd
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
0
);
PARAM_CHECK
(
clientFd
>=
0
,
return
-
1
,
"Failed to create socket"
);
int
ret
=
Conn
t
ectServer
(
clientFd
,
CLIENT_PIPE_NAME
);
int
ret
=
ConnectServer
(
clientFd
,
CLIENT_PIPE_NAME
);
if
(
ret
==
0
)
{
setsockopt
(
clientFd
,
SOL_SOCKET
,
SO_SNDTIMEO
,
(
char
*
)
&
time
,
sizeof
(
struct
timeval
));
setsockopt
(
clientFd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
char
*
)
&
time
,
sizeof
(
struct
timeval
));
...
...
services/param/watcher/proxy/watcher_manager.cpp
浏览文件 @
db4f395b
...
...
@@ -296,7 +296,7 @@ int WatcherManager::GetServerFd(bool retry)
serverFd_
=
socket
(
PF_UNIX
,
SOCK_STREAM
,
0
);
int
flags
=
fcntl
(
serverFd_
,
F_GETFL
,
0
);
(
void
)
fcntl
(
serverFd_
,
F_SETFL
,
flags
&
~
O_NONBLOCK
);
ret
=
Conn
t
ectServer
(
serverFd_
,
CLIENT_PIPE_NAME
);
ret
=
ConnectServer
(
serverFd_
,
CLIENT_PIPE_NAME
);
if
(
ret
==
0
)
{
break
;
}
...
...
services/utils/init_utils.c
浏览文件 @
db4f395b
...
...
@@ -543,7 +543,7 @@ const static InitArgInfo g_servieStatusMap[] = {
{
"suspended"
,
SERVICE_SUSPENDED
},
{
"freezed"
,
SERVICE_FREEZED
},
{
"disabled"
,
SERVICE_DISABLED
},
{
"criti
al"
,
SERVICE_CRITI
AL
}
{
"criti
cal"
,
SERVICE_CRITIC
AL
}
};
const
InitArgInfo
*
GetServieStatusMap
(
int
*
size
)
...
...
test/unittest/init/loopevent_unittest.cpp
浏览文件 @
db4f395b
...
...
@@ -163,7 +163,7 @@ public:
info
.
baseInfo
.
flags
=
TASK_STREAM
|
TASK_PIPE
|
TASK_SERVER
|
TASK_TEST
;
info
.
server
=
(
char
*
)
"/data/testpipe"
;
info
.
baseInfo
.
close
=
OnClose
;
info
.
incommingConn
t
ect
=
IncomingConnect
;
info
.
incommingConnect
=
IncomingConnect
;
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
&
serverTask_
,
&
info
);
if
(
serverTask_
==
nullptr
)
{
return
;
...
...
@@ -246,7 +246,7 @@ public:
info
.
baseInfo
.
flags
=
TASK_PIPE
|
TASK_CONNECT
|
TASK_TEST
;
info
.
server
=
(
char
*
)
"/data/testpipe"
;
info
.
baseInfo
.
close
=
OnClose
;
info
.
incommingConn
t
ect
=
IncomingConnect
;
info
.
incommingConnect
=
IncomingConnect
;
info
.
socketId
=
1111
;
// 1111 is test fd
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
&
serverTask
,
&
info
);
EXPECT_NE
(
serverTask
,
nullptr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录