OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libc/] [no_posix.c] - Blame information for rev 492

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: no_posix.c,v 1.2 2001-09-27 12:01:15 chris Exp $
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)
28
pid_t getpid(void)
29
{
30
  return 0;
31
}
32
 
33
#if defined(RTEMS_NEWLIB)
34
#include <sys/reent.h>
35
 
36
pid_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)
47
int kill( pid_t pid, int sig )
48
{
49
  return 0;
50
}
51
 
52
int _kill_r( pid_t pid, int sig )
53
{
54
  return 0;
55
}
56
#endif
57
 
58
int __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: no_posix.c,v 1.2 2001-09-27 12:01:15 chris Exp $
68
 */
69
 
70
#include <time.h>
71
#include <unistd.h> 
72
 
73
#include <rtems.h>
74
 
75
#if !defined(RTEMS_POSIX_API)
76
unsigned 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
 

powered by: WebSVN 2.1.0

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