.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 1997 Andries Brouwer (aeb@cwi.nl) .\" .\" 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 "16 July 1997" "Linux 2.1.23" "Linux Programmer's Manual" .SH NAME poll \- wait for some event on a file descriptor .SH SYNOPSIS .B #include .sp .BI "int poll(struct pollfd *" ufds ", unsigned int " nfds ", int " timeout ); .SH DESCRIPTION .B poll is a variation on the theme of .BR select . It specifies an array of .I nfds structures of type .br .nf struct pollfd { int fd; short events; short revents; }; .fi and a .I timeout in milliseconds. (A negative value means infinite timeout.) The field .I events is an input parameter, a bitmask specifying the events the application is interested in. The field .I revents is an output parameter, filled by the kernel with the events that actually occurred, either of the type requested, or of one of the types .B POLLERR or .BR POLLHUP . The possible bits in these masks are defined in : .br .nf #define POLLIN 0x0001 #define POLLPRI 0x0002 #define POLLOUT 0x0004 #define POLLERR 0x0008 #define POLLHUP 0x0010 #define POLLNVAL 0x0020 #define POLLRDNORM 0x0040 #define POLLRDBAND 0x0080 #define POLLWRNORM 0x0100 #define POLLWRBAND 0x0200 #define POLLMSG 0x0400 .fi .SH "RETURN VALUE" On success, zero is returned. On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS .TP .B ENOMEM There was no space to allocate file descriptor tables. .TP .B EFAULT The array given as argument was not contained in the calling program's address space. .TP .B EINTR An signal occurred before any requested event. .SH "CONFORMING TO" This call is Linux-specific. .SH "SEE ALSO" .BR select (2)