home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / sys / h / poll < prev    next >
Encoding:
Text File  |  2006-09-17  |  1.7 KB  |  66 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/sys/poll.h,v $
  4.  * $Date: 2004/10/17 16:24:43 $
  5.  * $Revision: 1.6 $
  6.  * $State: Exp $
  7.  * $Author: joty $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* System V poll interface.  */
  12.  
  13. #ifndef __SYS_POLL_H
  14. #define __SYS_POLL_H
  15.  
  16. #ifndef __UNIXLIB_FEATURES_H
  17. #include <features.h>
  18. #endif
  19.  
  20. __BEGIN_DECLS
  21.  
  22. /* Type used for the number of file descriptors.  */
  23. typedef unsigned long int nfds_t;
  24.  
  25. /* Data structure describing a polling request.  */
  26. struct pollfd
  27.   {
  28.     int fd;    /* File descriptor to poll.  */
  29.     short int events;    /* Types of events poller cares about.  */
  30.     short int revents;    /* Types of events that actually occurred.  */
  31.  
  32.   };
  33.  
  34. /* Event types that can be polled for.   */
  35.  
  36. /* Data to be read.  */
  37. #define POLLIN        01
  38. /* Urgent data to read.  */
  39. #define POLLPRI        02
  40. /* Writing now will not block.  */
  41. #define POLLOUT        04
  42.  
  43. /* Event types always implicitly polled for.  */
  44.  
  45. /* Error condition.  */
  46. #define POLLERR         010
  47. /* Hung up.  */
  48. #define POLLHUP         020
  49. /* Invalid polling request.  */
  50. #define POLLNVAL        040
  51.  
  52. /* Canonical number of polling requests to read in at a time in poll.  */
  53. #define NPOLLFILE    30
  54.  
  55.  
  56. /* Poll the file descriptors described by the NFDS structures starting at
  57.    FDS.  If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
  58.    an event to occur; if TIMEOUT is -1, block until an event occurs.
  59.    Returns the number of file descriptors with events, zero if timed out,
  60.    or -1 for errors.  */
  61. extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) __THROW;
  62.  
  63. __END_DECLS
  64.  
  65. #endif
  66.