linux 2.6 kernel epoll
http://hi.baidu.com/j_fo/blog/item/a43fa60fa6e2f4eaab6457d5.html
Linux2.6内核epoll介绍
2008-11-05 16:35
http://blog.csdn.net/rstevens/archive/2007/10/30/1858067.aspx
http://hi.baidu.com/jmlover/blog/item/24c28b131e6b48d7f7039ee6.html
http://hi.baidu.com/jmlover/blog/item/e64df724f12926348744f91b.html
名词解释:man epoll之后,得到如下结果:
NAME
epoll - I/O event notification facility
SYNOPSIS
#include <sys/epoll.h>
DEscrīptION
epoll is a variant of poll(2) that can be used either as Edge or Level
Triggered interface and scales well to large numbers of watched fds.
Three system calls are provided to set up and control an epoll set:
epoll_create(2), epoll_ctl(2), epoll_wait(2).
An epoll set is connected to a file descrīptor created by
epoll_create(2). Interest for certain file descrīptors is then
registered via
epoll_ctl(2). Finally, the actual wait is started by epoll_wait(2).
其实,一切的解释都是多余的,按照我目前的了解,EPOLL模型似乎只有一种格式,所以大家只要参考我下面的代码,就能够对EPOLL有所了解了,代码的解释都已经在注释中:
while (TRUE)
{
int nfds = epoll_wait (m_epoll_fd, m_events, MAX_EVENTS, EPOLL_TIME_OUT);//等待EPOLL事件的发生,相当于监听,至于相关的端口,需要在初始化EPOLL的时候绑定。
if (nfds <= 0)
continue;
m_bOnTimeChecking = FALSE;
G_CurTime = time(NULL);
for (int i=0; i<nfds; i++)
{
try
{
if (m_events[i].data.fd == m_listen_http_fd)//如果新监测到一个HTTP用户连接到绑定的HTTP端口,建立新的连接。由于我们新采用了SOCKET连接,所以基本没用。
{
OnAcceptHttpEpoll ();
}
else if (m_events[i].data.fd == m_listen_sock_fd)//如果新监测到一个SOCKET用户连接到了绑定的SOCKET端口,建立新的连接。
{
OnAcceptSockEpoll ();
}
else if (m_events[i].events & EPOLLIN)//如果是已经连接的用户,并且收到数据,那么进行读入。
{
OnReadEpoll (i);
}
OnWriteEpoll (i);//查看当前的活动连接是否有需要写出的数据。
}
catch (int)
{
PRINTF ("CATCH捕获错误\n");
相关文档:
在linux下opengl编程,首先需要安装glut包。
1 安装glut
(1)下载地址:
http://fidelio.cacs.louisiana.edu/resources/linux/glut.zip
(2)将glut.zip解压:
unzip glut.zip
解压后,里面有一个rpm安装包,一个测试文件,一个glut.h,一个makefile, 这几个文件都非常重要。
(3)安装:
rpm -i glut-3.7-8.i386. ......
linux 上的oracle sqlplus 不能利用 上, 下 键来查看命令,搜索到解决问题的办法,整理如下
安装软件rlwrap可以解决这个问题,该软件是用c写的程序
官方下载地址:http://utopia.knoware.nl/~hlub/uck/rlwrap/
安装过程:
我们也可以查看解压后的tar包,查看README帮助文件
shell>tar -zxvf rlwrap-0.36.tar.gz
sh ......