Back to index

glibc  2.9
poll.h
Go to the documentation of this file.
00001 /* Compatibility definitions for System V `poll' interface.
00002    Copyright (C) 1994,1996-2001,2004,2005,2006 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _SYS_POLL_H
00021 #define       _SYS_POLL_H   1
00022 
00023 #include <features.h>
00024 
00025 /* Get the platform dependent bits of `poll'.  */
00026 #include <bits/poll.h>
00027 #ifdef __USE_GNU
00028 /* Get the __sigset_t definition.  */
00029 # include <bits/sigset.h>
00030 /* Get the timespec definition.  */
00031 # define __need_timespec
00032 # include <time.h>
00033 #endif
00034 
00035 
00036 /* Type used for the number of file descriptors.  */
00037 typedef unsigned long int nfds_t;
00038 
00039 /* Data structure describing a polling request.  */
00040 struct pollfd
00041   {
00042     int fd;                 /* File descriptor to poll.  */
00043     short int events;              /* Types of events poller cares about.  */
00044     short int revents;             /* Types of events that actually occurred.  */
00045   };
00046 
00047 
00048 __BEGIN_DECLS
00049 
00050 /* Poll the file descriptors described by the NFDS structures starting at
00051    FDS.  If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
00052    an event to occur; if TIMEOUT is -1, block until an event occurs.
00053    Returns the number of file descriptors with events, zero if timed out,
00054    or -1 for errors.
00055 
00056    This function is a cancellation point and therefore not marked with
00057    __THROW.  */
00058 extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
00059 
00060 #ifdef __USE_GNU
00061 /* Like poll, but before waiting the threads signal mask is replaced
00062    with that specified in the fourth parameter.  For better usability,
00063    the timeout value is specified using a TIMESPEC object.
00064 
00065    This function is a cancellation point and therefore not marked with
00066    __THROW.  */
00067 extern int ppoll (struct pollfd *__fds, nfds_t __nfds,
00068                 __const struct timespec *__timeout,
00069                 __const __sigset_t *__ss);
00070 #endif
00071 
00072 __END_DECLS
00073 
00074 #endif /* sys/poll.h */