source: rtems/cpukit/posix/src/timergetoverrun.c @ 8f6b7b51

4.104.115
Last change on this file since 8f6b7b51 was a6cbc9b, checked in by Joel Sherrill <joel.sherrill@…>, on 12/17/07 at 16:01:42

2007-12-17 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/preinstall.am, posix/include/rtems/posix/timer.h, score/src/objectget.c: Split POSIX Timer implementation into multiple files. Add obvious error checks for NULL parameters. Attempt to reduce include files.
  • posix/src/timercreate.c, posix/src/timerdelete.c, posix/src/timergetoverrun.c, posix/src/timergettime.c, posix/src/timerinserthelper.c, posix/src/timersettime.c, posix/src/timertsr.c: New files.
  • posix/src/ptimer1.c: Removed.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <time.h>
19#include <errno.h>
20
21#include <rtems/system.h>
22#include <rtems/seterr.h>
23#include <rtems/score/thread.h>
24#include <rtems/posix/timer.h>
25
26/*
27 * timer_getoverrun
28 *
29 * The expiration of a timer must increase by one a counter.
30 * After the signal handler associated to the timer finishes
31 * its execution, _POSIX_Timer_TSR will have to set this counter to 0.
32 */
33int timer_getoverrun(
34  timer_t   timerid
35)
36{
37  int                  overrun;
38  POSIX_Timer_Control *ptimer;
39  Objects_Locations    location;
40
41  ptimer = _POSIX_Timer_Get( timerid, &location );
42  switch ( location ) {
43
44    case OBJECTS_LOCAL:
45      overrun = ptimer->overrun;
46      ptimer->overrun = 0;
47      _Thread_Enable_dispatch();
48      return overrun;
49
50#if defined(RTEMS_MULTIPROCESSING)
51    case OBJECTS_REMOTE:
52#endif
53    case OBJECTS_ERROR:
54      break;
55  }
56
57  rtems_set_errno_and_return_minus_one( EINVAL );
58}
Note: See TracBrowser for help on using the repository browser.