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

📄 getitimer.2

📁 早期freebsd实现
💻 2
字号:
.\" Copyright (c) 1983, 1991, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"     @(#)getitimer.2	8.2 (Berkeley) 12/11/93.\".Dd December 11, 1993.Dt GETITIMER 2.Os BSD 4.2.Sh NAME.Nm getitimer ,.Nm setitimer.Nd get/set value of interval timer.Sh SYNOPSIS.Fd #include <sys/time.h>.Fd #define ITIMER_REAL		0.Fd #define ITIMER_VIRTUAL	1.Fd #define ITIMER_PROF		2.Ft int.Fn getitimer "int which" "struct itimerval *value".Ft int.Fn setitimer "int which" "struct itimerval *value" "struct itimerval *ovalue".Sh DESCRIPTIONThe system provides each process with three interval timers,defined in.Ao Pa sys/time.h Ac .The.Fn getitimercall returns the current value for the timer specified in.Fa whichin the structure at.Fa value .The.Fn setitimercall sets a timer to the specified.Fa value(returning the previous value of the timer if.Fa ovalueis non-nil)..PpA timer value is defined by the .Fa itimervalstructure:.Bd -literal -offset indentstruct itimerval {	struct	timeval it_interval;	/* timer interval */	struct	timeval it_value;	/* current value */};.Ed.PpIf.Fa it_valueis non-zero, it indicates the time to the next timer expiration. If.Fa it_intervalis non-zero, it specifies a value to be used in reloading .Fa it_valuewhen the timer expires.Setting .Fa it_valueto 0 disables a timer.  Setting .Fa it_intervalto 0 causes a timer to be disabled after its next expiration (assuming.Fa it_valueis non-zero)..PpTime values smaller than the resolution of thesystem clock are rounded up to this resolution(typically 10 milliseconds)..PpThe.Dv ITIMER_REALtimer decrements in real time.  A.Dv SIGALRMsignal isdelivered when this timer expires..PpThe.Dv ITIMER_VIRTUALtimer decrements in process virtual time.It runs only when the process is executing.  A.Dv SIGVTALRMsignalis delivered when it expires..PpThe.Dv ITIMER_PROFtimer decrements both in process virtual time andwhen the system is running on behalf of the process.  It is designedto be used by interpreters in statistically profiling the executionof interpreted programs.Each time the.Dv ITIMER_PROFtimer expires, the.Dv SIGPROFsignal isdelivered.  Because this signal may interrupt in-progresssystem calls, programs using this timer must be prepared torestart interrupted system calls..Sh NOTESThree macros for manipulating time values are defined in.Ao Pa sys/time.h Ac ..Fa Timerclearsets a time value to zero,.Fa timerissettests if a time value is non-zero, and.Fa timercmpcompares two time values (beware that >= and <= do notwork with this macro)..Sh RETURN VALUESIf the calls succeed, a value of 0 is returned.  If an error occurs,the value -1 is returned, and a more precise error code is placedin the global variable.Va errno ..Sh ERRORS.Fn Getitimerand.Fn setitimerwill fail if:.Bl -tag -width Er.It Bq Er EFAULTThe.Fa valueparameter specified a bad address..It Bq Er EINVALA.Fa valueparameter specified a time that was too largeto be handled..El.Sh SEE ALSO.Xr select 2 ,.Xr sigvec 2 ,.Xr gettimeofday 2.Sh HISTORYThe.Nmfunction call appeared in.Bx 4.2 .

⌨️ 快捷键说明

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