Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man2/poll.2
Real path: /usr/share/man/man2/poll.2
Zurück
'\" te .\" Copyright (c) 2001, 2023, Oracle and/or its affiliates. .\" Copyright (c) 1989, AT&T. All rights reserved. .\" Portions Copyright (c) 1992, The X/Open Company Ltd. All rights reserved. .\" Oracle gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .\" Portions of this manual page were derived from the Linux poll.2 man page, which is Copyright (C) 2006 Michael Kerrisk. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Since the Linux kernel and libraries are constantly changing, this manual page may be incorrect or out-of-date. The author(s) assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. The author(s) may not have taken the same level of care in the production of this manual, which is licensed free of charge, as they might when working professionally. Formatted or processed versions of this manual, if unaccompanied by the source, must acknowledge the copyright and authors of this work. .TH poll 2 "30 Jan 2023" "Oracle Solaris 11.4" "System Calls" .SH NAME poll, ppoll \- input/output multiplexing .SH SYNOPSIS .LP .nf #include <poll.h> \fBint\fR \fBpoll\fR(\fBstruct pollfd *\fR \fIfds\fR, \fBnfds_t\fR \fInfds\fR, \fBint\fR \fItimeout\fR); .fi .LP .nf \fBint\fR \fBppoll\fR(\fBstruct pollfd *restrict\fR \fIfds\fR, \fBnfds_t\fR \fInfds\fR, \fBconst struct timespec *restrict\fR \fItimeout\fR, \fBconst sigset_t *restrict\fR \fIsigmask\fR); .fi .SH DESCRIPTION .sp .LP The \fBpoll()\fR function provides applications with a mechanism for multiplexing input/output over a set of file descriptors. For each member of the array pointed to by \fIfds\fR, \fBpoll()\fR examines the given file descriptor for the event(s) specified in \fIevents\fR. The number of \fBpollfd\fR structures in the \fIfds\fR array is specified by \fInfds\fR. The \fBpoll()\fR function identifies those file descriptors on which an application can read or write data, or on which certain events have occurred. .sp .LP The \fIfds\fR argument specifies the file descriptors to be examined and the events of interest for each file descriptor. It is a pointer to an array with one member for each open file descriptor of interest. The array's members are \fBpollfd\fR structures, which contain the following members: .sp .in +2 .nf int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ .fi .in -2 .sp .sp .LP The \fIfd\fR member specifies an open file descriptor and the \fBevents\fR and \fBrevents\fR members are bitmasks constructed by a logical \fBOR\fR operation of any combination of the following event flags: .sp .ne 2 .mk .na \fB\fBPOLLIN\fR\fR .ad .RS 14n .rt Data other than high priority data may be read without blocking. For streams, this flag is set in \fBrevents\fR even if the message is of zero length. .RE .sp .ne 2 .mk .na \fB\fBPOLLRDNORM\fR\fR .ad .RS 14n .rt Normal data (priority band equals 0) may be read without blocking. For streams, this flag is set in \fBrevents\fR even if the message is of zero length. .RE .sp .ne 2 .mk .na \fB\fBPOLLRDBAND\fR\fR .ad .RS 14n .rt Data from a non-zero priority band may be read without blocking. For streams, this flag is set in \fBrevents\fR even if the message is of zero length. .RE .sp .ne 2 .mk .na \fB\fBPOLLPRI\fR\fR .ad .RS 14n .rt High priority data may be received without blocking. For streams, this flag is set in \fBrevents\fR even if the message is of zero length. .RE .sp .ne 2 .mk .na \fB\fBPOLLOUT\fR\fR .ad .RS 14n .rt Normal data (priority band equals 0) may be written without blocking. .RE .sp .ne 2 .mk .na \fB\fBPOLLWRNORM\fR\fR .ad .RS 14n .rt The same as \fBPOLLOUT\fR. .RE .sp .ne 2 .mk .na \fB\fBPOLLWRBAND\fR\fR .ad .RS 14n .rt Priority data (priority band > 0) may be written. This event only examines bands that have been written to at least once. .RE .sp .ne 2 .mk .na \fB\fBPOLLERR\fR\fR .ad .RS 14n .rt An error has occurred on the device or stream. This flag is only valid in the \fBrevents\fR bitmask; it is not used in the \fBevents\fR member. .RE .sp .ne 2 .mk .na \fB\fBPOLLHUP\fR\fR .ad .RS 14n .rt A hangup has occurred on the stream. This event and \fBPOLLOUT\fR are mutually exclusive; a stream can never be writable if a hangup has occurred. However, this event and \fBPOLLIN\fR, \fBPOLLRDNORM\fR, \fBPOLLRDBAND\fR, or \fBPOLLPRI\fR are not mutually exclusive. This flag is only valid in the \fBrevents\fR bitmask; it is not used in the \fBevents\fR member. .RE .sp .ne 2 .mk .na \fB\fBPOLLNVAL\fR\fR .ad .RS 14n .rt The specified \fBfd\fR value does not belong to an open file. This flag is only valid in the \fBrevents\fR member; it is not used in the \fBevents\fR member. .RE .sp .LP If the value \fIfd\fR is less than 0, \fIevents\fR is ignored and \fIrevents\fR is set to 0 in that entry on return from \fBpoll()\fR. .sp .LP The results of the \fBpoll()\fR query are stored in the \fBrevents\fR member in the \fBpollfd\fR structure. Bits are set in the \fBrevents\fR bitmask to indicate which of the requested events are true. If none are true, none of the specified bits are set in \fIrevents\fR when the \fBpoll()\fR call returns. The event flags \fBPOLLHUP\fR, \fBPOLLERR\fR, and \fBPOLLNVAL\fR are always set in \fIrevents\fR if the conditions they indicate are true; this occurs even though these flags were not present in \fIevents\fR. .sp .LP If none of the defined events have occurred on any selected file descriptor, \fBpoll()\fR waits at least \fItimeout\fR milliseconds for an event to occur on any of the selected file descriptors. On a computer where millisecond timing accuracy is not available, \fItimeout\fR is rounded up to the nearest legal value available on that system. If the value \fItimeout\fR is 0, \fBpoll()\fR returns immediately. If the value of \fItimeout\fR is \(mi1, \fBpoll()\fR blocks until a requested event occurs or until the call is interrupted. The \fBpoll()\fR function is not affected by the \fBO_NDELAY\fR and \fBO_NONBLOCK\fR flags. .sp .LP The \fBpoll()\fR function supports regular files, sockets, terminal and pseudo-terminal devices, streams-based files, FIFOs and pipes. The behavior of \fBpoll()\fR on elements of \fIfds\fR that refer to other types of file is unspecified. .sp .LP A file descriptor for a socket that is listening for connections will indicate that it is ready for reading, once connections are available. A file descriptor for a socket that is connecting asynchronously will indicate that it is ready for writing, once a connection has been established. .sp .LP Regular files always \fBpoll()\fR \fBTRUE\fR for reading and writing. .sp .LP The relationship between \fBpoll()\fR and \fBppoll()\fR is analogous to the relationship between \fBselect\fR(3C) and \fBpselect\fR(3C): like \fBpselect()\fR, \fBppoll()\fR allows an application to safely wait until either a file descriptor becomes ready or until a signal is caught. .sp .LP Other than the difference in the \fItimeout\fR argument, the following \fBppoll()\fR call: .sp .in +2 .nf ready = ppoll(&fds, nfds, timeout, &sigmask); .fi .in -2 .sp .sp .LP is equivalent to atomically executing the following calls: .sp .in +2 .nf sigset_t origmask; sigprocmask(SIG_SETMASK, &sigmask, &origmask); ready = ppoll(&fds, nfds, timeout); sigprocmask(SIG_SETMASK, &origmask, NULL); .fi .in -2 .sp .sp .LP If \fIsigmask\fR is not a null pointer, then the \fBpselect()\fR function replaces the signal mask of the process by the set of signals pointed to by \fIsigmask\fR before examining the descriptors, and restores the signal mask of the process before returning. .sp .LP The \fItimeout\fR argument specifies an upper limit on the amount of time that \fBppoll()\fR will block. This argument is a pointer to a structure of the following form: .sp .in +2 .nf struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; .fi .in -2 .sp .sp .LP If \fItimeout\fR is specified as \fINULL\fR, \fBppoll()\fR can block indefinitely. .SH RETURN VALUES .sp .LP Upon successful completion, a non-negative value is returned. A positive value indicates the total number of \fBpollfd\fR structures that have been selected (that is, those for which the \fBrevents\fR member is non-zero). A value of \fB0\fR indicates that the call timed out and no file descriptors have been selected. Upon failure, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBpoll()\fR and \fBppoll()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt Allocation of internal data structures failed, but the request may be attempted again. .RE .sp .ne 2 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 10n .rt Some argument points to an illegal address. .RE .sp .ne 2 .mk .na \fB\fBEINTR\fR\fR .ad .RS 10n .rt A signal was caught during the function call. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The argument \fInfds\fR is greater than \fB{OPEN_MAX}\fR, or one of the \fBfd\fR members refers to a stream or multiplexer that is linked (directly or indirectly) downstream from a multiplexer. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt An invalid \fItimeout\fR interval was specified. .RE .sp .LP The \fBpoll()\fR and \fBppoll()\fR functions may fail if: .sp .ne 2 .mk .na \fB\fBENOSYS\fR\fR .ad .RS 10n .rt One of the \fBfd\fR members is from a filesystem type for which there is no \fBpoll()\fR interface, such as \fBdoorfs\fR. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level Async-Signal-Safe _ Standard See below. .TE .sp .SS "Standard" .sp .LP See \fBstandards\fR(7) for descriptions of the following standards: .sp .TS tab( ) box; cw(2.2i) |cw(3.3i) lw(2.2i) |lw(3.3i) . INTERFACES APPLICABLE STANDARDS _ \fBpoll()\fR T{ .br .in +2 POSIX.1-2001 through 2008, .in -2 .br .in +2 SUS through SUSv4, .in -2 .br .in +2 XPG4v2 through XPG7 .in -2 T} _ \fBppoll()\fR None .TE .sp .SH SEE ALSO .sp .LP \fBgetmsg\fR(2), \fBgetrlimit\fR(2), \fBIntro\fR(2), \fBputmsg\fR(2), \fBread\fR(2), \fBwrite\fR(2), \fBselect\fR(3C), \fBattributes\fR(7), \fBstandards\fR(7), \fBchpoll\fR(9E) .sp .LP \fISTREAMS Programming Guide\fR .SH NOTES .sp .LP Non-STREAMS drivers use \fBchpoll\fR(9E) to implement \fBpoll()\fR on these devices. .SH HISTORY .sp .LP The \fBppoll()\fR function was added to Oracle Solaris in Solaris 11.0.0. .sp .LP The \fBpoll()\fR function has been included in all Sun and Oracle releases of Solaris.