0
epoll_insert
功能被sys_epoll_ctl
調用。關於epoll_insert的詳細功能
有在epoll_insert
功能的一些關鍵步驟:
使用隊列回調初始化調查表:
ep_ptable_queue_proc
而且它會調用
file->f_op->poll
如果該文件是已經「準備就緒」,然後我們將其放入就緒列表中
/* If the file is already "ready" we drop it inside the ready list */ if ((revents & event->events) && !ep_is_linked(&epi->rdllink)) { list_add_tail(&epi->rdllink, &ep->rdllist); /* Notify waiting tasks that events are available */ if (waitqueue_active(&ep->wq)) wake_up_locked(&ep->wq); if (waitqueue_active(&ep->poll_wait)) pwake++; }
我不明白爲什麼要檢查文件是否在epoll_insert
功能做好準備。我們應該在ep_poll_callback
函數中檢查它嗎?