stubs.c 11 KB

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