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


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:55