stm32h735/stm32h735g-dk/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 
35 /* Variables */
36 extern int __io_putchar(int ch) __attribute__((weak));
37 extern int __io_getchar(void) __attribute__((weak));
38 
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  errno = EINVAL;
57  return -1;
58 }
59 
60 void _exit (int status)
61 {
62  _kill(status, -1);
63  while (1) {} /* Make sure we hang here */
64 }
65 
66 __attribute__((weak)) int _read(int file, char *ptr, int len)
67 {
68  int DataIdx;
69 
70  for (DataIdx = 0; DataIdx < len; DataIdx++)
71  {
72  *ptr++ = __io_getchar();
73  }
74 
75 return len;
76 }
77 
78 __attribute__((weak)) int _write(int file, char *ptr, int len)
79 {
80  int DataIdx;
81 
82  for (DataIdx = 0; DataIdx < len; DataIdx++)
83  {
84  __io_putchar(*ptr++);
85  }
86  return len;
87 }
88 
89 int _close(int file)
90 {
91  return -1;
92 }
93 
94 
95 int _fstat(int file, struct stat *st)
96 {
97  st->st_mode = S_IFCHR;
98  return 0;
99 }
100 
101 int _isatty(int file)
102 {
103  return 1;
104 }
105 
106 int _lseek(int file, int ptr, int dir)
107 {
108  return 0;
109 }
110 
111 int _open(char *path, int flags, ...)
112 {
113  /* Pretend like we always fail */
114  return -1;
115 }
116 
117 int _wait(int *status)
118 {
119  errno = ECHILD;
120  return -1;
121 }
122 
123 int _unlink(char *name)
124 {
125  errno = ENOENT;
126  return -1;
127 }
128 
129 int _times(struct tms *buf)
130 {
131  return -1;
132 }
133 
134 int _stat(char *file, struct stat *st)
135 {
136  st->st_mode = S_IFCHR;
137  return 0;
138 }
139 
140 int _link(char *old, char *new)
141 {
142  errno = EMLINK;
143  return -1;
144 }
145 
146 int _fork(void)
147 {
148  errno = EAGAIN;
149  return -1;
150 }
151 
152 int _execve(char *name, char **argv, char **env)
153 {
154  errno = ENOMEM;
155  return -1;
156 }
_link
int _link(char *old, char *new)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:140
_kill
int _kill(int pid, int sig)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:54
errno
int errno
time.h
_stat
int _stat(char *file, struct stat *st)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:134
environ
char ** environ
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:41
initialise_monitor_handles
void initialise_monitor_handles()
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:45
python.setup.name
name
Definition: porcupine/binding/python/setup.py:69
_close
int _close(int file)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:89
_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
_wait
int _wait(int *status)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:117
_times
int _times(struct tms *buf)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:129
_unlink
int _unlink(char *name)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:123
_execve
int _execve(char *name, char **argv, char **env)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:152
__attribute__
__attribute__((weak))
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:66
__io_getchar
int __io_getchar(void)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:37
python.test_porcupine.argv
argv
Definition: test_porcupine.py:158
_open
int _open(char *path, int flags,...)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:111
_fstat
int _fstat(int file, struct stat *st)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:95
_exit
void _exit(int status)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:60
_isatty
int _isatty(int file)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:101
_lseek
int _lseek(int file, int ptr, int dir)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:106
_fork
int _fork(void)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:146
_getpid
int _getpid(void)
Definition: stm32h735/stm32h735g-dk/Src/syscalls.c:49
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
Definition: pv_stm32f469.c:141


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