Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pprz_syscalls.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
29 /*
30 * **** This file incorporates work covered by the following copyright and ****
31 * **** permission notice: ****
32 *
33 * Copyright (c) 2009 by Michael Fischer. All rights reserved.
34 *
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 *
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the author nor the names of its contributors may
45 * be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
51 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
52 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
53 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
54 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
55 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
56 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
57 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
58 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 ****************************************************************************/
62 
63 #include <stdlib.h>
64 #include <string.h>
65 #include <sys/stat.h>
66 #include <sys/types.h>
67 #include <unistd.h>
68 #include <signal.h>
69 
70 /***************************************************************************/
71 
72 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
73 
74 #ifndef USE_CHIBIOS_RTOS // already defined by chibios syscalls
75 
76 __attribute__((used))
77 int _read_r(struct _reent *r, int file, char * ptr, int len)
78 {
79  (void)r;
80  (void)file;
81  (void)ptr;
82  (void)len;
83  return -1;
84 }
85 
86 /***************************************************************************/
87 
88 __attribute__((used))
89 int _lseek_r(struct _reent *r, int file, int ptr, int dir)
90 {
91  (void)r;
92  (void)file;
93  (void)ptr;
94  (void)dir;
95  return 0;
96 }
97 
98 /***************************************************************************/
99 
100 __attribute__((used))
101 int _write_r(struct _reent *r, int file, char * ptr, int len)
102 {
103  (void)r;
104  (void)file;
105  (void)ptr;
106  return len;
107 }
108 
109 /***************************************************************************/
110 
111 __attribute__((used))
112 int _close_r(struct _reent *r, int file)
113 {
114  (void)r;
115  (void)file;
116  return 0;
117 }
118 
119 /***************************************************************************/
120 
121 __attribute__((used))
122 caddr_t _sbrk_r(struct _reent *r, int incr)
123 {
124  (void)r;
125  (void)incr;
126  return (caddr_t)-1;
127 }
128 
129 /***************************************************************************/
130 
131 __attribute__((used))
132 int _fstat_r(struct _reent *r, int file, struct stat * st)
133 {
134  (void)r;
135  (void)file;
136  (void)st;
137  return 0;
138 }
139 
140 /***************************************************************************/
141 
142 __attribute__((used))
143 int _isatty_r(struct _reent *r, int fd)
144 {
145  (void)r;
146  (void)fd;
147  return 1;
148 }
149 
150 #endif // USE_CHIBIOS_RTOS
151 
152 /***************************************************************************/
153 
154 __attribute__((used))
155 pid_t _getpid(void)
156 {
157  return 1;
158 }
159 
160 /***************************************************************************/
161 
162 __attribute__((noreturn))
163 void _exit(int i) {
164  (void)i;
165  while(1);
166 }
167 
168 /***************************************************************************/
169 
170 void _kill(void) {}
171 
172 #pragma GCC diagnostic pop
173 
174 /*** EOF ***/
pid_t _getpid(void)
int _write_r(struct _reent *r, int file, char *ptr, int len)
int _lseek_r(struct _reent *r, int file, int ptr, int dir)
Definition: pprz_syscalls.c:89
int _read_r(struct _reent *r, int file, char *ptr, int len)
Fake system calls.
Definition: pprz_syscalls.c:77
int _isatty_r(struct _reent *r, int fd)
int _fstat_r(struct _reent *r, int file, struct stat *st)
caddr_t _sbrk_r(struct _reent *r, int incr)
int _close_r(struct _reent *r, int file)
int fd
Definition: serial.c:26
void _kill(void)
void _exit(int i)