Vehicle Control Unit
0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Core
Src
syscalls.c
Go to the documentation of this file.
1
23
/* Includes */
24
#include <sys/stat.h>
25
#include <stdlib.h>
26
#include <errno.h>
27
#include <stdio.h>
28
#include <signal.h>
29
#include <time.h>
30
#include <sys/time.h>
31
#include <sys/times.h>
32
33
34
/* Variables */
35
extern
int
__io_putchar
(
int
ch)
__attribute__
((weak));
36
extern
int
__io_getchar
(
void
)
__attribute__
((weak));
37
38
39
char
*__env[1] = { 0 };
40
char
**
environ
= __env;
41
42
43
/* Functions */
44
void
initialise_monitor_handles
()
45
{
46
}
47
48
int
_getpid
(
void
)
49
{
50
return
1;
51
}
52
53
int
_kill
(
int
pid,
int
sig)
54
{
55
(void)pid;
56
(void)sig;
57
errno = EINVAL;
58
return
-1;
59
}
60
61
void
_exit
(
int
status)
62
{
63
_kill
(status, -1);
64
while
(1) {}
/* Make sure we hang here */
65
}
66
67
__attribute__
((weak))
int
_read(
int
file,
char
*ptr,
int
len)
68
{
69
(void)file;
70
int
DataIdx;
71
72
for
(DataIdx = 0; DataIdx < len; DataIdx++)
73
{
74
*ptr++ =
__io_getchar
();
75
}
76
77
return
len;
78
}
79
80
__attribute__
((weak))
int
_write
(
int
file,
char
*ptr,
int
len)
81
{
82
(void)file;
83
int
DataIdx;
84
85
for
(DataIdx = 0; DataIdx < len; DataIdx++)
86
{
87
__io_putchar
(*ptr++);
88
}
89
return
len;
90
}
91
92
int
_close
(
int
file)
93
{
94
(void)file;
95
return
-1;
96
}
97
98
99
int
_fstat
(
int
file,
struct
stat *st)
100
{
101
(void)file;
102
st->st_mode = S_IFCHR;
103
return
0;
104
}
105
106
int
_isatty
(
int
file)
107
{
108
(void)file;
109
return
1;
110
}
111
112
int
_lseek
(
int
file,
int
ptr,
int
dir)
113
{
114
(void)file;
115
(void)ptr;
116
(void)dir;
117
return
0;
118
}
119
120
int
_open
(
char
*path,
int
flags, ...)
121
{
122
(void)path;
123
(void)flags;
124
/* Pretend like we always fail */
125
return
-1;
126
}
127
128
int
_wait
(
int
*status)
129
{
130
(void)status;
131
errno = ECHILD;
132
return
-1;
133
}
134
135
int
_unlink
(
char
*name)
136
{
137
(void)name;
138
errno = ENOENT;
139
return
-1;
140
}
141
142
int
_times
(
struct
tms *buf)
143
{
144
(void)buf;
145
return
-1;
146
}
147
148
int
_stat
(
char
*file,
struct
stat *st)
149
{
150
(void)file;
151
st->st_mode = S_IFCHR;
152
return
0;
153
}
154
155
int
_link
(
char
*old,
char
*
new
)
156
{
157
(void)old;
158
(void)
new
;
159
errno = EMLINK;
160
return
-1;
161
}
162
163
int
_fork
(
void
)
164
{
165
errno = EAGAIN;
166
return
-1;
167
}
168
169
int
_execve
(
char
*name,
char
**argv,
char
**env)
170
{
171
(void)name;
172
(void)argv;
173
(void)env;
174
errno = ENOMEM;
175
return
-1;
176
}
_write
int _write(int file, char *data, int len)
Definition:
main.c:1162
_kill
int _kill(int pid, int sig)
Definition:
syscalls.c:53
initialise_monitor_handles
void initialise_monitor_handles()
Definition:
syscalls.c:44
_open
int _open(char *path, int flags,...)
Definition:
syscalls.c:120
_link
int _link(char *old, char *new)
Definition:
syscalls.c:155
_fstat
int _fstat(int file, struct stat *st)
Definition:
syscalls.c:99
_stat
int _stat(char *file, struct stat *st)
Definition:
syscalls.c:148
_close
int _close(int file)
Definition:
syscalls.c:92
_fork
int _fork(void)
Definition:
syscalls.c:163
_unlink
int _unlink(char *name)
Definition:
syscalls.c:135
_lseek
int _lseek(int file, int ptr, int dir)
Definition:
syscalls.c:112
_getpid
int _getpid(void)
Definition:
syscalls.c:48
environ
char ** environ
Definition:
syscalls.c:40
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
_times
int _times(struct tms *buf)
Definition:
syscalls.c:142
_exit
void _exit(int status)
Definition:
syscalls.c:61
__io_getchar
int __io_getchar(void)
Definition:
syscalls.c:36
_execve
int _execve(char *name, char **argv, char **env)
Definition:
syscalls.c:169
_isatty
int _isatty(int file)
Definition:
syscalls.c:106
_wait
int _wait(int *status)
Definition:
syscalls.c:128
__attribute__
__attribute__((weak))
Definition:
syscalls.c:67
Generated by
1.9.5