home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / sys / h / poll < prev    next >
Encoding:
Text File  |  2004-09-05  |  1.8 KB  |  70 lines

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