yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 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 | #include <errno.h> |
| 10 | #include <bits/wordsize.h> |
| 11 | #include <sys/syscall.h> |
| 12 | |
| 13 | #ifdef __UCLIBC_HAS_STUBS__ |
| 14 | |
| 15 | static int enosys_stub(void) __attribute_used__; |
| 16 | static int enosys_stub(void) |
| 17 | { |
| 18 | __set_errno(ENOSYS); |
| 19 | return -1; |
| 20 | } |
| 21 | |
| 22 | #define make_stub(stub) \ |
| 23 | link_warning(stub, #stub ": this function is not implemented") \ |
| 24 | strong_alias(enosys_stub, stub) |
| 25 | |
| 26 | #ifndef __ARCH_USE_MMU__ |
| 27 | # undef __NR_fork |
| 28 | #endif |
| 29 | |
| 30 | #ifndef __UCLIBC_HAS_LFS__ |
| 31 | # undef __NR_fadvise64 |
| 32 | # undef __NR_fadvise64_64 |
| 33 | # undef __NR_sync_file_range |
| 34 | #endif |
| 35 | |
| 36 | #if !defined __NR_accept && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 37 | make_stub(accept) |
| 38 | #endif |
| 39 | |
| 40 | #if !defined __NR_accept4 && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ && defined __UCLIBC_LINUX_SPECIFIC__ |
| 41 | make_stub(accept4) |
| 42 | #endif |
| 43 | |
| 44 | #if !defined __NR_arch_prctl && defined __UCLIBC_LINUX_SPECIFIC__ |
| 45 | make_stub(arch_prctl) |
| 46 | #endif |
| 47 | |
| 48 | #if !defined __NR_capget && defined __UCLIBC_LINUX_SPECIFIC__ |
| 49 | make_stub(capget) |
| 50 | #endif |
| 51 | |
| 52 | #if !defined __NR_capset && defined __UCLIBC_LINUX_SPECIFIC__ |
| 53 | make_stub(capset) |
| 54 | #endif |
| 55 | |
| 56 | #if !defined __NR_bdflush && defined __UCLIBC_LINUX_SPECIFIC__ |
| 57 | make_stub(bdflush) |
| 58 | #endif |
| 59 | |
| 60 | #if !defined __NR_bind && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 61 | make_stub(bind) |
| 62 | #endif |
| 63 | |
| 64 | #ifndef __NR_capget |
| 65 | make_stub(capget) |
| 66 | #endif |
| 67 | |
| 68 | #ifndef __NR_capset |
| 69 | make_stub(capset) |
| 70 | #endif |
| 71 | |
| 72 | #if !defined __NR_connect && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 73 | make_stub(connect) |
| 74 | #endif |
| 75 | |
| 76 | #if !defined __NR_create_module && defined __UCLIBC_LINUX_MODULE_24__ |
| 77 | make_stub(create_module) |
| 78 | #endif |
| 79 | |
| 80 | #if !defined __NR_delete_module && defined __UCLIBC_LINUX_MODULE_26__ |
| 81 | make_stub(delete_module) |
| 82 | #endif |
| 83 | |
| 84 | #ifndef __NR_epoll_create |
| 85 | make_stub(epoll_create) |
| 86 | #endif |
| 87 | |
| 88 | #ifndef __NR_epoll_ctl |
| 89 | make_stub(epoll_ctl) |
| 90 | #endif |
| 91 | |
| 92 | #ifndef __NR_epoll_wait |
| 93 | make_stub(epoll_wait) |
| 94 | #endif |
| 95 | |
| 96 | #if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
| 97 | make_stub(eventfd) |
| 98 | #endif |
| 99 | |
| 100 | #ifndef __NR_fdatasync |
| 101 | make_stub(fdatasync) |
| 102 | #endif |
| 103 | |
| 104 | #ifndef __NR_flistxattr |
| 105 | make_stub(flistxattr) |
| 106 | #endif |
| 107 | |
| 108 | #ifndef __NR_fork |
| 109 | make_stub(fork) |
| 110 | #endif |
| 111 | |
| 112 | #ifndef __NR_fgetxattr |
| 113 | make_stub(fgetxattr) |
| 114 | #endif |
| 115 | |
| 116 | #ifndef __NR_fremovexattr |
| 117 | make_stub(fremovexattr) |
| 118 | #endif |
| 119 | |
| 120 | #ifndef __NR_fsetxattr |
| 121 | make_stub(fsetxattr) |
| 122 | #endif |
| 123 | |
| 124 | #if !defined __NR_fstatfs && defined __UCLIBC_LINUX_SPECIFIC__ |
| 125 | make_stub(fstatfs) |
| 126 | #endif |
| 127 | |
| 128 | #ifndef __NR_get_kernel_syms |
| 129 | make_stub(get_kernel_syms) |
| 130 | #endif |
| 131 | |
| 132 | #if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__) |
| 133 | make_stub(sched_getcpu) |
| 134 | #endif |
| 135 | |
| 136 | #if !defined __NR_getpeername && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 137 | make_stub(getpeername) |
| 138 | #endif |
| 139 | |
| 140 | #if !defined __NR_getpgrp && !defined __NR_getpgid |
| 141 | make_stub(getpgrp) |
| 142 | #endif |
| 143 | |
| 144 | #if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 145 | make_stub(getsockname) |
| 146 | #endif |
| 147 | |
| 148 | #if !defined __NR_getsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 149 | make_stub(getsockopt) |
| 150 | #endif |
| 151 | |
| 152 | #ifndef __NR_getxattr |
| 153 | make_stub(getxattr) |
| 154 | #endif |
| 155 | |
| 156 | #if !defined __NR_init_module && defined __UCLIBC_LINUX_MODULE_26__ |
| 157 | make_stub(init_module) |
| 158 | #endif |
| 159 | |
| 160 | #if !defined __NR_inotify_init && defined __UCLIBC_LINUX_SPECIFIC__ |
| 161 | make_stub(inotify_init) |
| 162 | #endif |
| 163 | |
| 164 | #if !defined __NR_inotify_init1 && defined __UCLIBC_LINUX_SPECIFIC__ |
| 165 | make_stub(inotify_init1) |
| 166 | #endif |
| 167 | |
| 168 | #if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__ |
| 169 | make_stub(inotify_add_watch) |
| 170 | #endif |
| 171 | |
| 172 | #if !defined __NR_inotify_rm_watch && defined __UCLIBC_LINUX_SPECIFIC__ |
| 173 | make_stub(inotify_rm_watch) |
| 174 | #endif |
| 175 | |
| 176 | #if !defined __NR_ioperm && defined __UCLIBC_LINUX_SPECIFIC__ && !defined __arm__ |
| 177 | make_stub(ioperm) |
| 178 | #endif |
| 179 | |
| 180 | #if !defined __NR_iopl && defined __UCLIBC_LINUX_SPECIFIC__ && !defined __arm__ |
| 181 | make_stub(iopl) |
| 182 | #endif |
| 183 | |
| 184 | #ifndef __NR_lgetxattr |
| 185 | make_stub(lgetxattr) |
| 186 | #endif |
| 187 | |
| 188 | #if !defined __NR_listen && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 189 | make_stub(listen) |
| 190 | #endif |
| 191 | |
| 192 | #ifndef __NR_listxattr |
| 193 | make_stub(listxattr) |
| 194 | #endif |
| 195 | |
| 196 | #ifndef __NR_llistxattr |
| 197 | make_stub(llistxattr) |
| 198 | #endif |
| 199 | |
| 200 | #ifndef __NR_lremovexattr |
| 201 | make_stub(lremovexattr) |
| 202 | #endif |
| 203 | |
| 204 | #ifndef __NR_lsetxattr |
| 205 | make_stub(lsetxattr) |
| 206 | #endif |
| 207 | |
| 208 | #if !defined __NR_madvise && defined __UCLIBC_LINUX_SPECIFIC__ |
| 209 | make_stub(madvise) |
| 210 | #endif |
| 211 | |
| 212 | #if !defined __NR_modify_ldt && defined __UCLIBC_LINUX_SPECIFIC__ |
| 213 | make_stub(modify_ldt) |
| 214 | #endif |
| 215 | |
| 216 | #if !defined __NR_personality && defined __UCLIBC_LINUX_SPECIFIC__ |
| 217 | make_stub(personality) |
| 218 | #endif |
| 219 | |
| 220 | #if !defined __NR_pipe2 && defined __UCLIBC_LINUX_SPECIFIC__ |
| 221 | make_stub(pipe2) |
| 222 | #endif |
| 223 | |
| 224 | #if !defined __NR_pivot_root && defined __UCLIBC_LINUX_SPECIFIC__ |
| 225 | make_stub(pivot_root) |
| 226 | #endif |
| 227 | |
| 228 | #if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ |
| 229 | make_stub(ppoll) |
| 230 | #endif |
| 231 | |
| 232 | #if !defined __NR_prctl && defined __UCLIBC_LINUX_SPECIFIC__ |
| 233 | make_stub(prctl) |
| 234 | #endif |
| 235 | |
| 236 | #if !defined __NR_readahead && defined __UCLIBC_LINUX_SPECIFIC__ |
| 237 | make_stub(readahead) |
| 238 | #endif |
| 239 | |
| 240 | #if !defined __NR_reboot && defined __UCLIBC_LINUX_SPECIFIC__ |
| 241 | make_stub(reboot) |
| 242 | #endif |
| 243 | |
| 244 | #if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__ |
| 245 | make_stub(query_module) |
| 246 | #endif |
| 247 | |
| 248 | #if !defined __NR_recv && !defined __NR_socketcall && !defined __NR_recvfrom && defined __UCLIBC_HAS_SOCKET__ |
| 249 | make_stub(recv) |
| 250 | #endif |
| 251 | |
| 252 | #if !defined __NR_recvfrom && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 253 | make_stub(recvfrom) |
| 254 | #endif |
| 255 | |
| 256 | #if !defined __NR_recvmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 257 | make_stub(recvmsg) |
| 258 | #endif |
| 259 | |
| 260 | #if !defined __NR_remap_file_pages && defined __UCLIBC_LINUX_SPECIFIC__ |
| 261 | make_stub(remap_file_pages) |
| 262 | #endif |
| 263 | |
| 264 | #ifndef __NR_removexattr |
| 265 | make_stub(removexattr) |
| 266 | #endif |
| 267 | |
| 268 | #if !defined __NR_sched_getaffinity && defined __UCLIBC_LINUX_SPECIFIC__ |
| 269 | make_stub(sched_getaffinity) |
| 270 | #endif |
| 271 | |
| 272 | #if !defined __NR_sched_setaffinity && defined __UCLIBC_LINUX_SPECIFIC__ |
| 273 | make_stub(sched_setaffinity) |
| 274 | #endif |
| 275 | |
| 276 | #if !defined __NR_send && !defined __NR_socketcall && !defined __NR_sendto && defined __UCLIBC_HAS_SOCKET__ |
| 277 | make_stub(send) |
| 278 | #endif |
| 279 | |
| 280 | #if !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__ |
| 281 | make_stub(sendfile) |
| 282 | #endif |
| 283 | |
| 284 | #if !defined __NR_sendfile64 && !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__ && defined __UCLIBC_HAS_LFS__ |
| 285 | make_stub(sendfile64) |
| 286 | #endif |
| 287 | |
| 288 | #if !defined __NR_sendmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 289 | make_stub(sendmsg) |
| 290 | #endif |
| 291 | |
| 292 | #if !defined __NR_sendto && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 293 | make_stub(sendto) |
| 294 | #endif |
| 295 | |
| 296 | #if ((__WORDSIZE == 32 && (!defined __NR_setfsgid32 && !defined __NR_setfsgid)) || (__WORDSIZE == 64 && !defined __NR_setfsgid)) && defined __UCLIBC_LINUX_SPECIFIC__ |
| 297 | make_stub(setfsgid) |
| 298 | #endif |
| 299 | |
| 300 | #if ((__WORDSIZE == 32 && (!defined __NR_setfsuid32 && !defined __NR_setfsuid)) || (__WORDSIZE == 64 && !defined __NR_setfsuid)) && defined __UCLIBC_LINUX_SPECIFIC__ |
| 301 | make_stub(setfsuid) |
| 302 | #endif |
| 303 | |
| 304 | #if !defined __NR_setresgid32 && !defined __NR_setresgid && defined __UCLIBC_LINUX_SPECIFIC__ |
| 305 | make_stub(setresgid) |
| 306 | #endif |
| 307 | |
| 308 | #if !defined __NR_setresuid32 && !defined __NR_setresuid && defined __UCLIBC_LINUX_SPECIFIC__ |
| 309 | make_stub(setresuid) |
| 310 | #endif |
| 311 | |
| 312 | #if !defined __NR_setsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 313 | make_stub(setsockopt) |
| 314 | #endif |
| 315 | |
| 316 | #ifndef __NR_setxattr |
| 317 | make_stub(setxattr) |
| 318 | #endif |
| 319 | |
| 320 | #if !defined __NR_shutdown && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 321 | make_stub(shutdown) |
| 322 | #endif |
| 323 | |
| 324 | #if !defined __NR_signalfd4 && !defined __NR_signalfd && defined __UCLIBC_LINUX_SPECIFIC__ |
| 325 | make_stub(signalfd) |
| 326 | #endif |
| 327 | |
| 328 | #if !defined __NR_socket && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 329 | make_stub(socket) |
| 330 | #endif |
| 331 | |
| 332 | #if !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 333 | make_stub(socketcall) |
| 334 | #endif |
| 335 | |
| 336 | #if !defined __NR_socketpair && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__ |
| 337 | make_stub(socketpair) |
| 338 | #endif |
| 339 | |
| 340 | #ifndef __NR_rt_sigtimedwait |
| 341 | make_stub(sigtimedwait) |
| 342 | make_stub(sigwaitinfo) |
| 343 | #endif |
| 344 | |
| 345 | #if !defined __NR_splice && defined __UCLIBC_LINUX_SPECIFIC__ |
| 346 | make_stub(splice) |
| 347 | #endif |
| 348 | |
| 349 | #if !defined __NR_swapoff && defined __UCLIBC_LINUX_SPECIFIC__ |
| 350 | make_stub(swapoff) |
| 351 | #endif |
| 352 | |
| 353 | #if !defined __NR_swapon && defined __UCLIBC_LINUX_SPECIFIC__ |
| 354 | make_stub(swapon) |
| 355 | #endif |
| 356 | |
| 357 | #if !defined __NR_sync_file_range && defined __UCLIBC_LINUX_SPECIFIC__ |
| 358 | make_stub(sync_file_range) |
| 359 | #endif |
| 360 | |
| 361 | #if !defined __NR__sysctl && defined __UCLIBC_LINUX_SPECIFIC__ |
| 362 | make_stub(_sysctl) |
| 363 | #endif |
| 364 | |
| 365 | #if !defined __NR_sysinfo && defined __UCLIBC_LINUX_SPECIFIC__ |
| 366 | make_stub(sysinfo) |
| 367 | #endif |
| 368 | |
| 369 | #if !defined __NR_tee && defined __UCLIBC_LINUX_SPECIFIC__ |
| 370 | make_stub(tee) |
| 371 | #endif |
| 372 | |
| 373 | #if !defined __NR_timerfd_create && defined __UCLIBC_LINUX_SPECIFIC__ |
| 374 | make_stub(timerfd_create) |
| 375 | #endif |
| 376 | |
| 377 | #if !defined __NR_timerfd_settime && defined __UCLIBC_LINUX_SPECIFIC__ |
| 378 | make_stub(timerfd_settime) |
| 379 | #endif |
| 380 | |
| 381 | #if !defined __NR_timerfd_gettime && defined __UCLIBC_LINUX_SPECIFIC__ |
| 382 | make_stub(timerfd_gettime) |
| 383 | #endif |
| 384 | |
| 385 | #if !defined __NR_umount && !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__ |
| 386 | make_stub(umount) |
| 387 | #endif |
| 388 | |
| 389 | #if !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__ |
| 390 | make_stub(umount2) |
| 391 | #endif |
| 392 | |
| 393 | #if !defined __NR_unshare && defined __UCLIBC_LINUX_SPECIFIC__ |
| 394 | make_stub(unshare) |
| 395 | #endif |
| 396 | |
| 397 | #ifndef __NR_utimensat |
| 398 | make_stub(futimens) |
| 399 | make_stub(utimensat) |
| 400 | # ifndef __NR_lutimes |
| 401 | make_stub(lutimes) |
| 402 | # endif |
| 403 | #endif |
| 404 | |
| 405 | #if !defined __NR_vhangup && defined __UCLIBC_LINUX_SPECIFIC__ |
| 406 | make_stub(vhangup) |
| 407 | #endif |
| 408 | |
| 409 | #ifndef __NR_vmsplice |
| 410 | make_stub(vmsplice) |
| 411 | #endif |
| 412 | |
| 413 | #endif |