Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/getitimer.html
2024-02-19 00:21:47 -05:00

181 lines
6.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>getitimer</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="getitimer"></a> <a name="tag_03_229"></a><!-- getitimer -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_229_01"></a>NAME</h4>
<blockquote>getitimer, setitimer - get and set value of interval timer</blockquote>
<h4><a name="tag_03_229_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/sys/time.h.html">sys/time.h</a>&gt;<br>
<br>
int getitimer(int</tt> <i>which</i><tt>, struct itimerval *</tt><i>value</i><tt>);<br>
int setitimer(int</tt> <i>which</i><tt>, const struct itimerval *restrict</tt> <i>value</i><tt>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct itimerval *restrict</tt> <i>ovalue</i><tt>); <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_229_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>getitimer</i>() function shall store the current value of the timer specified by <i>which</i> into the structure pointed
to by <i>value</i>. The <i>setitimer</i>() function shall set the timer specified by <i>which</i> to the value specified in the
structure pointed to by <i>value</i>, and if <i>ovalue</i> is not a null pointer, store the previous value of the timer in the
structure pointed to by <i>ovalue</i>.</p>
<p>A timer value is defined by the <b>itimerval</b> structure, specified in <a href=
"../basedefs/sys/time.h.html"><i>&lt;sys/time.h&gt;</i></a>. If <i>it_value</i> is non-zero, it shall indicate the time to the next
timer expiration. If <i>it_interval</i> is non-zero, it shall specify a value to be used in reloading <i>it_value</i> when the
timer expires. Setting <i>it_value</i> to 0 shall disable a timer, regardless of the value of <i>it_interval</i>. Setting
<i>it_interval</i> to 0 shall disable a timer after its next expiration (assuming <i>it_value</i> is non-zero).</p>
<p>Implementations may place limitations on the granularity of timer values. For each interval timer, if the requested timer value
requires a finer granularity than the implementation supports, the actual timer value shall be rounded up to the next supported
value.</p>
<p>An XSI-conforming implementation provides each process with at least three interval timers, which are indicated by the
<i>which</i> argument:</p>
<dl compact>
<dt>ITIMER_REAL</dt>
<dd>Decrements in real time. A SIGALRM signal is delivered when this timer expires.</dd>
<dt>ITIMER_VIRTUAL</dt>
<dd>Decrements in process virtual time. It runs only when the process is executing. A SIGVTALRM signal is delivered when it
expires.</dd>
<dt>ITIMER_PROF</dt>
<dd>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. Each time the ITIMER_PROF timer expires, the SIGPROF
signal is delivered.</dd>
</dl>
<p>The interaction between <i>setitimer</i>() and any of <a href="../functions/alarm.html"><i>alarm</i>()</a>, <a href=
"../functions/sleep.html"><i>sleep</i>()</a>, or <a href="../functions/usleep.html"><i>usleep</i>()</a> is unspecified.</p>
</blockquote>
<h4><a name="tag_03_229_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, <i>getitimer</i>() or <i>setitimer</i>() shall return 0; otherwise, -1 shall be returned and
<i>errno</i> set to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_229_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>setitimer</i>() function shall fail if:</p>
<dl compact>
<dt>[EINVAL]</dt>
<dd>The <i>value</i> argument is not in canonical form. (In canonical form, the number of microseconds is a non-negative integer
less than 1000000 and the number of seconds is a non-negative integer.)</dd>
</dl>
<p>The <i>getitimer</i>() and <i>setitimer</i>() functions may fail if:</p>
<dl compact>
<dt>[EINVAL]</dt>
<dd>The <i>which</i> argument is not recognized.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_229_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_229_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_229_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_229_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_229_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="alarm.html"><i>alarm</i>()</a> , <a href="sleep.html"><i>sleep</i>()</a> , <a href=
"timer_getoverrun.html"><i>timer_getoverrun</i>()</a> , <a href="ualarm.html"><i>ualarm</i>()</a> , <a href=
"usleep.html"><i>usleep</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a>, <a href="../basedefs/sys/time.h.html"><i>&lt;sys/time.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_229_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 4, Version 2.</p>
</blockquote>
<h4><a name="tag_03_229_12"></a>Issue 5</h4>
<blockquote>
<p>Moved from X/OPEN UNIX extension to BASE.</p>
</blockquote>
<h4><a name="tag_03_229_13"></a>Issue 6</h4>
<blockquote>
<p>The <b>restrict</b> keyword is added to the <i>setitimer</i>() prototype for alignment with the ISO/IEC&nbsp;9899:1999
standard.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>