home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/time/c/RCS/getitmr,v $
- * $Date: 1996/10/30 21:59:01 $
- * $Revision: 1.3 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: getitmr,v $
- * Revision 1.3 1996/10/30 21:59:01 unixlib
- * Massive changes made by Nick Burret and Peter Burwood.
- *
- * Revision 1.2 1996/05/06 09:01:35 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:35:00 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: getitmr,v 1.3 1996/10/30 21:59:01 unixlib Rel $";
-
- #include <stddef.h>
- #include <errno.h>
- #include <sys/time.h>
- #include <sys/unix.h>
- #include <sys/syslib.h>
-
- /* The `getitimer' function stores information about the timer
- specified by 'which' in the structure pointed at by 'value'
-
- The return value and error conditions are the same as for
- `setitimer'.
-
- Set *value to the current setting of timer 'which'.
- Return 0 on success, -1 on errors. */
- int
- getitimer (enum __itimer_which which, struct itimerval *value)
- {
- /* We can't implement interval timers whilst executing in a task
- window. */
- if (__taskwindow)
- {
- errno = ENOSYS;
- return -1;
- }
-
- if ((unsigned)which >= __MAX_ITIMERS)
- {
- errno = EINVAL;
- return -1;
- }
- *value = __u->itimers[which];
-
- return 0;
- }
-