source: rtems/c/src/lib/libc/no_posix.c @ acdb6558

4.104.114.84.95
Last change on this file since acdb6558 was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • 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#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems.h>
24
25#include <unistd.h>
26
27/*
28 *  These are directly supported (and completely correct) in the posix api.
29 */
30
31#if !defined(RTEMS_POSIX_API)
32pid_t getpid(void)
33{
34  return 0;
35}
36
37#if defined(RTEMS_NEWLIB)
38#include <sys/reent.h>
39
40pid_t _getpid_r(
41  struct _reent *ptr
42)
43{
44  return getpid();
45}
46#endif
47
48#endif
49
50#if !defined(RTEMS_POSIX_API)
51int kill( pid_t pid, int sig )
52{
53  return 0;
54}
55
56int _kill_r( pid_t pid, int sig )
57{
58  return 0;
59}
60#endif
61
62int __kill( pid_t pid, int sig )
63{
64  return 0;
65}
66
67
68/*
69 *  3.4.3 Delay Process Execution, P1003.1b-1993, p. 81
70 *
71 *  $Id$
72 */
73
74#include <time.h>
75#include <unistd.h>
76
77#include <rtems.h>
78
79#if !defined(RTEMS_POSIX_API)
80unsigned int sleep(
81  unsigned int seconds
82)
83{
84  rtems_status_code status;
85  rtems_interval    ticks_per_second;
86  rtems_interval    ticks;
87
88  status = rtems_clock_get(
89  RTEMS_CLOCK_GET_TICKS_PER_SECOND,
90  &ticks_per_second
91  );
92
93  ticks = seconds * ticks_per_second;
94
95  status = rtems_task_wake_after( ticks );
96
97  /*
98   *  Returns the "unslept" amount of time.  In RTEMS signals are not
99   *  interruptable, so tasks really sleep all of the requested time.
100   */
101
102  return 0;
103}
104#endif
105
Note: See TracBrowser for help on using the repository browser.