stubs.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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. make_stub(epoll_create)
  77. #endif
  78. #if !defined __NR_epoll_ctl && defined __UCLIBC_HAS_EPOLL__
  79. make_stub(epoll_ctl)
  80. #endif
  81. #if !defined __NR_epoll_pwait && defined __UCLIBC_HAS_EPOLL__
  82. make_stub(epoll_pwait)
  83. #endif
  84. #if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__
  85. make_stub(epoll_wait)
  86. #endif
  87. #if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__
  88. make_stub(eventfd)
  89. #endif
  90. #if !defined __NR_fdatasync && !defined __NR_osf_fdatasync
  91. make_stub(fdatasync)
  92. #endif
  93. #ifndef __NR_fgetxattr
  94. make_stub(fgetxattr)
  95. #endif
  96. #ifndef __NR_flistxattr
  97. make_stub(flistxattr)
  98. #endif
  99. #ifndef __NR_fork
  100. make_stub(fork)
  101. #endif
  102. #ifndef __NR_fremovexattr
  103. make_stub(fremovexattr)
  104. #endif
  105. #ifndef __NR_fsetxattr
  106. make_stub(fsetxattr)
  107. #endif
  108. #if !defined __NR_fstatfs && defined __UCLIBC_LINUX_SPECIFIC__
  109. make_stub(fstatfs)
  110. #endif
  111. #ifndef __NR_get_kernel_syms
  112. make_stub(get_kernel_syms)
  113. #endif
  114. #if !defined __NR_getpeername && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  115. make_stub(getpeername)
  116. #endif
  117. #if !defined __NR_getpgrp && !defined __NR_getpgid
  118. make_stub(getpgrp)
  119. #endif
  120. #if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  121. make_stub(getsockname)
  122. #endif
  123. #if !defined __NR_getsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  124. make_stub(getsockopt)
  125. #endif
  126. #ifndef __NR_getxattr
  127. make_stub(getxattr)
  128. #endif
  129. #if !defined __NR_init_module && defined __UCLIBC_LINUX_MODULE_26__
  130. make_stub(init_module)
  131. #endif
  132. #if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__
  133. make_stub(inotify_add_watch)
  134. #endif
  135. #if !defined __NR_inotify_init && defined __UCLIBC_LINUX_SPECIFIC__
  136. make_stub(inotify_init)
  137. #endif
  138. #if !defined __NR_inotify_init1 && defined __UCLIBC_LINUX_SPECIFIC__
  139. make_stub(inotify_init1)
  140. #endif
  141. #if !defined __NR_inotify_rm_watch && defined __UCLIBC_LINUX_SPECIFIC__
  142. make_stub(inotify_rm_watch)
  143. #endif
  144. #if !defined __NR_ioperm && defined __UCLIBC_LINUX_SPECIFIC__
  145. make_stub(ioperm)
  146. #endif
  147. #if !defined __NR_iopl && defined __UCLIBC_LINUX_SPECIFIC__
  148. make_stub(iopl)
  149. #endif
  150. #ifndef __NR_lgetxattr
  151. make_stub(lgetxattr)
  152. #endif
  153. #if !defined __NR_listen && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  154. make_stub(listen)
  155. #endif
  156. #ifndef __NR_listxattr
  157. make_stub(listxattr)
  158. #endif
  159. #ifndef __NR_llistxattr
  160. make_stub(llistxattr)
  161. #endif
  162. #ifndef __NR_lremovexattr
  163. make_stub(lremovexattr)
  164. #endif
  165. #ifndef __NR_lsetxattr
  166. make_stub(lsetxattr)
  167. #endif
  168. #if !defined __NR_madvise && defined __UCLIBC_LINUX_SPECIFIC__
  169. make_stub(madvise)
  170. #endif
  171. #if !defined __NR_modify_ldt && defined __UCLIBC_LINUX_SPECIFIC__
  172. make_stub(modify_ldt)
  173. #endif
  174. #ifndef __NR_openat
  175. make_stub(openat)
  176. # ifdef __UCLIBC_HAS_LFS__
  177. make_stub(openat64)
  178. # endif
  179. #endif
  180. #if !defined __NR_personality && defined __UCLIBC_LINUX_SPECIFIC__
  181. make_stub(personality)
  182. #endif
  183. #if !defined __NR_pipe2 && defined __UCLIBC_LINUX_SPECIFIC__
  184. make_stub(pipe2)
  185. #endif
  186. #if !defined __NR_pivot_root && defined __UCLIBC_LINUX_SPECIFIC__
  187. make_stub(pivot_root)
  188. #endif
  189. #if !defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__
  190. make_ret_stub(posix_fadvise)
  191. #endif
  192. #if !defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
  193. make_ret_stub(posix_fadvise64)
  194. #endif
  195. #ifndef __NR_madvise
  196. make_ret_stub(posix_madvise)
  197. #endif
  198. #if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
  199. make_stub(ppoll)
  200. #endif
  201. #if !defined __NR_prctl && defined __UCLIBC_LINUX_SPECIFIC__
  202. make_stub(prctl)
  203. #endif
  204. #if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__
  205. make_stub(query_module)
  206. #endif
  207. #if !defined __NR_readahead && defined __UCLIBC_LINUX_SPECIFIC__
  208. make_stub(readahead)
  209. #endif
  210. #if !defined __NR_reboot && defined __UCLIBC_LINUX_SPECIFIC__
  211. make_stub(reboot)
  212. #endif
  213. #if !defined __NR_recv && !defined __NR_socketcall && !defined __NR_recvfrom && defined __UCLIBC_HAS_SOCKET__
  214. make_stub(recv)
  215. #endif
  216. #if !defined __NR_recvfrom && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  217. make_stub(recvfrom)
  218. #endif
  219. #if !defined __NR_recvmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  220. make_stub(recvmsg)
  221. #endif
  222. #if !defined __NR_remap_file_pages && defined __UCLIBC_LINUX_SPECIFIC__
  223. make_stub(remap_file_pages)
  224. #endif
  225. #ifndef __NR_removexattr
  226. make_stub(removexattr)
  227. #endif
  228. #ifndef __NR_renameat
  229. make_stub(renameat)
  230. #endif
  231. #if !defined __NR_sched_getaffinity && defined __UCLIBC_LINUX_SPECIFIC__
  232. make_stub(sched_getaffinity)
  233. #endif
  234. #if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__)
  235. make_stub(sched_getcpu)
  236. #endif
  237. #if !defined __NR_sched_setaffinity && defined __UCLIBC_LINUX_SPECIFIC__
  238. make_stub(sched_setaffinity)
  239. #endif
  240. #if !defined __NR_send && !defined __NR_socketcall && !defined __NR_sendto && defined __UCLIBC_HAS_SOCKET__
  241. make_stub(send)
  242. #endif
  243. #if !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__
  244. make_stub(sendfile)
  245. #endif
  246. #if !defined __NR_sendfile64 && !defined __NR_sendfile && defined __UCLIBC_LINUX_SPECIFIC__ && defined __UCLIBC_HAS_LFS__
  247. make_stub(sendfile64)
  248. #endif
  249. #if !defined __NR_sendmsg && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  250. make_stub(sendmsg)
  251. #endif
  252. #if !defined __NR_sendto && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  253. make_stub(sendto)
  254. #endif
  255. #if ((__WORDSIZE == 32 && (!defined __NR_setfsgid32 && !defined __NR_setfsgid)) || (__WORDSIZE == 64 && !defined __NR_setfsgid)) && defined __UCLIBC_LINUX_SPECIFIC__
  256. make_stub(setfsgid)
  257. #endif
  258. #if ((__WORDSIZE == 32 && (!defined __NR_setfsuid32 && !defined __NR_setfsuid)) || (__WORDSIZE == 64 && !defined __NR_setfsuid)) && defined __UCLIBC_LINUX_SPECIFIC__
  259. make_stub(setfsuid)
  260. #endif
  261. #if !defined __NR_setresgid32 && !defined __NR_setresgid && defined __UCLIBC_LINUX_SPECIFIC__
  262. make_stub(setresgid)
  263. #endif
  264. #if !defined __NR_setresuid32 && !defined __NR_setresuid && defined __UCLIBC_LINUX_SPECIFIC__
  265. make_stub(setresuid)
  266. #endif
  267. #if !defined __NR_setsockopt && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  268. make_stub(setsockopt)
  269. #endif
  270. #ifndef __NR_setxattr
  271. make_stub(setxattr)
  272. #endif
  273. #if !defined __NR_shutdown && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  274. make_stub(shutdown)
  275. #endif
  276. #if !defined __NR_signalfd4 && !defined __NR_signalfd && defined __UCLIBC_LINUX_SPECIFIC__
  277. make_stub(signalfd)
  278. #endif
  279. #ifndef __NR_rt_sigtimedwait
  280. make_stub(sigtimedwait)
  281. make_stub(sigwaitinfo)
  282. #endif
  283. #ifndef __NR_rt_sigqueueinfo
  284. make_stub(sigqueue)
  285. #endif
  286. #if !defined __NR_socket && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  287. make_stub(socket)
  288. #endif
  289. #if !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  290. make_stub(socketcall)
  291. #endif
  292. #if !defined __NR_socketpair && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
  293. make_stub(socketpair)
  294. #endif
  295. #if !defined __NR_stime && !defined __NR_settimeofday
  296. make_stub(stime)
  297. make_stub(settimeofday)
  298. #endif
  299. #if !defined __NR_splice && defined __UCLIBC_LINUX_SPECIFIC__
  300. make_stub(splice)
  301. #endif
  302. #if !defined __NR_swapoff && defined __UCLIBC_LINUX_SPECIFIC__
  303. make_stub(swapoff)
  304. #endif
  305. #if !defined __NR_swapon && defined __UCLIBC_LINUX_SPECIFIC__
  306. make_stub(swapon)
  307. #endif
  308. #ifndef __NR_symlink
  309. make_stub(symlink)
  310. #endif
  311. #if !defined __NR_sync_file_range && defined __UCLIBC_LINUX_SPECIFIC__
  312. make_stub(sync_file_range)
  313. #endif
  314. #if !defined __NR__sysctl && defined __UCLIBC_LINUX_SPECIFIC__
  315. make_stub(_sysctl)
  316. #endif
  317. #if !defined __NR_sysinfo && defined __UCLIBC_LINUX_SPECIFIC__
  318. make_stub(sysinfo)
  319. #endif
  320. #if !defined __NR_tee && defined __UCLIBC_LINUX_SPECIFIC__
  321. make_stub(tee)
  322. #endif
  323. #if !defined __NR_timerfd_create && defined __UCLIBC_LINUX_SPECIFIC__
  324. make_stub(timerfd_create)
  325. #endif
  326. #if !defined __NR_timerfd_settime && defined __UCLIBC_LINUX_SPECIFIC__
  327. make_stub(timerfd_settime)
  328. #endif
  329. #if !defined __NR_timerfd_gettime && defined __UCLIBC_LINUX_SPECIFIC__
  330. make_stub(timerfd_gettime)
  331. #endif
  332. #ifndef __NR_utimensat
  333. make_stub(futimens)
  334. make_stub(utimensat)
  335. # ifndef __NR_lutimes
  336. make_stub(lutimes)
  337. # endif
  338. #endif
  339. #if !defined __NR_utime && !defined __NR_utimes
  340. /*make_stub(utime) obsoleted */
  341. make_stub(utimes)
  342. #endif
  343. #if !defined __NR_umount && !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
  344. make_stub(umount)
  345. #endif
  346. #if !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
  347. make_stub(umount2)
  348. #endif
  349. #if !defined __NR_unshare && defined __UCLIBC_LINUX_SPECIFIC__
  350. make_stub(unshare)
  351. #endif
  352. #if !defined __NR_vhangup && defined __UCLIBC_LINUX_SPECIFIC__
  353. make_stub(vhangup)
  354. #endif
  355. #if !defined __NR_vmsplice && defined __UCLIBC_LINUX_SPECIFIC__
  356. make_stub(vmsplice)
  357. #endif
  358. #endif