mirror of https://github.com/mkerrisk/man-pages
epoll.7: Add error handling for epoll_wait() call in example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
15277745c3
commit
40c75945ad
|
@ -18,7 +18,7 @@
|
|||
.\"
|
||||
.\" Davide Libenzi <davidel@xmailserver.org>
|
||||
.\"
|
||||
.TH EPOLL 7 2008-11-01 "Linux" "Linux Programmer's Manual"
|
||||
.TH EPOLL 7 2008-11-04 "Linux" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
epoll \- I/O event notification facility
|
||||
.SH SYNOPSIS
|
||||
|
@ -220,6 +220,10 @@ if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listen_sock, &ev) == \-1) {
|
|||
|
||||
for (;;) {
|
||||
nfds = epoll_wait(epollfd, events, MAX_EVENTS, \-1);
|
||||
if (nfds == \-1) {
|
||||
perror("epoll_pwait");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (n = 0; n < nfds; ++n) {
|
||||
if (events[n].data.fd == listen_sock) {
|
||||
|
|
Loading…
Reference in New Issue