equal
deleted
inserted
replaced
38 } |
38 } |
39 }() |
39 }() |
40 poller.fd = fd |
40 poller.fd = fd |
41 |
41 |
42 // Create epoll fd |
42 // Create epoll fd |
43 poller.epfd, errno = unix.EpollCreate1(0) |
43 poller.epfd, errno = unix.EpollCreate1(unix.EPOLL_CLOEXEC) |
44 if poller.epfd == -1 { |
44 if poller.epfd == -1 { |
45 return nil, errno |
45 return nil, errno |
46 } |
46 } |
47 // Create pipe; pipe[0] is the read end, pipe[1] the write end. |
47 // Create pipe; pipe[0] is the read end, pipe[1] the write end. |
48 errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK) |
48 errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK|unix.O_CLOEXEC) |
49 if errno != nil { |
49 if errno != nil { |
50 return nil, errno |
50 return nil, errno |
51 } |
51 } |
52 |
52 |
53 // Register inotify fd with epoll |
53 // Register inotify fd with epoll |