libc.pp 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {$mode objfpc}
  2. {$inline on}
  3. {$h+}
  4. unit libc;
  5. Interface
  6. uses unixtype,kerneldefs;
  7. Const
  8. clib = 'c';
  9. dllib = 'dl';
  10. cryptlib = 'crypt';
  11. threadslib = 'pthread';
  12. {$i glue.inc} // C to Pascal type mappings
  13. {$i endianh.inc} // endian.h bits/endian.h
  14. {$i typesh.inc} // types.h sys/types.h
  15. {$i posixopth.inc} // bits/posix_opt.h
  16. {$i stdinth.inc} // stdint.h
  17. {$i wordsizeh.inc} // bits/wordsize.h
  18. {$i limitsh.inc} // limits.h
  19. {$i posix1_limh.inc} // bits/posix1_lim.h
  20. {$i posix2_limh.inc} // bits/posix2_lim.h
  21. {$i xopen_limh.inc} // bits/xopen_lim.h
  22. {$i local_limh.inc} // bits/local_lim.h
  23. {$i inttypesh.inc} // inttypes.h
  24. {$i errnoh.inc} // errno.h asm/errno.h bits/errno.h
  25. {$i pathsh.inc} // paths.h
  26. {$i lib_namesh.inc} // gnu/lib-names.h
  27. {$i xlocaleh.inc} // xlocale.h
  28. {$i sigcontexth.inc} // asm/sigcontext.h (from kernel)
  29. {$i sigseth.inc} // bits/sigset.h
  30. {$i signumh.inc} // bits/signum.h
  31. {$i siginfoh.inc} // bits/siginfo.h
  32. {$i sigstackh.inc} // bits/sigstack.h
  33. {$i sigactionh.inc} // bits/sigaction.h
  34. {$i signalh.inc} // signal.h
  35. {$i btimeh.inc} // bits/time.h
  36. {$i timeh.inc} // time.h
  37. {$i stimeh.inc} // sys/time.h
  38. {$i timexh.inc} // sys/timex.h
  39. {$i timesh.inc} // sys/times.h
  40. {$i bschedh.inc} // bits/sched.h
  41. {$i schedh.inc} // sched.h
  42. {$i pthreadtypesh.inc} // bits/pthreadtypes.h
  43. {$i pthreadh.inc} // pthread.h
  44. {$i sigthreadh.inc} // bits/sigthread.h
  45. {$i semaphoreh.inc} // semaphore.h
  46. {$i spawnh.inc} // spawn.h
  47. {$i bfcntlh.inc} // bits/fcntl.h
  48. {$i fcntlh.inc} // fcntl.h
  49. {$i fileh.inc} // sys/file.h
  50. {$i bdirenth.inc} // bits/dirent.h
  51. {$i direnth.inc} // dirent.h
  52. {$i bstath.inc} // bits/stat.h
  53. {$i sstath.inc} // sys/stat.h
  54. {$i fnmatchh.inc} // fnmatch.h
  55. {$i gconvh.inc} // gconv.h
  56. {$i gconfigh.inc} // _G_config.h
  57. {$i libioh.inc} // libio.h
  58. {$i stdioh.inc} // stdio.h
  59. {$i stdio_limh.inc} // bits/stdio_lim.h
  60. {$i stdio_exth.inc} // stdio_ext.h
  61. {$i bconfnameh.inc} // bits/confname.h
  62. {$i unistdh.inc} // unistd.h
  63. {$i fstabh.inc} // fstab.h
  64. {$i mntenth.inc} // mntent.h
  65. {$i ioctlsh.inc} // bits/ioctls.h
  66. {$i ioctl_typesh.inc} // bits/ioctl-types.h
  67. {$i btermiosh.inc} // bits/termios.h
  68. {$i termiosh.inc} // termios.h
  69. {$i sttydefaultsh.inc} // sys/ttydefaults.h
  70. {$i sioctlh.inc} // sys/ioctl.h
  71. {$i srawh.inc} // sys/raw.h
  72. {$i ptyh.inc} // pty.h
  73. {$i smounth.inc} // sys/mount.h
  74. {$i ssysctlh.inc} // sys/sysctl.h
  75. {$i stringh.inc} // string.h
  76. {$i stdlibh.inc} // stdlib.h
  77. {$i malloch.inc} // malloc.h
  78. {$i ssysinfoh.inc} // sys/sysinfo.h
  79. {$i bdlfcnh.inc} // bits/dlfcn.h
  80. {$i dlfcnh.inc} // dlfcn.h
  81. {$i localeh.inc} // locale.h
  82. {$i nl_typesh.inc} // nl_types.h
  83. {$i langinfoh.inc} // langinfo.h
  84. {$i wordexph.inc} // wordexp.h
  85. {$i iconvh.inc} // iconv.h
  86. {$i bresourceh.inc} // bits/resource.h
  87. {$i sresourceh.inc} // sys/resource.h
  88. {$i argzh.inc} // argz.h
  89. {$i envzh.inc} // envz.h
  90. {$i ctypeh.inc} // sys/ctype.h
  91. {$i wctypeh.inc} // wctype.h
  92. {$i wcharh.inc} // wchar.h
  93. {$i bwaitflagsh.inc} // bits/waitflags.h
  94. {$i bwaitstatush.inc} // bits/waitstatus.h
  95. {$i swaith.inc} // sys/wait.h
  96. {$i butsnameh.inc} // bits/utsname.h
  97. {$i sutsnameh.inc} // sys/utsname.h
  98. {$i bmmanh.inc} // bits/mman.h
  99. {$i smmaph.inc} // sys/mmap.h
  100. {$i ssyslogh.inc} // sys/syslog.h
  101. {$i glibc_versionh.inc} // from gnu/libc-version.h
  102. {$i buioh.inc} // bits/uio.h
  103. {$i suioh.inc} // sys/uio.h
  104. {$i asockiosh.inc} // asm/sockios.h
  105. {$i asocketh.inc} // asm/socket.h
  106. {$i bsockaddrh.inc} // bits/sockaddr.h (inlined in bits/socket.h)
  107. {$i bsocketh.inc} // bits/socket.h
  108. {$i ssocketh.inc} // sys/socket.h
  109. {$i sunh.inc} // sys/un.h
  110. {$i ninh.inc} // netinet/in.h
  111. {$i binh.inc} // bits/in.h, inlined in netinet/in.h
  112. {$i aineth.inc} // arpa/inet.h
  113. {$i bnetdbh.inc} // bits/netdb.h
  114. {$i netdbh.inc} // netdb.h
  115. // empty anyway {$i bselecth.inc} // bits/select.h
  116. {$i sselecth.inc} // sys/select.h
  117. {$i pwdh.inc} // pwd.h
  118. {$i grph.inc} // grp.h
  119. {$i sptraceh.inc} // sys/ptrace.h
  120. {$i ulimith.inc} // ulimit.h
  121. {$i bpollh.inc} // bits/poll.h
  122. {$i spollh.inc} // sys/poll.h
  123. {$i utimeh.inc} // utime.h
  124. {$i sysexitsh.inc} // sysexits.h
  125. {$i bustath.inc} // bits/ustat.h
  126. {$i sustath.inc} // sys/ustat.h
  127. {$i errh.inc} // err.h
  128. {$i errorh.inc} // error.h
  129. {$i bfenvh.inc} // bits/fenv.h
  130. {$i fenvh.inc} // fenv.h
  131. {$i bipch.inc} // bits/ipc.h
  132. {$i sipch.inc} // sys/ipc.h
  133. {$i bshmh.inc} // bits/shm.h
  134. {$i sshmh.inc} // sys/shm.h
  135. {$i bsemh.inc} // bits/sem.h
  136. {$i ssemh.inc} // sys/sem.h
  137. {$i libgenh.inc} // libgen.h
  138. {$i butmph.inc} // bits/utmp.h
  139. {$i utmph.inc} // utmp.h
  140. {$i butmpxh.inc} // bits/utmpx.h
  141. {$i utmpxh.inc} // utmpx.h
  142. {$i svtimesh.inc} // sys/vtimes.h
  143. {$i svlimith.inc} // sys/vlimit.h
  144. {$i sucontexth.inc} // sys/ucontext.h
  145. {$i ucontexth.inc} // ucontext.h
  146. {$i bmsqh.inc} // bits/msq.h
  147. {$i smsgh.inc} // sys/msg.h
  148. {$i bstatfsh.inc} // bits/statfs.h
  149. {$i sstatfsh.inc} // sys/statfs.h
  150. {$i bstatvfsh.inc} // bits/statvfs.h
  151. {$i sstatvfsh.inc} // sys/statvfs.h
  152. {$i monetaryh.inc} // monetary.h
  153. {$i mcheckh.inc} // mcheck.h
  154. {$i printfh.inc} // printf.h
  155. {$i libintlh.inc} // libintl.h
  156. {$i shadowh.inc} // shadow.h
  157. {$i fmtmsgh.inc} // fmtmsg.h
  158. {$i squotah.inc} // sys/quota.h
  159. {$i stimebh.inc} // sys/timeb.h
  160. {$i spermh.inc} // sys/perm.h
  161. { $i suserh.inc} // sys/user.h // You're not supposed to use this...
  162. {$i sswaph.inc} // sys/swap.h
  163. {$i ssendfileh.inc} // sys/sendfile.h
  164. {$i srebooth.inc} // sys/reboot.h
  165. {$i aioh.inc} // aio.h
  166. {$i aliasesh.inc} // aliases.h
  167. {$i globh.inc} // glob.h
  168. {$i crypth.inc} // crypt.h
  169. {$i sfsuidh.inc} // sys/fsuid.h
  170. {$i sklogh.inc} // sys/klog.h
  171. {$i skdaemonh.inc} // sys/kdaemon.h
  172. {$i saccth.inc} // sys/acct.h
  173. {$i bstroptsh.inc} // bits/stropts.h
  174. {$i stroptsh.inc} // stropts.h
  175. {$i allocah.inc} // alloca.h
  176. {$i getopth.inc} // getopt.h
  177. {$i argph.inc} // argp.h
  178. {$i nssh.inc} // nss.h
  179. {$i regexh.inc} // regex.h
  180. { $i regexph.inc} // regexp.h // You're not supposed to use this...
  181. {$i netherneth.inc} // net/ethernet.h
  182. {$i nifh.inc} // net/if.h
  183. {$i nif_arph.inc} // net/if_arp.h
  184. {$i nif_packeth.inc} // net/if_packet.h
  185. { $i nppp_defsh.inc} // net/ppp_defs.h is empty
  186. {$i nif_ppph.inc} // net/if_ppp.h
  187. {$i nif_shaperh.inc} // net/if_shaper.h
  188. { $i nif_slip.h} // net/if_slip.h in kerneldefs
  189. { $i nppp_comp.h} // net/ppp-comp.h in kerneldefs
  190. {$i nrouteh.inc} // net/route.h
  191. {$i nashh.inc} // netash/ash.h
  192. {$i nath.inc} // netatalk/at.h
  193. {$i nax25h.inc} // netax25/ax25.h
  194. {$i nech.inc} // neteconet/ec.h
  195. {$i nipxh.inc} // netipx/ipx.h
  196. {$i npacketh.inc} // netpacket/packet.h
  197. {$i nnetromh.inc} // netrom/netrom.h
  198. {$i nroseh.inc} // netrose/rose.h
  199. {$i nif_etherh.inc} // netinet/if_ether.h
  200. {$i netherh.inc} // netinet/ether.h
  201. {$i nicmp6h.inc} // netinet/icmp6.h
  202. {$i nif_fddih.inc} // netinet/if_fddi.h
  203. {$i nif_trh.inc} // netinet/if_tr.h
  204. {$i nigmph.inc} // netinet/igmp.h
  205. {$i nin_systmh.inc} // netinet/in_systm.h
  206. {$i niph.inc} // netinet/ip.h
  207. {$i nip6h.inc} // netinet/ip6.h
  208. {$i nip_icmph.inc} // netinet/ip_icmp.h
  209. {$i ntcph.inc} // netinet/tcp.h
  210. {$i nudph.inc} // netinet/udp.h
  211. {$i proutedh.inc} // protocols/routed.h
  212. {$i prwhodh.inc} // protocols/rwhod.h
  213. {$i ptalkdh.inc} // protocols/talkd.h
  214. {$i ptimedh.inc} // protocols/timed.h
  215. {$i sscsih.inc} // scsi/scsi.h
  216. {$i sscsi_ioctlh.inc} // scsi/scsi_ioctl.h
  217. {$i ssgh.inc} // scsi/sg.h
  218. {$i ttyenth.inc} // ttyent.h
  219. {$i sgttyh.inc} // sgtty.h
  220. {$i searchh.inc} // search.h
  221. Implementation
  222. uses kernelioctl;
  223. {$i types.inc} // types.h macros.
  224. {$i cerrno.inc} // errno.h asm/errno.h bits/errno.h macros.
  225. {$i time.inc} // bits/time.h macros.
  226. {$i stime.inc} // sys/time.h macros.
  227. {$i dirent.inc} // dirent.h macros.
  228. {$i sstat.inc} // sys/stat.h macros.
  229. {$i libio.inc} // libio.h macros.
  230. {$i termios.inc} // termios.h macros.
  231. {$i sttydefaults.inc} // sys/ttydefaults.h macros.
  232. {$i sraw.inc} // sys/raw.h macros.
  233. {$i bwaitstatus.inc} // bits/waitstatus.h macros.
  234. {$i ssyslog.inc} // sys/syslog.h macros.
  235. {$i bsocket.inc} // bits/socket.h macros.
  236. {$i sun.inc} // sys/un.h macros.
  237. {$i nin.inc} // netinet/in.h macros.
  238. {$i sselect.inc} // sys/select.h macros.
  239. {$i squota.inc} // sys/quota.h macros.
  240. {$i nethernet.inc} // net/ethernet.h macros.
  241. {$i nif_ppp.inc} // net/if_ppp.h macros.
  242. {$i nroute.inc} // net/route.h macros.
  243. {$i nip.inc} // netinet/ip.h macros.
  244. {$i nif_ether.inc} // netinet/if_ether.h macros.
  245. {$i nicmp6.inc} // netinet/icmp6.h macros.
  246. {$i nip_icmp.inc} // netinet/ip_icmp.h macros.
  247. {$i pthread.inc} // pthread.h Kylix compatibility.
  248. end.