home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat2 / getitimer.0 < prev    next >
Text File  |  1993-12-07  |  4KB  |  133 lines

  1.  
  2. GETITIMER(2)               UNIX Programmer's Manual               GETITIMER(2)
  3.  
  4. NNAAMMEE
  5.      ggeettiittiimmeerr, sseettiittiimmeerr - get/set value of interval timer
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  9.      ##ddeeffiinnee IITTIIMMEERR__RREEAALL      00
  10.      ##ddeeffiinnee IITTIIMMEERR__VVIIRRTTUUAALL   11
  11.      ##ddeeffiinnee IITTIIMMEERR__PPRROOFF      22
  12.  
  13.      _i_n_t
  14.      ggeettiittiimmeerr(_i_n_t _w_h_i_c_h, _s_t_r_u_c_t _i_t_i_m_e_r_v_a_l _*_v_a_l_u_e)
  15.  
  16.      _i_n_t
  17.      sseettiittiimmeerr(_i_n_t _w_h_i_c_h, _s_t_r_u_c_t _i_t_i_m_e_r_v_a_l _*_v_a_l_u_e, _s_t_r_u_c_t _i_t_i_m_e_r_v_a_l _*_o_v_a_l_u_e)
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      The system provides each process with three interval timers, defined in
  21.      <_s_y_s_/_t_i_m_e_._h>. The ggeettiittiimmeerr() call returns the current value for the
  22.      timer specified in _w_h_i_c_h in the structure at _v_a_l_u_e. The sseettiittiimmeerr() call
  23.      sets a timer to the specified _v_a_l_u_e (returning the previous value of the
  24.      timer if _o_v_a_l_u_e is non­nil).
  25.  
  26.      A timer value is defined by the _i_t_i_m_e_r_v_a_l structure:
  27.  
  28.            struct itimerval {
  29.                    struct  timeval it_interval;    /* timer interval */
  30.                    struct  timeval it_value;       /* current value */
  31.            };
  32.  
  33.      If _i_t___v_a_l_u_e is non­zero, it indicates the time to the next timer expira­
  34.      tion.  If _i_t___i_n_t_e_r_v_a_l is non­zero, it specifies a value to be used in
  35.      reloading _i_t___v_a_l_u_e when the timer expires.  Setting _i_t___v_a_l_u_e to 0 dis­
  36.      ables a timer.  Setting _i_t___i_n_t_e_r_v_a_l to 0 causes a timer to be disabled
  37.      after its next expiration (assuming _i_t___v_a_l_u_e is non­zero).
  38.  
  39.      Time values smaller than the resolution of the system clock are rounded
  40.      up to this resolution (typically 10 milliseconds).
  41.  
  42.      The ITIMER_REAL timer decrements in real time.  A SIGALRM signal is de­
  43.      livered when this timer expires.
  44.  
  45.      The ITIMER_VIRTUAL timer decrements in process virtual time.  It runs on­
  46.      ly when the process is executing.  A SIGVTALRM signal is delivered when
  47.      it expires.
  48.  
  49.      The ITIMER_PROF timer decrements both in process virtual time and when
  50.      the system is running on behalf of the process.  It is designed to be
  51.      used by interpreters in statistically profiling the execution of inter­
  52.      preted programs.  Each time the ITIMER_PROF timer expires, the SIGPROF
  53.      signal is delivered.  Because this signal may interrupt in­progress sys­
  54.      tem calls, programs using this timer must be prepared to restart inter­
  55.      rupted system calls.
  56.  
  57. NNOOTTEESS
  58.      Three macros for manipulating time values are defined in <_s_y_s_/_t_i_m_e_._h>.
  59.      _T_i_m_e_r_c_l_e_a_r sets a time value to zero, _t_i_m_e_r_i_s_s_e_t tests if a time value is
  60.      non­zero, and _t_i_m_e_r_c_m_p compares two time values (beware that >= and <= do
  61.      not work with this macro).
  62.  
  63. RREETTUURRNN VVAALLUUEESS
  64.      If the calls succeed, a value of 0 is returned.  If an error occurs, the
  65.      value ­1 is returned, and a more precise error code is placed in the
  66.      global variable _e_r_r_n_o.
  67.  
  68. EERRRROORRSS
  69.      GGeettiittiimmeerr() and sseettiittiimmeerr() will fail if:
  70.  
  71.      [EFAULT]      The _v_a_l_u_e parameter specified a bad address.
  72.  
  73.      [EINVAL]      A _v_a_l_u_e parameter specified a time was too large to be han­
  74.                    dled.
  75.  
  76. SSEEEE AALLSSOO
  77.      select(2),  sigvec(2),  gettimeofday(2)
  78.  
  79. HHIISSTTOORRYY
  80.      The ggeettiittiimmeerr function call appeared in 4.2BSD.
  81.  
  82. 4.2 Berkeley Distribution       March 10, 1991                               2
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  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.