Skip to content

Commit 4973617

Browse files
author
wziww
committed
add epoll notes
1 parent 6857406 commit 4973617

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

netpoll.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
397397
```go
398398
func netpollopen(fd uintptr, pd *pollDesc) int32 {
399399
var ev epollevent
400+
// linux 下 epoll 采用了 ET 模式
401+
// epoll 下用户可以 watch 的 descriptors 是有上限的
402+
// 具体上限的查看及配置可以通过 /proc/sys/fs/epoll/max_user_watches 系统虚拟文件进行操作
403+
// https://github.com/torvalds/linux/blob/v4.9/fs/eventpoll.c#L259-L263
400404
ev.events = _EPOLLIN | _EPOLLOUT | _EPOLLRDHUP | _EPOLLET
401405
*(**pollDesc)(unsafe.Pointer(&ev.data)) = pd
402406
return -epollctl(epfd, _EPOLL_CTL_ADD, int32(fd), &ev)

0 commit comments

Comments
 (0)