OSDN Git Service

2c50307aa5ffeb7d3ab2f2446aef1425ae3eb0eb
[uclinux-h8/uclibc-ng.git] / libc / sysdeps / linux / common / stubs.c
1 /*
2  * system call not available stub
3  *
4  * Copyright (C) 2009 Analog Devices Inc.
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7  */
8
9 /* Please keep the list sorted alphabetically, in ascending order
10  * of the stub name!  */
11
12 #include <errno.h>
13 #include <bits/wordsize.h>
14 #include <sys/syscall.h>
15
16 #ifdef __UCLIBC_HAS_STUBS__
17
18 __attribute_used__ static int enosys_stub(void)
19 {
20         __set_errno(ENOSYS);
21         return -1;
22 }
23
24 __attribute_used__ static int ret_enosys_stub(void)
25 {
26         return ENOSYS;
27 }
28
29 #define make_stub(stub) \
30         link_warning(stub, #stub ": this function is not implemented") \
31         strong_alias(enosys_stub, stub)
32
33 #define make_ret_stub(stub) \
34         link_warning(stub, #stub ": this function is not implemented") \
35         strong_alias(ret_enosys_stub, stub)
36
37 #ifndef __ARCH_USE_MMU__
38 # undef __NR_fork
39 #endif
40
41 #ifdef __arm__
42 # define __NR_fadvise64_64 __NR_arm_fadvise64_64
43 # define __NR_fadvise64 __NR_arm_fadvise64_64
44 /* ARM always provides funcs w/out syscalls; disable the stubs */
45 # define __NR_ioperm 0
46 # define __NR_iopl 0
47 #endif
48
49 #ifdef __mips__
50 # define __NR_fadvise64_64 __NR_fadvise64
51 #endif
52
53 #ifdef __xtensa__
54 # define __NR_fadvise64 __NR_fadvise64_64
55 #endif
56
57 #if !defined __NR_accept && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
58 make_stub(accept)
59 #endif
60
61 #if !defined __NR_accept4 && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ && defined __UCLIBC_LINUX_SPECIFIC__
62 make_stub(accept4)
63 #endif
64
65 #if !defined __NR_arch_prctl && defined __UCLIBC_LINUX_SPECIFIC__
66 make_stub(arch_prctl)
67 #endif
68
69 #if !defined __NR_bdflush && defined __UCLIBC_LINUX_SPECIFIC__
70 make_stub(bdflush)
71 #endif
72
73 #if !defined __NR_bind && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
74 make_stub(bind)
75 #endif
76
77 #if !defined __NR_capget && defined __UCLIBC_LINUX_SPECIFIC__
78 make_stub(capget)
79 #endif
80
81 #if !defined __NR_capset && defined __UCLIBC_LINUX_SPECIFIC__
82 make_stub(capset)
83 #endif
84
85 #if !defined __NR_connect && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
86 make_stub(connect)
87 #endif
88
89 #if !defined __NR_create_module && defined __UCLIBC_LINUX_MODULE_24__
90 make_stub(create_module)
91 #endif
92
93 #if !defined __NR_delete_module && defined __UCLIBC_LINUX_MODULE_26__
94 make_stub(delete_module)
95 #endif
96
97 #if !defined __NR_epoll_create && defined __UCLIBC_HAS_EPOLL__ \
98         && !defined __NR_epoll_create1
99 make_stub(epoll_create)
100 #endif
101
102 #if !defined __NR_epoll_ctl && defined __UCLIBC_HAS_EPOLL__
103 make_stub(epoll_ctl)
104 #endif
105
106 #if !defined __NR_epoll_pwait && defined __UCLIBC_HAS_EPOLL__
107 make_stub(epoll_pwait)
108 #endif
109
110 #if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__ \
111                 && !defined __NR_epoll_pwait
112 make_stub(epoll_wait)
113 #endif
114
115 #if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__
116 make_stub(eventfd)
117 #endif
118
119 #if !defined __NR_fdatasync && !defined __NR_osf_fdatasync
120 make_stub(fdatasync)
121 #endif
122
123 #ifndef __NR_fgetxattr
124 make_stub(fgetxattr)
125 #endif
126
127 #ifndef __NR_flistxattr
128 make_stub(flistxattr)
129 #endif
130
131 #if !defined __NR_fork && !defined __NR_clone
132 make_stub(fork)
133 #endif
134
135 #ifndef __NR_fremovexattr
136 make_stub(fremovexattr)
137 #endif
138
139 #ifndef __NR_fsetxattr
140 make_stub(fsetxattr)
141 #endif
142
143 #if !defined __NR_fstatfs && !defined __NR_fstatfs64 \
144         && defined __UCLIBC_LINUX_SPECIFIC__
145 make_stub(fstatfs)
146 #endif
147
148 #ifndef __NR_get_kernel_syms
149 make_stub(get_kernel_syms)
150 #endif
151
152 #if !defined __NR_getpeername && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
153 make_stub(getpeername)
154 #endif
155
156 #if !defined __NR_getpgrp && !defined __NR_getpgid
157 make_stub(getpgrp)
158 #endif
159
160 #if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
161 make_stub(getsockname)
162 #endif
163
164 #if !defined __NR_getsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
165 make_stub(getsockopt)
166 #endif
167
168 #ifndef __NR_getxattr
169 make_stub(getxattr)
170 #endif
171
172 #if !defined __NR_init_module && defined __UCLIBC_LINUX_MODULE_26__
173 make_stub(init_module)
174 #endif
175
176 #if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__
177 make_stub(inotify_add_watch)
178 #endif
179
180 #if !defined __NR_inotify_init && defined __UCLIBC_LINUX_SPECIFIC__ \
181                 && !defined __NR_inotify_init1
182 make_stub(inotify_init)
183 #endif
184
185 #if !defined __NR_inotify_init1 && defined __UCLIBC_LINUX_SPECIFIC__
186 make_stub(inotify_init1)
187 #endif
188
189 #if !defined __NR_inotify_rm_watch && defined __UCLIBC_LINUX_SPECIFIC__
190 make_stub(inotify_rm_watch)
191 #endif
192
193 #if !defined __NR_ioperm && defined __UCLIBC_LINUX_SPECIFIC__
194 make_stub(ioperm)
195 #endif
196
197 #if !defined __NR_iopl && defined __UCLIBC_LINUX_SPECIFIC__
198 make_stub(iopl)
199 #endif
200
201 #ifndef __NR_lgetxattr
202 make_stub(lgetxattr)
203 #endif
204
205 #if !defined __NR_listen && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
206 make_stub(listen)
207 #endif
208
209 #ifndef __NR_listxattr
210 make_stub(listxattr)
211 #endif
212
213 #ifndef __NR_llistxattr
214 make_stub(llistxattr)
215 #endif
216
217 #ifndef __NR_lremovexattr
218 make_stub(lremovexattr)
219 #endif
220
221 #ifndef __NR_lsetxattr
222 make_stub(lsetxattr)
223 #endif
224
225 #if !defined __NR_madvise && defined __UCLIBC_LINUX_SPECIFIC__
226 make_stub(madvise)
227 #endif
228
229 #if !defined __NR_modify_ldt && defined __UCLIBC_LINUX_SPECIFIC__
230 make_stub(modify_ldt)
231 #endif
232
233 #ifndef __NR_openat
234 make_stub(openat)
235 # ifdef __UCLIBC_HAS_LFS__
236 make_stub(openat64)
237 # endif
238 #endif
239
240 #if !defined __NR_personality && defined __UCLIBC_LINUX_SPECIFIC__
241 make_stub(personality)
242 #endif
243
244 #if !defined __NR_pipe2 && defined __UCLIBC_LINUX_SPECIFIC__
245 make_stub(pipe2)
246 #endif
247
248 #if !defined __NR_pivot_root && defined __UCLIBC_LINUX_SPECIFIC__
249 make_stub(pivot_root)
250 #endif
251
252 #if !defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__
253 make_ret_stub(posix_fadvise)
254 #endif
255
256 #if !defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
257 make_ret_stub(posix_fadvise64)
258 #endif
259
260 #ifndef __NR_madvise
261 make_ret_stub(posix_madvise)
262 #endif
263
264 #if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
265 make_stub(ppoll)
266 #endif
267
268 #if !defined __NR_prctl && defined __UCLIBC_LINUX_SPECIFIC__
269 make_stub(prctl)
270 #endif
271
272 #if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__
273 make_stub(query_module)
274 #endif
275
276 #if !defined __NR_readahead && defined __UCLIBC_LINUX_SPECIFIC__
277 make_stub(readahead)
278 #endif
279
280 #if !defined __NR_reboot && defined __UCLIBC_LINUX_SPECIFIC__
281 make_stub(reboot)
282 #endif
283
284 #if !defined __NR_recv && !defined __NR_socketcall && !defined __NR_recvfrom && defined __UCLIBC_HAS_SOCKET__
285 make_stub(recv)
286 #endif
287
288 #if !defined __NR_recvfrom && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
289 make_stub(recvfrom)
290 #endif
291
292 #if !defined __NR_recvmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
293 make_stub(recvmsg)
294 #endif
295
296 #if !defined __NR_remap_file_pages && defined __UCLIBC_LINUX_SPECIFIC__
297 make_stub(remap_file_pages)
298 #endif
299
300 #ifndef __NR_removexattr
301 make_stub(removexattr)
302 #endif
303
304 #ifndef __NR_renameat
305 make_stub(renameat)
306 #endif
307
308 #if !defined __NR_sched_getaffinity && defined __UCLIBC_LINUX_SPECIFIC__
309 make_stub(sched_getaffinity)
310 #endif
311
312 #if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__)
313 make_stub(sched_getcpu)
314 #endif
315
316 #if !defined __NR_sched_setaffinity && defined __UCLIBC_LINUX_SPECIFIC__
317 make_stub(sched_setaffinity)
318 #endif
319
320 #if !defined __NR_send && !defined __NR_socketcall && !defined __NR_sendto && defined __UCLIBC_HAS_SOCKET__
321 make_stub(send)
322 #endif
323
324 #if !defined __NR_sendfile && !defined __NR_sendfile64 \
325         && defined __UCLIBC_LINUX_SPECIFIC__
326 make_stub(sendfile)
327 #endif
328
329 #if !defined __NR_sendfile64 && !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__ && defined __UCLIBC_HAS_LFS__
330 make_stub(sendfile64)
331 #endif
332
333 #if !defined __NR_sendmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
334 make_stub(sendmsg)
335 #endif
336
337 #if !defined __NR_sendto && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
338 make_stub(sendto)
339 #endif
340
341 #if ((__WORDSIZE == 32 && (!defined __NR_setfsgid32 && !defined __NR_setfsgid)) || (__WORDSIZE == 64 && !defined __NR_setfsgid)) && defined __UCLIBC_LINUX_SPECIFIC__
342 make_stub(setfsgid)
343 #endif
344
345 #if ((__WORDSIZE == 32 && (!defined __NR_setfsuid32 && !defined __NR_setfsuid)) || (__WORDSIZE == 64 && !defined __NR_setfsuid)) && defined __UCLIBC_LINUX_SPECIFIC__
346 make_stub(setfsuid)
347 #endif
348
349 #if !defined __NR_setns && defined __UCLIBC_LINUX_SPECIFIC__
350 make_stub(setns)
351 #endif
352
353 #if !defined __NR_setresgid32 && !defined __NR_setresgid && defined __UCLIBC_LINUX_SPECIFIC__
354 make_stub(setresgid)
355 #endif
356
357 #if !defined __NR_setresuid32 && !defined __NR_setresuid && defined __UCLIBC_LINUX_SPECIFIC__
358 make_stub(setresuid)
359 #endif
360
361 #if !defined __NR_setsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
362 make_stub(setsockopt)
363 #endif
364
365 #ifndef __NR_setxattr
366 make_stub(setxattr)
367 #endif
368
369 #if !defined __NR_shutdown && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
370 make_stub(shutdown)
371 #endif
372
373 #if !defined __NR_signalfd4 && !defined __NR_signalfd && defined __UCLIBC_LINUX_SPECIFIC__
374 make_stub(signalfd)
375 #endif
376
377 #ifndef __NR_rt_sigtimedwait
378 make_stub(sigtimedwait)
379 make_stub(sigwaitinfo)
380 #endif
381
382 #ifndef __NR_rt_sigqueueinfo
383 make_stub(sigqueue)
384 #endif
385
386 #if !defined __NR_socket && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
387 make_stub(socket)
388 #endif
389
390 #if !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
391 make_stub(socketcall)
392 #endif
393
394 #if !defined __NR_socketpair && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
395 make_stub(socketpair)
396 #endif
397
398 #if !defined __NR_stime && !defined __NR_settimeofday
399 make_stub(stime)
400 make_stub(settimeofday)
401 #endif
402
403 #if !defined __NR_splice && defined __UCLIBC_LINUX_SPECIFIC__
404 make_stub(splice)
405 #endif
406
407 #if !defined __NR_swapoff && defined __UCLIBC_LINUX_SPECIFIC__
408 make_stub(swapoff)
409 #endif
410
411 #if !defined __NR_swapon && defined __UCLIBC_LINUX_SPECIFIC__
412 make_stub(swapon)
413 #endif
414
415 #if !defined __NR_symlink && !defined __NR_symlinkat
416 make_stub(symlink)
417 #endif
418
419 #if !defined __NR_sync_file_range && defined __UCLIBC_LINUX_SPECIFIC__
420 make_stub(sync_file_range)
421 #endif
422
423 #if !defined __NR__sysctl && defined __UCLIBC_LINUX_SPECIFIC__
424 make_stub(_sysctl)
425 #endif
426
427 #if !defined __NR_sysinfo && defined __UCLIBC_LINUX_SPECIFIC__
428 make_stub(sysinfo)
429 #endif
430
431 #if !defined __NR_tee && defined __UCLIBC_LINUX_SPECIFIC__
432 make_stub(tee)
433 #endif
434
435 #if !defined __NR_timerfd_create && defined __UCLIBC_LINUX_SPECIFIC__
436 make_stub(timerfd_create)
437 #endif
438
439 #if !defined __NR_timerfd_settime && defined __UCLIBC_LINUX_SPECIFIC__
440 make_stub(timerfd_settime)
441 #endif
442
443 #if !defined __NR_timerfd_gettime && defined __UCLIBC_LINUX_SPECIFIC__
444 make_stub(timerfd_gettime)
445 #endif
446
447 #ifndef __NR_utimensat
448 make_stub(futimens)
449 make_stub(utimensat)
450 # ifndef __NR_lutimes
451 make_stub(lutimes)
452 # endif
453 #endif
454
455 #ifndef __NR_utimensat
456 #if !defined __NR_utime && !defined __NR_utimes
457 /*make_stub(utime) obsoleted */
458 make_stub(utimes)
459 #endif
460 #endif
461
462 #if !defined __NR_umount && !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
463 make_stub(umount)
464 #endif
465
466 #if !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
467 make_stub(umount2)
468 #endif
469
470 #if !defined __NR_unshare && defined __UCLIBC_LINUX_SPECIFIC__
471 make_stub(unshare)
472 #endif
473
474 #if defined __UCLIBC_SV4_DEPRECATED__ && !defined __NR_ustat
475 make_stub(ustat)
476 #endif
477
478 #if !defined __NR_vhangup && defined __UCLIBC_LINUX_SPECIFIC__
479 make_stub(vhangup)
480 #endif
481
482 #if !defined __NR_vmsplice && defined __UCLIBC_LINUX_SPECIFIC__
483 make_stub(vmsplice)
484 #endif
485
486 #endif