diff options
author | dchagin <dchagin@FreeBSD.org> | 2014-12-21 07:58:28 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2014-12-21 07:58:28 +0000 |
commit | dfe2ad4d4623524826fd780517aa15fdc759a1da (patch) | |
tree | 7345c217602377f5b4227533feef3ce74e57a719 /lib | |
parent | f73f068967977545d4d60b36864475974dca2613 (diff) | |
download | FreeBSD-src-dfe2ad4d4623524826fd780517aa15fdc759a1da.zip FreeBSD-src-dfe2ad4d4623524826fd780517aa15fdc759a1da.tar.gz |
MFC r274462: Add the ppoll() system call.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/sys/Symbol.map | 6 | ||||
-rw-r--r-- | lib/libc/sys/poll.2 | 65 |
3 files changed, 70 insertions, 2 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index c9ed70c..b01657f 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -356,6 +356,7 @@ MLINKS+=pdfork.2 pdgetpid.2\ pdfork.2 pdkill.2 \ pdfork.2 pdwait4.2 MLINKS+=pipe.2 pipe2.2 +MLINKS+=poll.2 ppoll.2 MLINKS+=read.2 pread.2 \ read.2 preadv.2 \ read.2 readv.2 diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index fe887c3..448bcce 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -399,6 +399,10 @@ FBSD_1.3 { wait6; }; +FBSD_1.4 { + ppoll; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; @@ -821,6 +825,8 @@ FBSDprivate_1.0 { __sys_pipe; _poll; __sys_poll; + _ppoll; + __sys_ppoll; _preadv; __sys_preadv; _procctl; diff --git a/lib/libc/sys/poll.2 b/lib/libc/sys/poll.2 index 932186d..a1c7ada 100644 --- a/lib/libc/sys/poll.2 +++ b/lib/libc/sys/poll.2 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 8, 2002 +.Dd November 13, 2014 .Dt POLL 2 .Os .Sh NAME @@ -40,6 +40,13 @@ .In poll.h .Ft int .Fn poll "struct pollfd fds[]" "nfds_t nfds" "int timeout" +.Ft int +.Fo ppoll +.Fa "struct pollfd fds[]" +.Fa "nfds_t nfds" +.Fa "const struct timespec * restrict timeout" +.Fa "const sigset_t * restrict newsigmask" +.Fc .Sh DESCRIPTION The .Fn poll @@ -139,6 +146,47 @@ If is zero, then .Fn poll will return without blocking. +.Pp +The +.Fn ppoll +system call, unlike +.Fn poll , +is used to safely wait until either a set of file descriptors becomes +ready or until a signal is caught. +The +.Fa fds +and +.Fa nfds +arguments are identical to the analogous arguments of +.Fn poll . +The +.Fa timeout +argument in +.Fn ppoll +points to a +.Vt "const struct timespec" +which is defined in +.In sys/timespec.h +(shown below) rather than the +.Vt "int timeout" +used by +.Fn poll . +A null pointer may be passed to indicate that +.Fn ppoll +should wait indefinitely. +Finally, +.Fa newsigmask +specifies a signal mask which is set while waiting for input. +When +.Fn ppoll +returns, the original signal mask is restored. +.Pp +.Bd -literal +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; +.Ed .Sh RETURN VALUES The .Fn poll @@ -185,17 +233,26 @@ points outside the process's allocated address space. A signal was delivered before the time limit expired and before any of the selected events occurred. .It Bq Er EINVAL -The specified time limit is negative. +The specified time limit is invalid. One of its components is negative or too large. .El .Sh SEE ALSO .Xr accept 2 , .Xr connect 2 , .Xr kqueue 2 , +.Xr pselect 2 , .Xr read 2 , .Xr recv 2 , .Xr select 2 , .Xr send 2 , .Xr write 2 +.Sh STANDARDS +The +.Fn poll +function conforms to +.St -p1003.1-2001 . +The +.Fn ppoll +is not specified by POSIX. .Sh HISTORY The .Fn poll @@ -203,6 +260,10 @@ function appeared in .At V . This manual page and the core of the implementation was taken from .Nx . +The +.Fn ppoll +function first appeared in +.Fx 11.0 .Sh BUGS The distinction between some of the fields in the .Fa events |