Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
a68ecdc0
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看板
未验证
提交
a68ecdc0
编写于
8月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1084 optimize ueventd service
Merge pull request !1084 from cheng_jinsong/permanentUeventd
上级
d059c422
a158d49b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
5 deletion
+14
-5
services/etc/group
services/etc/group
+1
-0
services/etc/passwd
services/etc/passwd
+1
-0
services/etc/ueventd.cfg
services/etc/ueventd.cfg
+3
-0
ueventd/ueventd_device_handler.c
ueventd/ueventd_device_handler.c
+2
-2
ueventd/ueventd_main.c
ueventd/ueventd_main.c
+7
-3
未找到文件。
services/etc/group
浏览文件 @
a68ecdc0
...
...
@@ -4,6 +4,7 @@ system:x:1000:
radio:x:1001:
bluetooth:x:1002:
graphics:x:1003:
ueventd:x:1004:root
file_manager:x:1006:
log:x:1007:
user_data_rw:x:1008:
...
...
services/etc/passwd
浏览文件 @
a68ecdc0
...
...
@@ -4,6 +4,7 @@ system:x:1000:1000:::/bin/false
radio:x:1001:1001:::/bin/false
bluetooth:x:1002:1002:::/bin/false
graphics:x:1003:1003:::/bin/false
ueventd:x:1004:1004:::/bin/false
file_manager:x:1006:1006:::/bin/false
log:x:1007:1007:::/bin/false
user_data_rw:x:1008:1008:::/bin/false
...
...
services/etc/ueventd.cfg
浏览文件 @
a68ecdc0
...
...
@@ -2,6 +2,8 @@
"services" : [{
"name" : "ueventd",
"path" : ["/system/bin/ueventd"],
"uid" : "ueventd",
"gid" : ["ueventd"],
"socket" : [{
"name" : "ueventd",
"family" : "AF_NETLINK",
...
...
@@ -17,6 +19,7 @@
"SOCK_NONBLOCK"
]
}],
"caps" : ["DAC_OVERRIDE", "MKNOD", "CHOWN", "FOWNER"],
"critical" : [ 0, 15, 5],
"ondemand" : true,
"sandbox" : 0,
...
...
ueventd/ueventd_device_handler.c
浏览文件 @
a68ecdc0
...
...
@@ -89,11 +89,11 @@ static inline void AdjustDeviceNodePermissions(const char *deviceNode, uid_t uid
return
;
}
if
(
chown
(
deviceNode
,
uid
,
gid
)
!=
0
)
{
INIT_LOGW
(
"Failed to change
\"
%s
\"
owner
"
,
deviceNode
);
INIT_LOGW
(
"Failed to change
\"
%s
\"
owner
, errno %d"
,
deviceNode
,
errno
);
}
if
(
chmod
(
deviceNode
,
mode
)
!=
0
)
{
INIT_LOGW
(
"Failed to change
\"
%s
\"
mode
"
,
deviceNode
);
INIT_LOGW
(
"Failed to change
\"
%s
\"
mode
, errno %d"
,
deviceNode
,
errno
);
}
}
...
...
ueventd/ueventd_main.c
浏览文件 @
a68ecdc0
...
...
@@ -15,6 +15,7 @@
#include <limits.h>
#include <poll.h>
#include <stdbool.h>
#include "ueventd.h"
#include "ueventd_read_cfg.h"
#include "ueventd_socket.h"
...
...
@@ -22,16 +23,17 @@
#include "init_log.h"
#include "init_socket.h"
static
void
PollUeventdSocketTimeout
(
int
ueventSockFd
)
static
void
PollUeventdSocketTimeout
(
int
ueventSockFd
,
bool
ondemand
)
{
struct
pollfd
pfd
=
{};
pfd
.
events
=
POLLIN
;
pfd
.
fd
=
ueventSockFd
;
int
timeout
=
ondemand
?
UEVENTD_POLL_TIME
:
-
1
;
int
ret
=
-
1
;
while
(
1
)
{
pfd
.
revents
=
0
;
ret
=
poll
(
&
pfd
,
1
,
UEVENTD_POLL_TIME
);
ret
=
poll
(
&
pfd
,
1
,
timeout
);
if
(
ret
==
0
)
{
INIT_LOGI
(
"poll ueventd socket timeout, ueventd exit"
);
return
;
...
...
@@ -54,10 +56,12 @@ int main(int argc, char **argv)
while
(
ueventdConfigs
[
i
]
!=
NULL
)
{
ParseUeventdConfigFile
(
ueventdConfigs
[
i
++
]);
}
bool
ondemand
=
true
;
int
ueventSockFd
=
GetControlSocket
(
"ueventd"
);
if
(
ueventSockFd
<
0
)
{
INIT_LOGW
(
"Failed to get uevent socket, try to create"
);
ueventSockFd
=
UeventdSocketInit
();
ondemand
=
false
;
}
if
(
ueventSockFd
<
0
)
{
INIT_LOGE
(
"Failed to create uevent socket!"
);
...
...
@@ -76,6 +80,6 @@ int main(int argc, char **argv)
INIT_LOGI
(
"ueventd start to process uevent message"
);
ProcessUevent
(
ueventSockFd
,
NULL
,
0
);
// Not require boot devices
}
PollUeventdSocketTimeout
(
ueventSockFd
);
PollUeventdSocketTimeout
(
ueventSockFd
,
ondemand
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录