source: rtems/cpukit/libcsupport/src/__times.c @ a29d2e7

4.104.114.84.95
Last change on this file since a29d2e7 was 50f32b11, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/18/04 at 06:05:35

Remove stray white spaces.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  times() - POSIX 1003.1b 4.5.2 - Get Process Times
3 *
4 *  COPYRIGHT (c) 1989-1999.
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 <rtems.h>
19
20#include <sys/times.h>
21#include <time.h>
22#include <sys/time.h>
23#include <errno.h>
24#include <assert.h>
25
26clock_t _times(
27   struct tms  *ptms
28)
29{
30  rtems_interval ticks;
31
32  if ( !ptms ) {
33    errno = EFAULT;
34    return -1;
35  }
36
37  /*
38   *  This call does not depend on TOD being initialized and can't fail.
39   */
40
41  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks );
42
43  /*
44   *  RTEMS technically has no notion of system versus user time
45   *  since there is no separation of OS from application tasks.
46   *  But we can at least make a distinction between the number
47   *  of ticks since boot and the number of ticks executed by this
48   *  this thread.
49   */
50
51  ptms->tms_utime  = _Thread_Executing->ticks_executed;
52  ptms->tms_stime  = ticks;
53  ptms->tms_cutime = 0;
54  ptms->tms_cstime = 0;
55
56  return ticks;
57}
58
59/*
60 *  times()
61 *
62 *  times() system call wrapper for _times() above.
63 */
64
65clock_t times(
66   struct tms  *ptms
67)
68{
69  return _times( ptms );
70}
71
72/*
73 *  _times_r
74 *
75 *  This is the Newlib dependent reentrant version of times().
76 */
77
78#if defined(RTEMS_NEWLIB)
79
80#include <reent.h>
81
82clock_t _times_r(
83   struct _reent *ptr,
84   struct tms  *ptms
85)
86{
87  return _times( ptms );
88}
89#endif
Note: See TracBrowser for help on using the repository browser.