|
|
1.1 ! root 1: .TH GETITIMER 2 "27 July 1983" ! 2: .UC 4 ! 3: .SH NAME ! 4: getitimer, setitimer \- get/set value of interval timer ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .ft B ! 8: #include <sys/time.h> ! 9: .PP ! 10: .ft B ! 11: #define ITIMER_REAL 0 /* real time intervals */ ! 12: #define ITIMER_VIRTUAL 1 /* virtual time intervals */ ! 13: #define ITIMER_PROF 2 /* user and system virtual time */ ! 14: .sp ! 15: .ft B ! 16: getitimer(which, value) ! 17: int which; ! 18: struct itimerval *value; ! 19: .PP ! 20: .ft B ! 21: setitimer(which, value, ovalue) ! 22: int which; ! 23: struct itimerval *value, *ovalue; ! 24: .fi ! 25: .SH DESCRIPTION ! 26: The system provides each process with three interval timers, ! 27: defined in ! 28: .RI < sys/time.h >. ! 29: The ! 30: .I getitimer ! 31: call returns the current value for the timer specified in ! 32: .IR which , ! 33: while the ! 34: .I setitimer ! 35: call sets the value of a timer (optionally returning the previous ! 36: value of the timer). ! 37: .PP ! 38: A timer value is defined by the ! 39: .I itimerval ! 40: structure: ! 41: .PP ! 42: .nf ! 43: .RS ! 44: .DT ! 45: struct itimerval { ! 46: struct timeval it_interval; /* timer interval */ ! 47: struct timeval it_value; /* current value */ ! 48: }; ! 49: .RE ! 50: .fi ! 51: .PP ! 52: If ! 53: .I it_value ! 54: is non-zero, it indicates the time to the next timer expiration. ! 55: If ! 56: .I it_interval ! 57: is non-zero, it specifies a value to be used in reloading ! 58: .I it_value ! 59: when the timer expires. ! 60: Setting ! 61: .I it_value ! 62: to 0 disables a timer. Setting ! 63: .I it_interval ! 64: to 0 causes a timer to be disabled after its next expiration (assuming ! 65: .I it_value ! 66: is non-zero). ! 67: .PP ! 68: Time values smaller than the resolution of the ! 69: system clock are rounded up to this resolution ! 70: .PP ! 71: The ITIMER_REAL timer decrements in real time. A SIGALRM signal is ! 72: delivered when this timer expires. ! 73: .PP ! 74: The ITIMER_VIRTUAL timer decrements in process virtual time. ! 75: It runs only when the process is executing. A SIGVTALRM signal ! 76: is delivered when it expires. ! 77: .PP ! 78: The ITIMER_PROF timer decrements both in process virtual time and ! 79: when the system is running on behalf of the process. It is designed ! 80: to be used by interpreters in statistically profiling the execution ! 81: of interpreted programs. ! 82: Each time the ITIMER_PROF timer expires, the SIGPROF signal is ! 83: delivered. Because this signal may interrupt in-progress ! 84: system calls, programs using this timer must be prepared to ! 85: restart interrupted system calls. ! 86: .SH NOTES ! 87: Three macros for manipulating time values are defined in ! 88: .RI < sys/time.h >. ! 89: .I Timerclear ! 90: sets a time value to zero, ! 91: .I timerisset ! 92: tests if a time value is non-zero, and ! 93: .I timercmp ! 94: compares two time values (beware that >= and <= do not ! 95: work with this macro). ! 96: .SH "RETURN VALUE ! 97: If the calls succeed, a value of 0 is returned. If an error occurs, ! 98: the value \-1 is returned, and a more precise error code is placed ! 99: in the global variable \fIerrno\fP. ! 100: .SH "ERRORS ! 101: The possible errors are: ! 102: .TP 15 ! 103: [EFAULT] ! 104: The \fIvalue\fP structure specified a bad address. ! 105: .TP 15 ! 106: [EINVAL] ! 107: A \fIvalue\fP structure specified a time was too large ! 108: to be handled. ! 109: .SH "SEE ALSO" ! 110: sigvec(2), gettimeofday(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.