epoll_wait.2: Add documentation of epoll_pwait2()

Expand the epoll_wait() page with epoll_pwait2(), an epoll_wait()
variant that takes a struct timespec to enable nanosecond
resolution timeout.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Willem de Bruijn 2021-01-11 19:48:20 -05:00 committed by Michael Kerrisk
parent e71d103b2c
commit ba47eb5e3c
1 changed files with 29 additions and 2 deletions

View File

@ -22,7 +22,7 @@
.\" .\"
.TH EPOLL_WAIT 2 2020-04-11 "Linux" "Linux Programmer's Manual" .TH EPOLL_WAIT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor epoll_wait, epoll_pwait, epoll_pwait2 \- wait for an I/O event on an epoll file descriptor
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <sys/epoll.h> .B #include <sys/epoll.h>
@ -32,6 +32,9 @@ epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor
.BI "int epoll_pwait(int " epfd ", struct epoll_event *" events , .BI "int epoll_pwait(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", int " timeout , .BI " int " maxevents ", int " timeout ,
.BI " const sigset_t *" sigmask ); .BI " const sigset_t *" sigmask );
.BI "int epoll_pwait2(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", const struct timespec *" timeout ,
.BI " const sigset_t *" sigmask );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The
@ -170,6 +173,25 @@ argument may be specified as NULL, in which case
.BR epoll_pwait () .BR epoll_pwait ()
is equivalent to is equivalent to
.BR epoll_wait (). .BR epoll_wait ().
.SS epoll_pwait2 ()
The
.BR epoll_pwait2 ()
system call is equivalent to
.BR epoll_pwait ()
except for the
.I timeout
argument. It takes an argument of type
.I timespec
to be able to specify nanosecond resolution timeout. This argument functions
the same as in
.BR pselect (2)
and
.BR ppoll (2).
If
.I timeout
is NULL, then
.BR epoll_pwait2 ()
can block indefinitely.
.SH RETURN VALUE .SH RETURN VALUE
On success, On success,
.BR epoll_wait () .BR epoll_wait ()
@ -217,6 +239,9 @@ Library support is provided in glibc starting with version 2.3.2.
.BR epoll_pwait () .BR epoll_pwait ()
was added to Linux in kernel 2.6.19. was added to Linux in kernel 2.6.19.
Library support is provided in glibc starting with version 2.6. Library support is provided in glibc starting with version 2.6.
.PP
.BR epoll_pwait2 ()
was added to Linux in kernel 5.11.
.SH CONFORMING TO .SH CONFORMING TO
.BR epoll_wait () .BR epoll_wait ()
and and
@ -269,7 +294,9 @@ this means that timeouts greater than 35.79 minutes are treated as infinity.
.SS C library/kernel differences .SS C library/kernel differences
The raw The raw
.BR epoll_pwait () .BR epoll_pwait ()
system call has a sixth argument, and
.BR epoll_pwait2 ()
system calls have a sixth argument,
.IR "size_t sigsetsize" , .IR "size_t sigsetsize" ,
which specifies the size in bytes of the which specifies the size in bytes of the
.IR sigmask .IR sigmask