* c-c++-common/scal-to-vec2.c: Ignore non-standard ABI message.
[official-gcc.git] / libgo / runtime / go-nosys.c
blob36bbdd26c35c0caed84c4c84efb27e124cf1ab7a
1 /* go-nosys.c -- functions missing from system.
3 Copyright 2012 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 /* This file exists to provide definitions for functions that are
8 missing from libc, according to the configure script. This permits
9 the Go syscall package to not worry about whether the functions
10 exist or not. */
12 #include "config.h"
14 #include <errno.h>
15 #include <fcntl.h>
16 #include <math.h>
17 #include <stdint.h>
18 #include <sys/types.h>
19 #include <sys/stat.h>
20 #include <sys/time.h>
21 #include <unistd.h>
23 #ifndef HAVE_OFF64_T
24 typedef signed int off64_t __attribute__ ((mode (DI)));
25 #endif
27 #ifndef HAVE_LOFF_T
28 typedef off64_t loff_t;
29 #endif
31 #ifndef HAVE_EPOLL_CREATE1
32 int
33 epoll_create1 (int flags __attribute__ ((unused)))
35 errno = ENOSYS;
36 return -1;
38 #endif
40 #ifndef HAVE_FACCESSAT
41 int
42 faccessat (int fd __attribute__ ((unused)),
43 const char *pathname __attribute__ ((unused)),
44 int mode __attribute__ ((unused)),
45 int flags __attribute__ ((unused)))
47 errno = ENOSYS;
48 return -1;
50 #endif
52 #ifndef HAVE_FALLOCATE
53 int
54 fallocate (int fd __attribute__ ((unused)),
55 int mode __attribute__ ((unused)),
56 off_t offset __attribute__ ((unused)),
57 off_t len __attribute__ ((unused)))
59 errno = ENOSYS;
60 return -1;
62 #endif
64 #ifndef HAVE_FCHMODAT
65 int
66 fchmodat (int dirfd __attribute__ ((unused)),
67 const char *pathname __attribute__ ((unused)),
68 mode_t mode __attribute__ ((unused)),
69 int flags __attribute__ ((unused)))
71 errno = ENOSYS;
72 return -1;
74 #endif
76 #ifndef HAVE_FCHOWNAT
77 int
78 fchownat (int dirfd __attribute__ ((unused)),
79 const char *pathname __attribute__ ((unused)),
80 uid_t owner __attribute__ ((unused)),
81 gid_t group __attribute__ ((unused)),
82 int flags __attribute__ ((unused)))
84 errno = ENOSYS;
85 return -1;
87 #endif
89 #ifndef HAVE_FUTIMESAT
90 int
91 futimesat (int dirfd __attribute__ ((unused)),
92 const char *pathname __attribute__ ((unused)),
93 const struct timeval times[2] __attribute__ ((unused)))
95 errno = ENOSYS;
96 return -1;
98 #endif
100 #ifndef HAVE_INOTIFY_ADD_WATCH
102 inotify_add_watch (int fd __attribute__ ((unused)),
103 const char* pathname __attribute__ ((unused)),
104 uint32_t mask __attribute__ ((unused)))
106 errno = ENOSYS;
107 return -1;
109 #endif
111 #ifndef HAVE_INOTIFY_INIT
113 inotify_init (void)
115 errno = ENOSYS;
116 return -1;
118 #endif
120 #ifndef HAVE_INOTIFY_INIT1
122 inotify_init1 (int flags __attribute__ ((unused)))
124 errno = ENOSYS;
125 return -1;
127 #endif
129 #ifndef HAVE_INOTIFY_RM_WATCH
131 inotify_rm_watch (int fd __attribute__ ((unused)),
132 uint32_t wd __attribute__ ((unused)))
134 errno = ENOSYS;
135 return -1;
137 #endif
139 #ifndef HAVE_MKDIRAT
141 mkdirat (int dirfd __attribute__ ((unused)),
142 const char *pathname __attribute__ ((unused)),
143 mode_t mode __attribute__ ((unused)))
145 errno = ENOSYS;
146 return -1;
148 #endif
150 #ifndef HAVE_MKNODAT
152 mknodat (int dirfd __attribute__ ((unused)),
153 const char *pathname __attribute__ ((unused)),
154 mode_t mode __attribute__ ((unused)),
155 dev_t dev __attribute__ ((unused)))
157 errno = ENOSYS;
158 return -1;
160 #endif
162 #ifndef HAVE_OPENAT
164 openat (int dirfd __attribute__ ((unused)),
165 const char *pathname __attribute__ ((unused)),
166 int oflag __attribute__ ((unused)),
167 ...)
169 errno = ENOSYS;
170 return -1;
172 #endif
174 #ifndef HAVE_RENAMEAT
176 renameat (int olddirfd __attribute__ ((unused)),
177 const char *oldpath __attribute__ ((unused)),
178 int newdirfd __attribute__ ((unused)),
179 const char *newpath __attribute__ ((unused)))
181 errno = ENOSYS;
182 return -1;
184 #endif
186 #ifndef HAVE_SPLICE
188 splice (int fd __attribute__ ((unused)),
189 loff_t *off_in __attribute__ ((unused)),
190 int fd_out __attribute__ ((unused)),
191 loff_t *off_out __attribute__ ((unused)),
192 size_t len __attribute__ ((unused)),
193 unsigned int flags __attribute__ ((unused)))
195 errno = ENOSYS;
196 return -1;
198 #endif
200 #ifndef HAVE_SYNC_FILE_RANGE
202 sync_file_range (int fd __attribute__ ((unused)),
203 off64_t offset __attribute__ ((unused)),
204 off64_t nbytes __attribute__ ((unused)),
205 unsigned int flags __attribute__ ((unused)))
207 errno = ENOSYS;
208 return -1;
210 #endif
212 #ifndef HAVE_TEE
214 tee (int fd_in __attribute__ ((unused)),
215 int fd_out __attribute__ ((unused)),
216 size_t len __attribute__ ((unused)),
217 unsigned int flags __attribute__ ((unused)))
219 errno = ENOSYS;
220 return -1;
222 #endif
224 #ifndef HAVE_UNLINKAT
226 unlinkat (int dirfd __attribute__ ((unused)),
227 const char *pathname __attribute__ ((unused)),
228 int flags __attribute__ ((unused)))
230 errno = ENOSYS;
231 return -1;
233 #endif
235 #ifndef HAVE_UNSHARE
237 unshare (int flags __attribute__ ((unused)))
239 errno = ENOSYS;
240 return -1;
242 #endif
244 /* Long double math functions. These are needed on old i386 systems
245 that don't have them in libm. The compiler translates calls to
246 these functions on float64 to call an 80-bit floating point
247 function instead, because when optimizing that function can be
248 executed as an x87 instructure. However, when not optimizing, this
249 translates into a call to the math function. So on systems that
250 don't provide these functions, we provide a version that just calls
251 the float64 version. */
253 #ifndef HAVE_COSL
254 long double
255 cosl (long double a)
257 return (long double) cos ((double) a);
259 #endif
261 #ifndef HAVE_EXPL
262 long double
263 expl (long double a)
265 return (long double) exp ((double) a);
267 #endif
269 #ifndef HAVE_LOGL
270 long double
271 logl (long double a)
273 return (long double) log ((double) a);
275 #endif
277 #ifndef HAVE_SINL
278 long double
279 sinl (long double a)
281 return (long double) sin ((double) a);
283 #endif
285 #ifndef HAVE_TANL
286 long double
287 tanl (long double a)
289 return (long double) tan ((double) a);
291 #endif
293 #ifndef HAVE_ACOSL
294 long double
295 acosl (long double a)
297 return (long double) acos ((double) a);
299 #endif
301 #ifndef HAVE_ASINL
302 long double
303 asinl (long double a)
305 return (long double) asin ((double) a);
307 #endif
309 #ifndef HAVE_ATANL
310 long double
311 atanl (long double a)
313 return (long double) atan ((double) a);
315 #endif
317 #ifndef HAVE_ATAN2L
318 long double
319 atan2l (long double a, long double b)
321 return (long double) atan2 ((double) a, (double) b);
323 #endif
325 #ifndef HAVE_EXPM1L
326 long double
327 expm1l (long double a)
329 return (long double) expm1 ((double) a);
331 #endif
333 #ifndef HAVE_LDEXPL
334 long double
335 ldexpl (long double a, int exp)
337 return (long double) ldexp ((double) a, exp);
339 #endif
341 #ifndef HAVE_LOG10L
342 long double
343 log10l (long double a)
345 return (long double) log10 ((double) a);
347 #endif
349 #ifndef HAVE_LOG1PL
350 long double
351 log1pl (long double a)
353 return (long double) log1p ((double) a);
355 #endif