stubs.c 11 KB

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