一个嵌入式linux项目的流程以及rshell的介绍
2019-07-12 16:39发布
生成海报
int mz_epoll(void)
{
int listenfd,socketfd;
int epollfd,fds;
struct epoll_event en,evevts[MAX_EVENTS]
int i,rv;
epollfd = get_server_epoll_fd();
listenfd = ipv4_tcp_create_socket();
ipv4_socket_nonblock(listenfd);
rv =ipv4_epoll_add_event_by_fd(listenfd);
if(rv < 0){
return -1;
}
while(1){
fds = epoll_wait(epollfd,events,MAX_EVENTS);
if(fds < 0){
if(errno == EINTR){
m_log(M_ERR,"skip Interrupted system call err.
");
continue;
}
m_log(M_ERR,"epoll_wait err:%s
",strerror(errno));
for(i = 0;i < fds;i++)
{
if(events[i].data.fd == listenfd)
{
new_client_init(listenfd);
continue;
}
else
{
m_log(LOG_DEBUG,"recv data.
");
rv = process_data(events[i].fata.ptr);
if(rv == CLIENT_CLOSE)
{
rv = ipv4_epoll_delete_events(&envents[i]);
if(rv < 0)
{
m_log(LOG_DEBUG,"epoll delete error.
");
}
continue;
}
}
}
}
}
}
int main(int argc,char *argv[])
{
server_init();
mz_epoll();
................
.......................
}
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮