source: rtems/c/src/exec/libcsupport/src/__times.c @ 07a3253d

4.104.114.84.95
Last change on this file since 07a3253d was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  times() - POSIX 1003.1b 4.5.2 - Get Process Times
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems.h>
16
17#include <sys/times.h>
18#include <time.h>
19#include <sys/time.h>
20#include <errno.h>
21#include <assert.h>
22
23clock_t _times(
24   struct tms  *ptms
25)
26{
27  rtems_status_code  status;
28  rtems_interval     ticks;
29
30  if ( !ptms ) {
31    errno = EFAULT;
32    return -1;
33  }
34
35  /* "POSIX" does not seem to allow for not having a TOD */
36  status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks );
37  if ( status != RTEMS_SUCCESSFUL ) {
38    assert( 0 );
39    return -1;
40  }
41
42  /*
43   *  RTEMS has no notion of system versus user time and although
44   *  a way to keep track of per task CPU usage was added since
45   *  3.6.0, this routine does not utilize it yet.
46   */
47
48  ptms->tms_utime  = ticks;
49  ptms->tms_stime  = 0;
50  ptms->tms_cutime = 0;
51  ptms->tms_cstime = 0;
52
53  return 0;
54}
55
56/*
57 *  times()
58 *
59 *  times() system call wrapper for _times() above.
60 */
61
62clock_t times(
63   struct tms  *ptms
64)
65{
66  return _times( ptms );
67}
68
69/*
70 *  _times_r
71 *
72 *  This is the Newlib dependent reentrant version of times().
73 */
74
75#if defined(RTEMS_NEWLIB)
76
77#include <reent.h>
78
79clock_t _times_r(
80   struct _reent *ptr,
81   struct tms  *ptms
82)
83{
84  return _times( ptms );
85}
86#endif
Note: See TracBrowser for help on using the repository browser.