stubs.c 8.9 KB

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