source: rtems/c/src/lib/libc/no_posix.c @ 4ec962cd

4.104.114.84.95
Last change on this file since 4ec962cd was 7edb9281, checked in by Joel Sherrill <joel.sherrill@…>, on 11/05/99 at 19:02:03

Following comments from Eric Norum <eric@…>, a fairly
substantial upgrade of newlibc.c occurred. Now the user extension
data area is used rather than notepads and as many routines as possible
were split into other files further reducing the minimum footprint
of an RTEMS executable.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Marginal implementations of some POSIX API routines
3 *  to be used when POSIX is disabled.
4 *
5 *    + getpid
6 *    + _getpid_r
7 *    + kill
8 *    + _kill_r
9 *    + __kill
10 *    + sleep
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.OARcorp.com/rtems/license.html.
15 *
16 *  $Id$
17 */
18
19#include <rtems.h>
20
21#include <unistd.h>
22
23/*
24 *  These are directly supported (and completely correct) in the posix api.
25 */
26
27#if !defined(RTEMS_POSIX_API)
28pid_t getpid(void)
29{
30  return 0;
31}
32
33#if defined(RTEMS_NEWLIB)
34#include <sys/reent.h>
35
36pid_t _getpid_r(
37  struct _reent *ptr
38)
39{
40  return getpid();
41}
42#endif
43
44#endif
45
46#if !defined(RTEMS_POSIX_API)
47int kill( pid_t pid, int sig )
48{
49  return 0;
50}
51
52int _kill_r( pid_t pid, int sig )
53{
54  return 0;
55}
56#endif
57
58int __kill( pid_t pid, int sig )
59{
60  return 0;
61}
62
63
64/*
65 *  3.4.3 Delay Process Execution, P1003.1b-1993, p. 81
66 *
67 *  $Id$
68 */
69
70#include <time.h>
71#include <unistd.h>
72
73#include <rtems.h>
74
75#if !defined(RTEMS_POSIX_API)
76unsigned int sleep(
77  unsigned int seconds
78)
79{
80  rtems_status_code status;
81  rtems_interval    ticks_per_second;
82  rtems_interval    ticks;
83
84  status = rtems_clock_get(
85  RTEMS_CLOCK_GET_TICKS_PER_SECOND,
86  &ticks_per_second
87  );
88
89  ticks = seconds * ticks_per_second;
90
91  status = rtems_task_wake_after( ticks );
92
93  /*
94   *  Returns the "unslept" amount of time.  In RTEMS signals are not
95   *  interruptable, so tasks really sleep all of the requested time.
96   */
97
98  return 0;
99}
100#endif
101
Note: See TracBrowser for help on using the repository browser.