⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setitimer.html

📁 posix标准英文,html格式
💻 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-2004 IEEE and 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, 2004 Edition<br>Copyright &copy; 2001-2004 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 pointedto by <i>value</i>. The <i>setitimer</i>() function shall set the timer specified by <i>which</i> to the value specified in thestructure pointed to by <i>value</i>, and if <i>ovalue</i> is not a null pointer, store the previous value of the timer in thestructure 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 nexttimer expiration. If <i>it_interval</i> is non-zero, it shall specify a value to be used in reloading <i>it_value</i> when thetimer 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 valuerequires a finer granularity than the implementation supports, the actual timer value shall be rounded up to the next supportedvalue.</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 itexpires.</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 byinterpreters in statistically profiling the execution of interpreted programs. Each time the ITIMER_PROF timer expires, the SIGPROFsignal 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 integerless 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:1999standard.</p></blockquote><div class="box"><em>End of informative text.</em></div><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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -