提交 edf39eae 编写于 作者: X xionglei6

modify: ueventd poll a moment by itself

Signed-off-by: Nxionglei6 <xionglei6@huawei.com>
上级 5433527c
......@@ -21,11 +21,32 @@
#include "init_log.h"
#include "init_socket.h"
static void PollUeventdSocket(int ueventSockFd)
{
struct pollfd pfd = {};
pfd.events = POLLIN;
pfd.fd = ueventSockFd;
int ret = -1;
while (1) {
pfd.revents = 0;
ret = poll(&pfd, 1, UEVENTD_POLL_TIME);
if (ret == 0) {
break;
} else if (ret < 0) {
INIT_LOGE("Failed to poll ueventd socket!");
return;
}
if (pfd.revents & POLLIN) {
ProcessUevent(ueventSockFd, NULL, 0); // Not require boot devices
}
}
}
int main(int argc, char **argv)
{
char *ueventdConfigs[] = {"/etc/ueventd.config", NULL};
int i = 0;
int ret = -1;
while (ueventdConfigs[i] != NULL) {
ParseUeventdConfigFile(ueventdConfigs[i++]);
}
......@@ -51,22 +72,6 @@ int main(int argc, char **argv)
INIT_LOGI("ueventd start to process uevent message");
ProcessUevent(ueventSockFd, NULL, 0); // Not require boot devices
}
struct pollfd pfd = {};
pfd.events = POLLIN;
pfd.fd = ueventSockFd;
while (1) {
pfd.revents = 0;
ret = poll(&pfd, 1, UEVENTD_POLL_TIME);
if (ret == 0) {
break;
} else if (ret < 0) {
INIT_LOGE("Failed to poll ueventd socket!");
return -1;
}
if (pfd.revents & POLLIN) {
ProcessUevent(ueventSockFd, NULL, 0); // Not require boot devices
}
}
PollUeventdSocket(ueventSockFd);
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册