OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libcsupport/] [src/] [no_posix.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  no_posix.c,v 1.2 2001/01/08 18:26:44 joel Exp
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)
32
pid_t getpid(void)
33
{
34
  return 0;
35
}
36
 
37
#if defined(RTEMS_NEWLIB)
38
#include <sys/reent.h>
39
 
40
pid_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)
51
int kill( pid_t pid, int sig )
52
{
53
  return 0;
54
}
55
 
56
int _kill_r( pid_t pid, int sig )
57
{
58
  return 0;
59
}
60
#endif
61
 
62
int __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
 *  no_posix.c,v 1.2 2001/01/08 18:26:44 joel Exp
72
 */
73
 
74
#include <time.h>
75
#include <unistd.h> 
76
 
77
#include <rtems.h>
78
 
79
#if !defined(RTEMS_POSIX_API)
80
unsigned 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
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.