Linux:epoll延续——Linux源代码讲解

10_30

1.系统调用

通过以下三个成员方法实现:
① epoll_create
【int epfd=epoll_create(size)创建内核时间表,存放描述符和事件,创建红黑树; fd-文件描述符,
inode-唯一标识一个文件(属性),*fie】

struct list_head rdllist;//epoll会设置回调函数,收集就绪描述符
struct rb_root rbr;//红黑树

② epoll_ctl 【向内核事件表中添加描述符和事件】

sys_epoll_stl(int epfd,int op,int fd,struct epoll_event_user*event); 

③ epoll_wait【给用户获取就绪描述符,传递数组收集描述符】

sys_epoll_wait(int epfd,struct epoll_event_user*events,int maxevents,int timeout);//有事件产生或者超时或者发生错误就会会给用户提示错误

系统调用是在内核中实现

sys_call_table (系统调用表)

猜你喜欢

转载自blog.csdn.net/qq_48580892/article/details/121051132