OSDN Git Service

eventfd: Implement eventfd2 and fix eventfd
[uclinux-h8/uClibc.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 make_stub(epoll_create)
99 #endif
100
101 #if !defined __NR_epoll_ctl && defined __UCLIBC_HAS_EPOLL__
102 make_stub(epoll_ctl)
103 #endif
104
105 #if !defined __NR_epoll_pwait && defined __UCLIBC_HAS_EPOLL__
106 make_stub(epoll_pwait)
107 #endif
108
109 #if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__
110 make_stub(epoll_wait)
111 #endif
112
113 #if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__
114 make_stub(eventfd)
115 #endif
116
117 #if !defined __NR_fdatasync && !defined __NR_osf_fdatasync
118 make_stub(fdatasync)
119 #endif
120
121 #ifndef __NR_fgetxattr
122 make_stub(fgetxattr)
123 #endif
124
125 #ifndef __NR_flistxattr
126 make_stub(flistxattr)
127 #endif
128
129 #ifndef __NR_fork
130 make_stub(fork)
131 #endif
132
133 #ifndef __NR_fremovexattr
134 make_stub(fremovexattr)
135 #endif
136
137 #ifndef __NR_fsetxattr
138 make_stub(fsetxattr)
139 #endif
140
141 #if !defined __NR_fstatfs && defined __UCLIBC_LINUX_SPECIFIC__
142 make_stub(fstatfs)
143 #endif
144
145 #ifndef __NR_get_kernel_syms
146 make_stub(get_kernel_syms)
147 #endif
148
149 #if !defined __NR_getpeername && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
150 make_stub(getpeername)
151 #endif
152
153 #if !defined __NR_getpgrp && !defined __NR_getpgid
154 make_stub(getpgrp)
155 #endif
156
157 #if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
158 make_stub(getsockname)
159 #endif
160
161 #if !defined __NR_getsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
162 make_stub(getsockopt)
163 #endif
164
165 #ifndef __NR_getxattr
166 make_stub(getxattr)
167 #endif
168
169 #if !defined __NR_init_module && defined __UCLIBC_LINUX_MODULE_26__
170 make_stub(init_module)
171 #endif
172
173 #if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__
174 make_stub(inotify_add_watch)
175 #endif
176
177 #if !defined __NR_inotify_init && defined __UCLIBC_LINUX_SPECIFIC__
178 make_stub(inotify_init)
179 #endif
180
181 #if !defined __NR_inotify_init1 && defined __UCLIBC_LINUX_SPECIFIC__
182 make_stub(inotify_init1)
183 #endif
184
185 #if !defined __NR_inotify_rm_watch && defined __UCLIBC_LINUX_SPECIFIC__
186 make_stub(inotify_rm_watch)
187 #endif
188
189 #if !defined __NR_ioperm && defined __UCLIBC_LINUX_SPECIFIC__
190 make_stub(ioperm)
191 #endif
192
193 #if !defined __NR_iopl && defined __UCLIBC_LINUX_SPECIFIC__
194 make_stub(iopl)
195 #endif
196
197 #ifndef __NR_lgetxattr
198 make_stub(lgetxattr)
199 #endif
200
201 #if !defined __NR_listen && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
202 make_stub(listen)
203 #endif
204
205 #ifndef __NR_listxattr
206 make_stub(listxattr)
207 #endif
208
209 #ifndef __NR_llistxattr
210 make_stub(llistxattr)
211 #endif
212
213 #ifndef __NR_lremovexattr
214 make_stub(lremovexattr)
215 #endif
216
217 #ifndef __NR_lsetxattr
218 make_stub(lsetxattr)
219 #endif
220
221 #if !defined __NR_madvise && defined __UCLIBC_LINUX_SPECIFIC__
222 make_stub(madvise)
223 #endif
224
225 #if !defined __NR_modify_ldt && defined __UCLIBC_LINUX_SPECIFIC__
226 make_stub(modify_ldt)
227 #endif
228
229 #ifndef __NR_openat
230 make_stub(openat)
231 # ifdef __UCLIBC_HAS_LFS__
232 make_stub(openat64)
233 # endif
234 #endif
235
236 #if !defined __NR_personality && defined __UCLIBC_LINUX_SPECIFIC__
237 make_stub(personality)
238 #endif
239
240 #if !defined __NR_pipe2 && defined __UCLIBC_LINUX_SPECIFIC__
241 make_stub(pipe2)
242 #endif
243
244 #if !defined __NR_pivot_root && defined __UCLIBC_LINUX_SPECIFIC__
245 make_stub(pivot_root)
246 #endif
247
248 #if !defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__
249 make_ret_stub(posix_fadvise)
250 #endif
251
252 #if !defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
253 make_ret_stub(posix_fadvise64)
254 #endif
255
256 #ifndef __NR_madvise
257 make_ret_stub(posix_madvise)
258 #endif
259
260 #if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
261 make_stub(ppoll)
262 #endif
263
264 #if !defined __NR_prctl && defined __UCLIBC_LINUX_SPECIFIC__
265 make_stub(prctl)
266 #endif
267
268 #if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__
269 make_stub(query_module)
270 #endif
271
272 #if !defined __NR_readahead && defined __UCLIBC_LINUX_SPECIFIC__
273 make_stub(readahead)
274 #endif
275
276 #if !defined __NR_reboot && defined __UCLIBC_LINUX_SPECIFIC__
277 make_stub(reboot)
278 #endif
279
280 #if !defined __NR_recv && !defined __NR_socketcall && !defined __NR_recvfrom && defined __UCLIBC_HAS_SOCKET__
281 make_stub(recv)
282 #endif
283
284 #if !defined __NR_recvfrom && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
285 make_stub(recvfrom)
286 #endif
287
288 #if !defined __NR_recvmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
289 make_stub(recvmsg)
290 #endif
291
292 #if !defined __NR_remap_file_pages && defined __UCLIBC_LINUX_SPECIFIC__
293 make_stub(remap_file_pages)
294 #endif
295
296 #ifndef __NR_removexattr
297 make_stub(removexattr)
298 #endif
299
300 #ifndef __NR_renameat
301 make_stub(renameat)
302 #endif
303
304 #if !defined __NR_sched_getaffinity && defined __UCLIBC_LINUX_SPECIFIC__
305 make_stub(sched_getaffinity)
306 #endif
307
308 #if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__)
309 make_stub(sched_getcpu)
310 #endif
311
312 #if !defined __NR_sched_setaffinity && defined __UCLIBC_LINUX_SPECIFIC__
313 make_stub(sched_setaffinity)
314 #endif
315
316 #if !defined __NR_send && !defined __NR_socketcall && !defined __NR_sendto && defined __UCLIBC_HAS_SOCKET__
317 make_stub(send)
318 #endif
319
320 #if !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__
321 make_stub(sendfile)
322 #endif
323
324 #if !defined __NR_sendfile64 && !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__ && defined __UCLIBC_HAS_LFS__
325 make_stub(sendfile64)
326 #endif
327
328 #if !defined __NR_sendmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
329 make_stub(sendmsg)
330 #endif
331
332 #if !defined __NR_sendto && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
333 make_stub(sendto)
334 #endif
335
336 #if ((__WORDSIZE == 32 && (!defined __NR_setfsgid32 && !defined __NR_setfsgid)) || (__WORDSIZE == 64 && !defined __NR_setfsgid)) && defined __UCLIBC_LINUX_SPECIFIC__
337 make_stub(setfsgid)
338 #endif
339
340 #if ((__WORDSIZE == 32 && (!defined __NR_setfsuid32 && !defined __NR_setfsuid)) || (__WORDSIZE == 64 && !defined __NR_setfsuid)) && defined __UCLIBC_LINUX_SPECIFIC__
341 make_stub(setfsuid)
342 #endif
343
344 #if !defined __NR_setresgid32 && !defined __NR_setresgid && defined __UCLIBC_LINUX_SPECIFIC__
345 make_stub(setresgid)
346 #endif
347
348 #if !defined __NR_setresuid32 && !defined __NR_setresuid && defined __UCLIBC_LINUX_SPECIFIC__
349 make_stub(setresuid)
350 #endif
351
352 #if !defined __NR_setsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
353 make_stub(setsockopt)
354 #endif
355
356 #ifndef __NR_setxattr
357 make_stub(setxattr)
358 #endif
359
360 #if !defined __NR_shutdown && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
361 make_stub(shutdown)
362 #endif
363
364 #if !defined __NR_signalfd4 && !defined __NR_signalfd && defined __UCLIBC_LINUX_SPECIFIC__
365 make_stub(signalfd)
366 #endif
367
368 #ifndef __NR_rt_sigtimedwait
369 make_stub(sigtimedwait)
370 make_stub(sigwaitinfo)
371 #endif
372
373 #ifndef __NR_rt_sigqueueinfo
374 make_stub(sigqueue)
375 #endif
376
377 #if !defined __NR_socket && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
378 make_stub(socket)
379 #endif
380
381 #if !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
382 make_stub(socketcall)
383 #endif
384
385 #if !defined __NR_socketpair && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
386 make_stub(socketpair)
387 #endif
388
389 #if !defined __NR_stime && !defined __NR_settimeofday
390 make_stub(stime)
391 make_stub(settimeofday)
392 #endif
393
394 #if !defined __NR_splice && defined __UCLIBC_LINUX_SPECIFIC__
395 make_stub(splice)
396 #endif
397
398 #if !defined __NR_swapoff && defined __UCLIBC_LINUX_SPECIFIC__
399 make_stub(swapoff)
400 #endif
401
402 #if !defined __NR_swapon && defined __UCLIBC_LINUX_SPECIFIC__
403 make_stub(swapon)
404 #endif
405
406 #ifndef __NR_symlink
407 make_stub(symlink)
408 #endif
409
410 #if !defined __NR_sync_file_range && defined __UCLIBC_LINUX_SPECIFIC__
411 make_stub(sync_file_range)
412 #endif
413
414 #if !defined __NR__sysctl && defined __UCLIBC_LINUX_SPECIFIC__
415 make_stub(_sysctl)
416 #endif
417
418 #if !defined __NR_sysinfo && defined __UCLIBC_LINUX_SPECIFIC__
419 make_stub(sysinfo)
420 #endif
421
422 #if !defined __NR_tee && defined __UCLIBC_LINUX_SPECIFIC__
423 make_stub(tee)
424 #endif
425
426 #if !defined __NR_timerfd_create && defined __UCLIBC_LINUX_SPECIFIC__
427 make_stub(timerfd_create)
428 #endif
429
430 #if !defined __NR_timerfd_settime && defined __UCLIBC_LINUX_SPECIFIC__
431 make_stub(timerfd_settime)
432 #endif
433
434 #if !defined __NR_timerfd_gettime && defined __UCLIBC_LINUX_SPECIFIC__
435 make_stub(timerfd_gettime)
436 #endif
437
438 #ifndef __NR_utimensat
439 make_stub(futimens)
440 make_stub(utimensat)
441 # ifndef __NR_lutimes
442 make_stub(lutimes)
443 # endif
444 #endif
445
446 #if !defined __NR_utime && !defined __NR_utimes
447 /*make_stub(utime) obsoleted */
448 make_stub(utimes)
449 #endif
450
451 #if !defined __NR_umount && !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
452 make_stub(umount)
453 #endif
454
455 #if !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
456 make_stub(umount2)
457 #endif
458
459 #if !defined __NR_unshare && defined __UCLIBC_LINUX_SPECIFIC__
460 make_stub(unshare)
461 #endif
462
463 #if !defined __NR_vhangup && defined __UCLIBC_LINUX_SPECIFIC__
464 make_stub(vhangup)
465 #endif
466
467 #if !defined __NR_vmsplice && defined __UCLIBC_LINUX_SPECIFIC__
468 make_stub(vmsplice)
469 #endif
470
471 #endif