ARMEBS4
revision-26.06.2015
Main Page
Modules
Data Structures
Files
File List
Globals
src
heivs
syscalls_minimal.c
1
#if (USE_SYSCALLS_MINIMAL != 0)
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <errno.h>
5
#include <
time.h
>
6
#include <sys/stat.h>
7
8
// Function declaration.
9
void
_exit(
int
i);
10
int
_open(
const
char
*
name
,
int
flags,
int
mode);
11
int
_read
(
int
file,
char
*ptr,
int
len);
12
int
_write(
int
file,
char
*buffer,
unsigned
int
count);
13
int
_lseek(
int
file,
int
ptr,
int
dir);
14
int
_fstat(
int
file,
struct
stat *st);
15
int
_link(
char
*old,
char
*new_);
16
int
_unlink(
char
*
name
);
17
int
_stat(
char
*file,
struct
stat *st);
18
int
_close(
int
file);
19
int
_execve(
char
*
name
,
char
**argv,
char
**env);
20
int
_fork();
21
int
_getpid();
22
int
_isatty(
int
file);
23
int
_kill(
int
pid,
int
sig);
24
int
times(
struct
tm *buf);
25
int
_wait(
int
*status);
26
27
#undef errno
28
extern
int
errno;
29
char
*__env[1] = {0};
30
char
**__environ = __env;
31
32
// Add dso_handle constant in case it does not exist.
33
// Used with shared libraries. Therefore not needed
34
// in an embedded system with no RTOS.
35
#ifndef __dso_handle
36
int
__dso_handle;
37
#endif
38
39
// Function definition.
40
void
_exit(
int
i)
41
{
42
// iprintf("Program exit with code %d", i);
43
while
(1);
44
}
45
46
int
_close(
int
file)
47
{
48
return
-1;
49
}
50
51
int
_fstat(
int
file,
struct
stat *st)
52
{
53
st->st_mode = S_IFCHR;
54
return
0;
55
}
56
57
int
_isatty(
int
file)
58
{
59
return
1;
60
}
61
62
int
_lseek(
int
file,
int
ptr,
int
dir)
63
{
64
return
0;
65
}
66
67
int
_open(
const
char
*
name
,
int
flags,
int
mode)
68
{
69
return
-1;
70
}
71
72
int
_link(
char
*old,
char
*new_)
73
{
74
errno = EMLINK;
75
return
-1;
76
}
77
78
int
_unlink(
char
*
name
)
79
{
80
errno = ENOENT;
81
return
-1;
82
}
83
84
int
_stat(
char
*file,
struct
stat *st)
85
{
86
st->st_mode = S_IFCHR;
87
return
0;
88
}
89
90
int
_execve(
char
*
name
,
char
**argv,
char
**env)
91
{
92
errno = ENOMEM;
93
return
-1;
94
}
95
96
int
_fork()
97
{
98
errno = EAGAIN;
99
return
-1;
100
}
101
102
int
_getpid()
103
{
104
return
1;
105
}
106
107
int
_kill(
int
pid,
int
sig)
108
{
109
errno = EINVAL;
110
return
(-1);
111
}
112
113
int
times(
struct
tm *buf)
114
{
115
return
-1;
116
}
117
118
int
_wait(
int
*status)
119
{
120
errno = ECHILD;
121
return
-1;
122
}
123
#endif // (USE_SYSCALLS_MINIMAL != 0)
heivs_bus_t::name
const char * name
Definition:
bus.h:102
time.h
simple time abstraction
heivs_bus_t::_read
status_e(* _read)(const struct heivs_bus_t *, uint32_t address, uint8_t *data, size_t len, size_t *rlen)
Definition:
bus.h:132
Generated on Fri Jun 26 2015 13:11:51 for ARMEBS4 by
1.8.9.1