home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / ixemul-39.47-env-bin.lha / man / cat2 / select.0 < prev    next >
Text File  |  1993-12-07  |  5KB  |  133 lines

  1.  
  2. SELECT(2)                  UNIX Programmer's Manual                  SELECT(2)
  3.  
  4. NNAAMMEE
  5.      sseelleecctt - synchronous I/O multiplexing
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<uunniissttdd..hh>>
  9.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  10.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  11.  
  12.      _i_n_t
  13.      sseelleecctt(_i_n_t _n_f_d_s, _f_d___s_e_t _*_r_e_a_d_f_d_s, _f_d___s_e_t _*_w_r_i_t_e_f_d_s, _f_d___s_e_t _*_e_x_c_e_p_t_f_d_s,
  14.              _s_t_r_u_c_t _t_i_m_e_v_a_l _*_t_i_m_e_o_u_t)
  15.  
  16.      FFDD__SSEETT(_f_d, _&_f_d_s_e_t)
  17.  
  18.      FFDD__CCLLRR(_f_d, _&_f_d_s_e_t)
  19.  
  20.      FFDD__IISSSSEETT(_f_d, _&_f_d_s_e_t)
  21.  
  22.      FFDD__ZZEERROO(_&_f_d_s_e_t)
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      SSeelleecctt() examines the I/O descriptor sets whose addresses are passed in
  26.      _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s to see if some of their descriptors are
  27.      ready for reading, are ready for writing, or have an exceptional condi­
  28.      tion pending, respectively.  The first _n_f_d_s descriptors are checked in
  29.      each set; i.e., the descriptors from 0 through _n_f_d_s­1 in the descriptor
  30.      sets are examined.  On return, sseelleecctt() replaces the given descriptor
  31.      sets with subsets consisting of those descriptors that are ready for the
  32.      requested operation.  SSeelleecctt() returns the total number of ready descrip­
  33.      tors in all the sets.
  34.  
  35.      The descriptor sets are stored as bit fields in arrays of integers.  The
  36.      following macros are provided for manipulating such descriptor sets:
  37.      FFDD__ZZEERROO(_&_f_d_s_e_t_x) initializes a descriptor set _f_d_s_e_t to the null set.
  38.      FFDD__SSEETT(_f_d, _&_f_d_s_e_t) includes a particular descriptor _f_d in _f_d_s_e_t.
  39.      FFDD__CCLLRR(_f_d, _&_f_d_s_e_t) removes _f_d from _f_d_s_e_t. FFDD__IISSSSEETT(_f_d, _&_f_d_s_e_t) is non­
  40.      zero if _f_d is a member of _f_d_s_e_t, zero otherwise.  The behavior of these
  41.      macros is undefined if a descriptor value is less than zero or greater
  42.      than or equal to FD_SETSIZE, which is normally at least equal to the max­
  43.      imum number of descriptors supported by the system.
  44.  
  45.      If _t_i_m_e_o_u_t is a non­nil pointer, it specifies a maximum interval to wait
  46.      for the selection to complete.  If _t_i_m_e_o_u_t is a nil pointer, the select
  47.      blocks indefinitely.  To affect a poll, the _t_i_m_e_o_u_t argument should be
  48.      non­nil, pointing to a zero­valued timeval structure.
  49.  
  50.      Any of _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s may be given as nil pointers if
  51.      no descriptors are of interest.
  52.  
  53. RREETTUURRNN VVAALLUUEESS
  54.      SSeelleecctt() returns the number of ready descriptors that are contained in
  55.      the descriptor sets, or ­1 if an error occurred.  If the time limit ex­
  56.      pires, sseelleecctt() returns 0.  If sseelleecctt() returns with an error, including
  57.      one due to an interrupted call, the descriptor sets will be unmodified.
  58.  
  59. EERRRROORRSS
  60.      An error return from sseelleecctt() indicates:
  61.  
  62.      [EBADF]       One of the descriptor sets specified an invalid descriptor.
  63.  
  64.      [EINTR]       A signal was delivered before the time limit expired and
  65.  
  66.                    before any of the selected events occurred.
  67.  
  68.      [EINVAL]      The specified time limit is invalid.  One of its components
  69.                    is negative or too large.
  70.  
  71. SSEEEE AALLSSOO
  72.      accept(2),  connect(2),  read(2),  write(2),  recv(2),  send(2),  getdta­
  73.      blesize(2)
  74.  
  75. BBUUGGSS
  76.      Although the provision of getdtablesize(2) was intended to allow user
  77.      programs to be written independent of the kernel limit on the number of
  78.      open files, the dimension of a sufficiently large bit field for select
  79.      remains a problem.  The default size FD_SETSIZE (currently 256) is some­
  80.      what larger than the current kernel limit to the number of open files.
  81.      However, in order to accommodate programs which might potentially use a
  82.      larger number of open files with select, it is possible to increase this
  83.      size within a program by providing a larger definition of FD_SETSIZE be­
  84.      fore the inclusion of <_s_y_s_/_t_y_p_e_s_._h>.
  85.  
  86.      SSeelleecctt() should probably return the time remaining from the original
  87.      timeout, if any, by modifying the time value in place.  This may be im­
  88.      plemented in future versions of the system.  Thus, it is unwise to assume
  89.      that the timeout value will be unmodified by the sseelleecctt() call.
  90.  
  91. HHIISSTTOORRYY
  92.      The sseelleecctt function call appeared in 4.2BSD.
  93.  
  94. 4.2 Berkeley Distribution       March 10, 1991                               2
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.