Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
getitimer(2)		      System Calls Manual		  getitimer(2)

NAME
       getitimer, setitimer - get/set value of interval	timer

SYNOPSIS
DESCRIPTION
       The  function  stores the current value of the timer specified by which
       into the	structure pointed to by	value.	The function  sets  the	 timer
       specified  by  which to the value specified in the structure pointed to
       by value, and if	ovalue is not a	 null  pointer,	 stores	 the  previous
       value of	the timer in the structure pointed to by ovalue.

       A timer value is	defined	by the structure.  If it_value is non-zero, it
       indicates the time to the next timer  expiration.   If  it_interval  is
       non-zero,  it  specifies	 a value to be used in reloading it_value when
       the timer expires.  Setting it_value to 0 disables a timer,  regardless
       of the value of it_interval.  Setting it_interval to 0 disables a timer
       after its next expiration (assuming it_value is non-zero).

       Implementations may place limitations on	the granularity	of timer  val-
       ues.   For each interval	timer, if the requested	timer value requires a
       finer granularity than the implementation supports,  the	 actual	 timer
       value will be rounded up	to the next supported value.

       Implementations may place limitations on	the timer value.  To make sure
       that a process gets at least as much time as requested, the timer value
       is rounded up to	the next timer tick (a timer tick is the smallest sup-
       ported value).  The timer value is rounded up to	the  next  timer  tick
       because,	 the  timer  will be initialize	somewhere between timer	ticks.
       If a is followed	by a without a timer tick in between, it  is  possible
       that the	value returned by may be more than the initial value requested
       by due to this rounding.

       An XSI-conforming implementation	provides each process  with  at	 least
       three interval timers, which are	indicated by the which argument:

	      Decrements in real time.	A
				       signal is delivered when	this timer ex-
				       pires.

	      Decrements in process virtual time.
				       It runs only when the process  is  exe-
				       cuting.	 A signal is delivered when it
				       expires.

	      Decrements both in process virtual time and when
				       the system is running on	behalf of  the
				       process.	  It is	designed to be used by
				       interpreters in statistically profiling
				       the execution of	interpreted programs.

       The interaction between and any of or is	unspecified.

RETURN VALUE
       Upon  successful	 completion,  or returns 0.  Otherwise,	-1 is returned
       and is set to indicate the error.

ERRORS
       The function will fail if:

	       [EINVAL]	     The value argument	is not in  canonical  form.(In
			     canonical	form,  the number of microseconds is a
			     non-negative integer less than 1,000,000 and  the
			     number of seconds is a non-negative integer.)

       The and functions may fail if:

	       [EINVAL]	     The which argument	is not recognized.

SEE ALSO
       alarm(2), sleep(3C), ualarm(2), usleep(2), <signal.h>, <sys/time.h>.

CHANGE HISTORY
       First released in Issue 4, Version 2.

getitimer(2)		      System Calls Manual		  getitimer(2)

				  HP-UX	EXTENSIONS

DESCRIPTION
       A timer value is	defined	by the itimerval structure:

       Time values smaller than	the resolution of the system clock are rounded
       up to this resolution.  The machine-dependent clock resolution is  sec-
       onds,  where  the constant is defined in	Time values larger than	an im-
       plementation-specific maximum value are rounded down to	this  maximum.
       The  maximum  values for	the three interval timers are specified	by the
       constants and defined in	On all implementations,	these values are guar-
       anteed to be at least 31	days (in seconds).

       Each  time the timer expires, the signal	is delivered.  Since this sig-
       nal can interrupt in-progress system calls, programs using  this	 timer
       must be prepared	to restart interrupted system calls.

       Interval	 timers	 are not inherited by a	child process across a but are
       inherited across	an

       Three macros for	manipulating time values are defined in

	      Set a time value to zero.

	      Test if a	time value is non-zero.

	      Compare two time values.
				(Beware	that and do not	work with the macro.)

       The timer used with is also used	by (see	 alarm(2)).   Thus  successive
       calls  to and set and return the	state of a single timer.  In addition,
       a call to sets the timer	interval to zero.

ERRORS
       or fail if any of the following conditions are encountered:

	      [EFAULT]	     The value structure specified a bad address.  Re-
			     liable  detection of this error is	implementation
			     dependent.

	      [EINVAL]	     A value structure specified a  microsecond	 value
			     less  that	 zero  or greater than or equal	to one
			     million.

	      [EINVAL]	     which does	not specify one	of the three  possible
			     timers.

EXAMPLES
       The  following call to sets the real-time interval timer	to expire ini-
       tially after 10 seconds and every 0.5 seconds thereafter:

AUTHOR
       was developed by	the University of California, Berkeley.

SEE ALSO
       alarm(2), exec(2), gettimeofday(2), signal(5).

								  getitimer(2)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | SEE ALSO | CHANGE HISTORY | DESCRIPTION | ERRORS | EXAMPLES | AUTHOR | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=getitimer&sektion=2&manpath=HP-UX+11.22>

home | help