1N/A/*********************************************************************** 1N/A* This software is part of the ast package * 1N/A* Copyright (c) 1982-2009 AT&T Intellectual Property * 1N/A* and is licensed under the * 1N/A* Common Public License, Version 1.0 * 1N/A* by AT&T Intellectual Property * 1N/A* A copy of the License is available at * 1N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 1N/A* Information and Software Systems Research * 1N/A* Roland Mainz <roland.mainz@nrubsig.org> * 1N/A***********************************************************************/ 1N/A#
endif /* __GNUC__ */ 1N/A"[-?\n@(#)$Id: poll (AT&T Labs Research) 2009-05-14 $\n]" 1N/A"[-author?Roland Mainz <roland.mainz@nrubsig.org]" 1N/A"[+DESCRIPTION?The poll command provides applications with a mechanism " 1N/A "For each member of the array variable \bvar\b, " 1N/A "poll examines the given file descriptor in the subscript \b.fd\b " 1N/A "for the event(s) specified in the subscript \b.events\b." 1N/A "The poll command identifies those file descriptors on which an " 1N/A "application can read or write data, or on which certain events have " 1N/A"[+?The \bvar\b argument specifies the file descriptors to be examined " 1N/A "and the events of interest for each file descriptor. " 1N/A "It is a array of structured variables with one member for each open " 1N/A "file descriptor of interest. The array's members contain the following " 1N/A "[+?\b.fd\b # file descriptor]" 1N/A "[+?\b.events\b # requested events]" 1N/A "[+?\b.revents\b # returned event]" 1N/A"[+?The \bfd\b variable specifies an open file descriptor and the " 1N/A "\bevents\b and \brevents\b members are strings constructed from " 1N/A "a concatenation of the following event flags, separated by '|':]" 1N/A "[+POLLIN?Data other than high priority data may be " 1N/A "read without blocking. For STREAMS, this " 1N/A "flag is set in revents even if the message " 1N/A "is of zero length.]" 1N/A "[+POLLRDNORM?Normal data (priority band equals 0) may be " 1N/A "read without blocking. For STREAMS, this " 1N/A "flag is set in revents even if the message " 1N/A "is of zero length.]" 1N/A "[+POLLRDBAND?Data from a non-zero priority band may be " 1N/A "read without blocking. For STREAMS, this " 1N/A "flag is set in revents even if the message " 1N/A "is of zero length.]" 1N/A "[+POLLPRI?High priority data may be received without " 1N/A "blocking. For STREAMS, this flag is set in " 1N/A "revents even if the message is of zero " 1N/A "[+POLLOUT?Normal data (priority band equals 0) may be " 1N/A "written without blocking.]" 1N/A "[+POLLWRNORM?The same as POLLOUT.]" 1N/A "[+POLLWRBAND?Priority data (priority band > 0) may be " 1N/A "written. This event only examines bands " 1N/A "that have been written to at least once.]" 1N/A "[+POLLERR?An error has occurred on the device or " 1N/A "stream. This flag is only valid in the " 1N/A "revents bitmask; it is not used in the " 1N/A "[+POLLHUP?A hangup has occurred on the stream. This " 1N/A "event and POLLOUT are mutually exclusive; a " 1N/A "stream can never be writable if a hangup has " 1N/A "occurred. However, this event and POLLIN, " 1N/A ", POLLRDBAND, or POLLPRI are not " 1N/A "mutually exclusive. This flag is only valid " 1N/A "in the revents bitmask; it is not used in " 1N/A "the events member.]" 1N/A "[+POLLNVAL?The specified fd value does not belong to an " 1N/A "open file. This flag is only valid in the " 1N/A "revents member; it is not used in the events " 1N/A"[+?If the value fd is less than 0, events is ignored and " 1N/A "revents is set to 0 in that entry on return from poll.]" 1N/A"[+?The results of the poll query are stored in the revents " 1N/A "member in the \bvar\b structure. POLL*-strings are set in the \brevents\b " 1N/A "variable to indicate which of the requested events are true. " 1N/A "If none are true, the \brevents\b will be an empty string when " 1N/A "the poll command returns. The event flags " 1N/A "POLLHUP, POLLERR, and POLLNVAL are always set in \brevents\b " 1N/A "if the conditions they indicate are true; this occurs even " 1N/A "though these flags were not present in events.]" 1N/A"[+?If none of the defined events have occurred on any selected " 1N/A "file descriptor, poll waits at least timeout milliseconds " 1N/A "for an event to occur on any of the selected file descriptors. " 1N/A "On a computer where millisecond timing accuracy is not " 1N/A "available, timeout is rounded up to the nearest legal value " 1N/A "available on that system. If the value timeout is 0, poll " 1N/A "returns immediately. If the value of timeout is -1, poll " 1N/A "blocks until a requested event occurs or until the call is " 1N/A"[+?The poll function supports regular files, terminal and " 1N/A "pseudo-terminal devices, STREAMS-based files, FIFOs and " 1N/A "pipes. The behavior of poll on elements of fds that refer " 1N/A "to other types of file is unspecified.]" 1N/A"[+?The poll function supports sockets.]" 1N/A"[+?A file descriptor for a socket that is listening for connections " 1N/A "will indicate that it is ready for reading, once connections " 1N/A "are available. A file descriptor for a socket that " 1N/A "is connecting asynchronously will indicate that it is ready " 1N/A "for writing, once a connection has been established.]" 1N/A"[+?Regular files always poll TRUE for reading and writing.]" 1N/A"[e:eventarray]:[fdcount?Upon successful completion, an indexed array " 1N/A "of strings is returned which contains a list of array subscripts " 1N/A "in the poll array which received events.]" 1N/A"[t:timeout]:[seconds?Timeout in seconds. If the value timeout is 0, " 1N/A "poll returns immediately. If the value of timeout is -1, poll " 1N/A "blocks until a requested event occurs or until the call is " 1N/A"[T:mtimeout]:[milliseconds?Timeout in milliseconds. If the value timeout is 0, " 1N/A "poll returns immediately. If the value of timeout is -1, poll " 1N/A "blocks until a requested event occurs or until the call is " 1N/A "[+>0?An error occurred.]" 1N/A"[+SEE ALSO?\bopen\b(1),\btmpfile\b(1),\bdup\b(1),\bclose\b(1),\bpoll\b(2)]" 1N/A * |mystpcpy| - like |strcpy()| but returns the end of the buffer 1N/A * Copy string s2 to s1. s1 must be large enough. 1N/A * return s1-1 (position of string terminator ('\0') in destnation buffer). 1N/A /* Remove trailling '|' */ 1N/A /* -t uses seconds, -T milliseconds */ 1N/A /* Count number of array elememts. We need to do it "manually" to 1N/A * handle sparse indexed and associative arrays */ 1N/A * Allocate stack space via |alloca()| for gcc builds since ctfconvert 1N/A * is unable to handle VLAs from gcc. We need this until CR #6379193 1N/A /* We must allocate one more entry with VLA with zero elements do not work with all compilers */ 1N/A#
endif /* __GNUC__ */ 1N/A /* FixMe: EGAIN and EINTR may require extra handling */