stubs.c 11 KB

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