1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
/* go-nosys.c -- functions missing from system.
Copyright 2012 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
/* This file exists to provide definitions for functions that are
missing from libc, according to the configure script. This permits
the Go syscall package to not worry about whether the functions
exist or not. */
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#ifndef HAVE_OFF64_T
typedef signed int off64_t __attribute__ ((mode (DI)));
#endif
#ifndef HAVE_LOFF_T
typedef off64_t loff_t;
#endif
#ifndef HAVE_ACCEPT4
struct sockaddr;
int
accept4 (int sockfd __attribute__ ((unused)),
struct sockaddr *addr __attribute__ ((unused)),
socklen_t *addrlen __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_EPOLL_CREATE1
int
epoll_create1 (int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_FACCESSAT
int
faccessat (int fd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
int mode __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_FALLOCATE
int
fallocate (int fd __attribute__ ((unused)),
int mode __attribute__ ((unused)),
off_t offset __attribute__ ((unused)),
off_t len __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_FCHMODAT
int
fchmodat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
mode_t mode __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_FCHOWNAT
int
fchownat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
uid_t owner __attribute__ ((unused)),
gid_t group __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_FUTIMESAT
int
futimesat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
const struct timeval times[2] __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_INOTIFY_ADD_WATCH
int
inotify_add_watch (int fd __attribute__ ((unused)),
const char* pathname __attribute__ ((unused)),
uint32_t mask __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_INOTIFY_INIT
int
inotify_init (void)
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_INOTIFY_INIT1
int
inotify_init1 (int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_INOTIFY_RM_WATCH
int
inotify_rm_watch (int fd __attribute__ ((unused)),
uint32_t wd __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_MKDIRAT
int
mkdirat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
mode_t mode __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_MKNODAT
int
mknodat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
mode_t mode __attribute__ ((unused)),
dev_t dev __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_OPENAT
int
openat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
int oflag __attribute__ ((unused)),
...)
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_PIPE2
int
pipe2 (int pipefd[2] __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_RENAMEAT
int
renameat (int olddirfd __attribute__ ((unused)),
const char *oldpath __attribute__ ((unused)),
int newdirfd __attribute__ ((unused)),
const char *newpath __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_SPLICE
int
splice (int fd __attribute__ ((unused)),
loff_t *off_in __attribute__ ((unused)),
int fd_out __attribute__ ((unused)),
loff_t *off_out __attribute__ ((unused)),
size_t len __attribute__ ((unused)),
unsigned int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_SYNC_FILE_RANGE
int
sync_file_range (int fd __attribute__ ((unused)),
off64_t offset __attribute__ ((unused)),
off64_t nbytes __attribute__ ((unused)),
unsigned int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_TEE
int
tee (int fd_in __attribute__ ((unused)),
int fd_out __attribute__ ((unused)),
size_t len __attribute__ ((unused)),
unsigned int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_UNLINKAT
int
unlinkat (int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_UNSHARE
int
unshare (int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_UTIMENSAT
struct timespec;
int
utimensat(int dirfd __attribute__ ((unused)),
const char *pathname __attribute__ ((unused)),
const struct timespec times[2] __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
/* Long double math functions. These are needed on old i386 systems
that don't have them in libm. The compiler translates calls to
these functions on float64 to call an 80-bit floating point
function instead, because when optimizing that function can be
executed as an x87 instructure. However, when not optimizing, this
translates into a call to the math function. So on systems that
don't provide these functions, we provide a version that just calls
the float64 version. */
#ifndef HAVE_COSL
long double
cosl (long double a)
{
return (long double) cos ((double) a);
}
#endif
#ifndef HAVE_EXPL
long double
expl (long double a)
{
return (long double) exp ((double) a);
}
#endif
#ifndef HAVE_LOGL
long double
logl (long double a)
{
return (long double) log ((double) a);
}
#endif
#ifndef HAVE_SINL
long double
sinl (long double a)
{
return (long double) sin ((double) a);
}
#endif
#ifndef HAVE_TANL
long double
tanl (long double a)
{
return (long double) tan ((double) a);
}
#endif
#ifndef HAVE_ACOSL
long double
acosl (long double a)
{
return (long double) acos ((double) a);
}
#endif
#ifndef HAVE_ASINL
long double
asinl (long double a)
{
return (long double) asin ((double) a);
}
#endif
#ifndef HAVE_ATANL
long double
atanl (long double a)
{
return (long double) atan ((double) a);
}
#endif
#ifndef HAVE_ATAN2L
long double
atan2l (long double a, long double b)
{
return (long double) atan2 ((double) a, (double) b);
}
#endif
#ifndef HAVE_EXPM1L
long double
expm1l (long double a)
{
return (long double) expm1 ((double) a);
}
#endif
#ifndef HAVE_LDEXPL
long double
ldexpl (long double a, int exp)
{
return (long double) ldexp ((double) a, exp);
}
#endif
#ifndef HAVE_LOG10L
long double
log10l (long double a)
{
return (long double) log10 ((double) a);
}
#endif
#ifndef HAVE_LOG1PL
long double
log1pl (long double a)
{
return (long double) log1p ((double) a);
}
#endif
|