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
18 #include <sys/types.h>
19 #include <sys/socket.h>
26 typedef signed int off64_t
__attribute__ ((mode (DI
)));
30 typedef off64_t loff_t
;
36 accept4 (int sockfd
__attribute__ ((unused
)),
37 struct sockaddr
*addr
__attribute__ ((unused
)),
38 socklen_t
*addrlen
__attribute__ ((unused
)),
39 int flags
__attribute__ ((unused
)))
48 dup3 (int oldfd
__attribute__ ((unused
)),
49 int newfd
__attribute__ ((unused
)),
50 int flags
__attribute__ ((unused
)))
57 #ifndef HAVE_EPOLL_CREATE1
59 epoll_create1 (int flags
__attribute__ ((unused
)))
66 #ifndef HAVE_FACCESSAT
68 faccessat (int fd
__attribute__ ((unused
)),
69 const char *pathname
__attribute__ ((unused
)),
70 int mode
__attribute__ ((unused
)),
71 int flags
__attribute__ ((unused
)))
78 #ifndef HAVE_FALLOCATE
80 fallocate (int fd
__attribute__ ((unused
)),
81 int mode
__attribute__ ((unused
)),
82 off_t offset
__attribute__ ((unused
)),
83 off_t len
__attribute__ ((unused
)))
92 fchmodat (int dirfd
__attribute__ ((unused
)),
93 const char *pathname
__attribute__ ((unused
)),
94 mode_t mode
__attribute__ ((unused
)),
95 int flags
__attribute__ ((unused
)))
102 #ifndef HAVE_FCHOWNAT
104 fchownat (int dirfd
__attribute__ ((unused
)),
105 const char *pathname
__attribute__ ((unused
)),
106 uid_t owner
__attribute__ ((unused
)),
107 gid_t group
__attribute__ ((unused
)),
108 int flags
__attribute__ ((unused
)))
115 #ifndef HAVE_FUTIMESAT
117 futimesat (int dirfd
__attribute__ ((unused
)),
118 const char *pathname
__attribute__ ((unused
)),
119 const struct timeval times
[2] __attribute__ ((unused
)))
126 #ifndef HAVE_GETXATTR
128 getxattr (const char *path
__attribute__ ((unused
)),
129 const char *name
__attribute__ ((unused
)),
130 void *value
__attribute__ ((unused
)),
131 size_t size
__attribute__ ((unused
)))
138 #ifndef HAVE_INOTIFY_ADD_WATCH
140 inotify_add_watch (int fd
__attribute__ ((unused
)),
141 const char* pathname
__attribute__ ((unused
)),
142 uint32_t mask
__attribute__ ((unused
)))
149 #ifndef HAVE_INOTIFY_INIT
158 #ifndef HAVE_INOTIFY_INIT1
160 inotify_init1 (int flags
__attribute__ ((unused
)))
167 #ifndef HAVE_INOTIFY_RM_WATCH
169 inotify_rm_watch (int fd
__attribute__ ((unused
)),
170 uint32_t wd
__attribute__ ((unused
)))
177 #ifndef HAVE_LISTXATTR
179 listxattr (const char *path
__attribute__ ((unused
)),
180 char *list
__attribute__ ((unused
)),
181 size_t size
__attribute__ ((unused
)))
190 mkdirat (int dirfd
__attribute__ ((unused
)),
191 const char *pathname
__attribute__ ((unused
)),
192 mode_t mode
__attribute__ ((unused
)))
201 mknodat (int dirfd
__attribute__ ((unused
)),
202 const char *pathname
__attribute__ ((unused
)),
203 mode_t mode
__attribute__ ((unused
)),
204 dev_t dev
__attribute__ ((unused
)))
213 openat (int dirfd
__attribute__ ((unused
)),
214 const char *pathname
__attribute__ ((unused
)),
215 int oflag
__attribute__ ((unused
)),
225 pipe2 (int pipefd
[2] __attribute__ ((unused
)),
226 int flags
__attribute__ ((unused
)))
233 #ifndef HAVE_REMOVEXATTR
235 removexattr (const char *path
__attribute__ ((unused
)),
236 const char *name
__attribute__ ((unused
)))
243 #ifndef HAVE_RENAMEAT
245 renameat (int olddirfd
__attribute__ ((unused
)),
246 const char *oldpath
__attribute__ ((unused
)),
247 int newdirfd
__attribute__ ((unused
)),
248 const char *newpath
__attribute__ ((unused
)))
255 #ifndef HAVE_SETXATTR
257 setxattr (const char *path
__attribute__ ((unused
)),
258 const char *name
__attribute__ ((unused
)),
259 const void *value
__attribute__ ((unused
)),
260 size_t size
__attribute__ ((unused
)),
261 int flags
__attribute__ ((unused
)))
270 splice (int fd
__attribute__ ((unused
)),
271 loff_t
*off_in
__attribute__ ((unused
)),
272 int fd_out
__attribute__ ((unused
)),
273 loff_t
*off_out
__attribute__ ((unused
)),
274 size_t len
__attribute__ ((unused
)),
275 unsigned int flags
__attribute__ ((unused
)))
282 #ifndef HAVE_SYNC_FILE_RANGE
284 sync_file_range (int fd
__attribute__ ((unused
)),
285 off64_t offset
__attribute__ ((unused
)),
286 off64_t nbytes
__attribute__ ((unused
)),
287 unsigned int flags
__attribute__ ((unused
)))
296 tee (int fd_in
__attribute__ ((unused
)),
297 int fd_out
__attribute__ ((unused
)),
298 size_t len
__attribute__ ((unused
)),
299 unsigned int flags
__attribute__ ((unused
)))
306 #ifndef HAVE_UNLINKAT
308 unlinkat (int dirfd
__attribute__ ((unused
)),
309 const char *pathname
__attribute__ ((unused
)),
310 int flags
__attribute__ ((unused
)))
319 unshare (int flags
__attribute__ ((unused
)))
326 #ifndef HAVE_UTIMENSAT
329 utimensat(int dirfd
__attribute__ ((unused
)),
330 const char *pathname
__attribute__ ((unused
)),
331 const struct timespec times
[2] __attribute__ ((unused
)),
332 int flags
__attribute__ ((unused
)))
339 /* Long double math functions. These are needed on old i386 systems
340 that don't have them in libm. The compiler translates calls to
341 these functions on float64 to call an 80-bit floating point
342 function instead, because when optimizing that function can be
343 executed as an x87 instructure. However, when not optimizing, this
344 translates into a call to the math function. So on systems that
345 don't provide these functions, we provide a version that just calls
346 the float64 version. */
352 return (long double) cos ((double) a
);
360 return (long double) exp ((double) a
);
368 return (long double) log ((double) a
);
376 return (long double) sin ((double) a
);
384 return (long double) tan ((double) a
);
390 acosl (long double a
)
392 return (long double) acos ((double) a
);
398 asinl (long double a
)
400 return (long double) asin ((double) a
);
406 atanl (long double a
)
408 return (long double) atan ((double) a
);
414 atan2l (long double a
, long double b
)
416 return (long double) atan2 ((double) a
, (double) b
);
422 expm1l (long double a
)
424 return (long double) expm1 ((double) a
);
430 ldexpl (long double a
, int exp
)
432 return (long double) ldexp ((double) a
, exp
);
438 log10l (long double a
)
440 return (long double) log10 ((double) a
);
446 log1pl (long double a
)
448 return (long double) log1p ((double) a
);