nixio.html 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <title>Reference</title>
  6. <link rel="stylesheet" href="../luadoc.css" type="text/css" />
  7. <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li>
  26. <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
  27. </li>
  28. <li>
  29. <a href="../modules/luci.http.html">luci.http</a>
  30. </li>
  31. <li>
  32. <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
  33. </li>
  34. <li>
  35. <a href="../modules/luci.http.date.html">luci.http.date</a>
  36. </li>
  37. <li>
  38. <a href="../modules/luci.http.mime.html">luci.http.mime</a>
  39. </li>
  40. <li>
  41. <a href="../modules/luci.i18n.html">luci.i18n</a>
  42. </li>
  43. <li>
  44. <a href="../modules/luci.ip.html">luci.ip</a>
  45. </li>
  46. <li>
  47. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  48. </li>
  49. <li>
  50. <a href="../modules/luci.json.html">luci.json</a>
  51. </li>
  52. <li>
  53. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  54. </li>
  55. <li>
  56. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  57. </li>
  58. <li>
  59. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  60. </li>
  61. <li>
  62. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  63. </li>
  64. <li>
  65. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  66. </li>
  67. <li>
  68. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  69. </li>
  70. <li>
  71. <a href="../modules/luci.sys.html">luci.sys</a>
  72. </li>
  73. <li>
  74. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  75. </li>
  76. <li>
  77. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  78. </li>
  79. <li>
  80. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  81. </li>
  82. <li>
  83. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  84. </li>
  85. <li>
  86. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  87. </li>
  88. <li>
  89. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  90. </li>
  91. <li>
  92. <a href="../modules/luci.util.html">luci.util</a>
  93. </li>
  94. <li><strong>nixio</strong></li>
  95. <li>
  96. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  97. </li>
  98. <li>
  99. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  100. </li>
  101. <li>
  102. <a href="../modules/nixio.File.html">nixio.File</a>
  103. </li>
  104. <li>
  105. <a href="../modules/nixio.README.html">nixio.README</a>
  106. </li>
  107. <li>
  108. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  109. </li>
  110. <li>
  111. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  112. </li>
  113. <li>
  114. <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
  115. </li>
  116. <li>
  117. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  118. </li>
  119. <li>
  120. <a href="../modules/nixio.bin.html">nixio.bin</a>
  121. </li>
  122. <li>
  123. <a href="../modules/nixio.bit.html">nixio.bit</a>
  124. </li>
  125. <li>
  126. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  127. </li>
  128. <li>
  129. <a href="../modules/nixio.fs.html">nixio.fs</a>
  130. </li>
  131. </ul>
  132. <!-- File list -->
  133. </div><!-- id="navigation" -->
  134. <div id="content">
  135. <h1>Class <code>nixio</code></h1>
  136. <p>
  137. General POSIX IO library.</p>
  138. <h2>Functions</h2>
  139. <table class="function_list">
  140. <tr>
  141. <td class="name" nowrap><a href="#nixio.bind">bind</a>&nbsp;(host, port, family, socktype)</td>
  142. <td class="summary">
  143. Create a new socket and bind it to a network address.</td>
  144. </tr>
  145. <tr>
  146. <td class="name" nowrap><a href="#nixio.chdir">chdir</a>&nbsp;(path)</td>
  147. <td class="summary">
  148. Change the working directory.</td>
  149. </tr>
  150. <tr>
  151. <td class="name" nowrap><a href="#nixio.closelog">closelog</a>&nbsp;()</td>
  152. <td class="summary">
  153. (POSIX) Close the connection to the system logger.</td>
  154. </tr>
  155. <tr>
  156. <td class="name" nowrap><a href="#nixio.connect">connect</a>&nbsp;(host, port, family, socktype)</td>
  157. <td class="summary">
  158. Create a new socket and connect to a network address.</td>
  159. </tr>
  160. <tr>
  161. <td class="name" nowrap><a href="#nixio.crypt">crypt</a>&nbsp;(key, salt)</td>
  162. <td class="summary">
  163. (POSIX) Encrypt a user password.</td>
  164. </tr>
  165. <tr>
  166. <td class="name" nowrap><a href="#nixio.dup">dup</a>&nbsp;(oldfd, newfd)</td>
  167. <td class="summary">
  168. Duplicate a file descriptor.</td>
  169. </tr>
  170. <tr>
  171. <td class="name" nowrap><a href="#nixio.errno">errno</a>&nbsp;()</td>
  172. <td class="summary">
  173. Get the last system error code.</td>
  174. </tr>
  175. <tr>
  176. <td class="name" nowrap><a href="#nixio.exec">exec</a>&nbsp;(executable, ...)</td>
  177. <td class="summary">
  178. Execute a file to replace the current process.</td>
  179. </tr>
  180. <tr>
  181. <td class="name" nowrap><a href="#nixio.exece">exece</a>&nbsp;(executable, arguments, environment)</td>
  182. <td class="summary">
  183. Execute a file with a custom environment to replace the current process.</td>
  184. </tr>
  185. <tr>
  186. <td class="name" nowrap><a href="#nixio.execp">execp</a>&nbsp;(executable, ...)</td>
  187. <td class="summary">
  188. Invoke the shell and execute a file to replace the current process.</td>
  189. </tr>
  190. <tr>
  191. <td class="name" nowrap><a href="#nixio.fork">fork</a>&nbsp;()</td>
  192. <td class="summary">
  193. (POSIX) Clone the current process.</td>
  194. </tr>
  195. <tr>
  196. <td class="name" nowrap><a href="#nixio.getaddrinfo">getaddrinfo</a>&nbsp;(host, family, service)</td>
  197. <td class="summary">
  198. Look up a hostname and service via DNS.</td>
  199. </tr>
  200. <tr>
  201. <td class="name" nowrap><a href="#nixio.getcwd">getcwd</a>&nbsp;()</td>
  202. <td class="summary">
  203. Get the current working directory.</td>
  204. </tr>
  205. <tr>
  206. <td class="name" nowrap><a href="#nixio.getenv">getenv</a>&nbsp;(variable)</td>
  207. <td class="summary">
  208. Get the current environment table or a specific environment variable.</td>
  209. </tr>
  210. <tr>
  211. <td class="name" nowrap><a href="#nixio.getgid">getgid</a>&nbsp;()</td>
  212. <td class="summary">
  213. (POSIX) Get the group id of the current process.</td>
  214. </tr>
  215. <tr>
  216. <td class="name" nowrap><a href="#nixio.getgr">getgr</a>&nbsp;(group)</td>
  217. <td class="summary">
  218. (POSIX) Get all or a specific user group.</td>
  219. </tr>
  220. <tr>
  221. <td class="name" nowrap><a href="#nixio.getifaddrs">getifaddrs</a>&nbsp;()</td>
  222. <td class="summary">
  223. (Linux, BSD) Get a list of available network interfaces and their addresses.</td>
  224. </tr>
  225. <tr>
  226. <td class="name" nowrap><a href="#nixio.getnameinfo">getnameinfo</a>&nbsp;(ipaddr)</td>
  227. <td class="summary">
  228. Reverse look up an IP-Address via DNS.</td>
  229. </tr>
  230. <tr>
  231. <td class="name" nowrap><a href="#nixio.getpid">getpid</a>&nbsp;()</td>
  232. <td class="summary">
  233. Get the ID of the current process.</td>
  234. </tr>
  235. <tr>
  236. <td class="name" nowrap><a href="#nixio.getppid">getppid</a>&nbsp;()</td>
  237. <td class="summary">
  238. (POSIX) Get the parent process id of the current process.</td>
  239. </tr>
  240. <tr>
  241. <td class="name" nowrap><a href="#nixio.getproto">getproto</a>&nbsp;(proto)</td>
  242. <td class="summary">
  243. Get all or a specific proto entry.</td>
  244. </tr>
  245. <tr>
  246. <td class="name" nowrap><a href="#nixio.getprotobyname">getprotobyname</a>&nbsp;(name)</td>
  247. <td class="summary">
  248. Get protocol entry by name.</td>
  249. </tr>
  250. <tr>
  251. <td class="name" nowrap><a href="#nixio.getprotobynumber">getprotobynumber</a>&nbsp;(proto)</td>
  252. <td class="summary">
  253. Get protocol entry by number.</td>
  254. </tr>
  255. <tr>
  256. <td class="name" nowrap><a href="#nixio.getpw">getpw</a>&nbsp;(user)</td>
  257. <td class="summary">
  258. (POSIX) Get all or a specific user account.</td>
  259. </tr>
  260. <tr>
  261. <td class="name" nowrap><a href="#nixio.getsp">getsp</a>&nbsp;(user)</td>
  262. <td class="summary">
  263. (Linux, Solaris) Get all or a specific shadow password entry.</td>
  264. </tr>
  265. <tr>
  266. <td class="name" nowrap><a href="#nixio.getuid">getuid</a>&nbsp;()</td>
  267. <td class="summary">
  268. (POSIX) Get the user id of the current process.</td>
  269. </tr>
  270. <tr>
  271. <td class="name" nowrap><a href="#nixio.kill">kill</a>&nbsp;(target, signal)</td>
  272. <td class="summary">
  273. (POSIX) Send a signal to one or more processes.</td>
  274. </tr>
  275. <tr>
  276. <td class="name" nowrap><a href="#nixio.nanosleep">nanosleep</a>&nbsp;(seconds, nanoseconds)</td>
  277. <td class="summary">
  278. Sleep for a specified amount of time.</td>
  279. </tr>
  280. <tr>
  281. <td class="name" nowrap><a href="#nixio.nice">nice</a>&nbsp;(nice)</td>
  282. <td class="summary">
  283. (POSIX) Change priority of current process.</td>
  284. </tr>
  285. <tr>
  286. <td class="name" nowrap><a href="#nixio.open">open</a>&nbsp;(path, flags, mode)</td>
  287. <td class="summary">
  288. Open a file.</td>
  289. </tr>
  290. <tr>
  291. <td class="name" nowrap><a href="#nixio.open_flags">open_flags</a>&nbsp;(flag1, ...)</td>
  292. <td class="summary">
  293. Generate flags for a call to open().</td>
  294. </tr>
  295. <tr>
  296. <td class="name" nowrap><a href="#nixio.openlog">openlog</a>&nbsp;(ident, flag1, ...)</td>
  297. <td class="summary">
  298. (POSIX) Open a connection to the system logger.</td>
  299. </tr>
  300. <tr>
  301. <td class="name" nowrap><a href="#nixio.pipe">pipe</a>&nbsp;()</td>
  302. <td class="summary">
  303. Create a pipe.</td>
  304. </tr>
  305. <tr>
  306. <td class="name" nowrap><a href="#nixio.poll">poll</a>&nbsp;(fds, timeout)</td>
  307. <td class="summary">
  308. Wait for some event on a file descriptor.</td>
  309. </tr>
  310. <tr>
  311. <td class="name" nowrap><a href="#nixio.poll_flags">poll_flags</a>&nbsp;(mode1, ...)</td>
  312. <td class="summary">
  313. Generate events-bitfield or parse revents-bitfield for poll.</td>
  314. </tr>
  315. <tr>
  316. <td class="name" nowrap><a href="#nixio.sendfile">sendfile</a>&nbsp;(socket, file, length)</td>
  317. <td class="summary">
  318. (POSIX) Send data from a file to a socket in kernel-space.</td>
  319. </tr>
  320. <tr>
  321. <td class="name" nowrap><a href="#nixio.setenv">setenv</a>&nbsp;(variable, value)</td>
  322. <td class="summary">
  323. Set or unset a environment variable.</td>
  324. </tr>
  325. <tr>
  326. <td class="name" nowrap><a href="#nixio.setgid">setgid</a>&nbsp;(gid)</td>
  327. <td class="summary">
  328. (POSIX) Set the group id of the current process.</td>
  329. </tr>
  330. <tr>
  331. <td class="name" nowrap><a href="#nixio.setlogmask">setlogmask</a>&nbsp;(priority)</td>
  332. <td class="summary">
  333. (POSIX) Set the logmask of the system logger for current process.</td>
  334. </tr>
  335. <tr>
  336. <td class="name" nowrap><a href="#nixio.setsid">setsid</a>&nbsp;()</td>
  337. <td class="summary">
  338. (POSIX) Create a new session and set the process group ID.</td>
  339. </tr>
  340. <tr>
  341. <td class="name" nowrap><a href="#nixio.setuid">setuid</a>&nbsp;(gid)</td>
  342. <td class="summary">
  343. (POSIX) Set the user id of the current process.</td>
  344. </tr>
  345. <tr>
  346. <td class="name" nowrap><a href="#nixio.signal">signal</a>&nbsp;(signal, handler)</td>
  347. <td class="summary">
  348. Ignore or use set the default handler for a signal.</td>
  349. </tr>
  350. <tr>
  351. <td class="name" nowrap><a href="#nixio.socket">socket</a>&nbsp;(domain, type)</td>
  352. <td class="summary">
  353. Create a new socket.</td>
  354. </tr>
  355. <tr>
  356. <td class="name" nowrap><a href="#nixio.splice">splice</a>&nbsp;(fdin, fdout, length, flags)</td>
  357. <td class="summary">
  358. (Linux) Send data from / to a pipe in kernel-space.</td>
  359. </tr>
  360. <tr>
  361. <td class="name" nowrap><a href="#nixio.splice_flags">splice_flags</a>&nbsp;(flag1, ...)</td>
  362. <td class="summary">
  363. (Linux) Generate a flag bitfield for a call to splice.</td>
  364. </tr>
  365. <tr>
  366. <td class="name" nowrap><a href="#nixio.strerror">strerror</a>&nbsp;(errno)</td>
  367. <td class="summary">
  368. Get the error message for the corresponding error code.</td>
  369. </tr>
  370. <tr>
  371. <td class="name" nowrap><a href="#nixio.sysinfo">sysinfo</a>&nbsp;()</td>
  372. <td class="summary">
  373. (Linux) Get overall system statistics.</td>
  374. </tr>
  375. <tr>
  376. <td class="name" nowrap><a href="#nixio.syslog">syslog</a>&nbsp;(priority)</td>
  377. <td class="summary">
  378. (POSIX) Write a message to the system logger.</td>
  379. </tr>
  380. <tr>
  381. <td class="name" nowrap><a href="#nixio.times">times</a>&nbsp;()</td>
  382. <td class="summary">
  383. (POSIX) Get process times.</td>
  384. </tr>
  385. <tr>
  386. <td class="name" nowrap><a href="#nixio.tls">tls</a>&nbsp;(mode)</td>
  387. <td class="summary">
  388. Create a new TLS context.</td>
  389. </tr>
  390. <tr>
  391. <td class="name" nowrap><a href="#nixio.umask">umask</a>&nbsp;(mask)</td>
  392. <td class="summary">
  393. Sets the file mode creation mask.</td>
  394. </tr>
  395. <tr>
  396. <td class="name" nowrap><a href="#nixio.uname">uname</a>&nbsp;()</td>
  397. <td class="summary">
  398. (POSIX) Get information about current system and kernel.</td>
  399. </tr>
  400. <tr>
  401. <td class="name" nowrap><a href="#nixio.waitpid">waitpid</a>&nbsp;(pid, flag1, ...)</td>
  402. <td class="summary">
  403. (POSIX) Wait for a process to change state.</td>
  404. </tr>
  405. </table>
  406. <br/>
  407. <br/>
  408. <h2><a name="functions"></a>Functions</h2>
  409. <dl class="function">
  410. <dt><a name="nixio.bind"></a><strong>bind</strong>&nbsp;(host, port, family, socktype)</dt>
  411. <dd>
  412. Create a new socket and bind it to a network address.
  413. This function is a shortcut for calling nixio.socket and then bind()
  414. on the socket object.
  415. <h3>Parameters</h3>
  416. <ul>
  417. <li>
  418. host: Hostname or IP-Address (optional, default: all addresses)
  419. </li>
  420. <li>
  421. port: Port or service description
  422. </li>
  423. <li>
  424. family: Address family [<strong>"any"</strong>, "inet", "inet6"]
  425. </li>
  426. <li>
  427. socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
  428. </li>
  429. </ul>
  430. <h3>Usage</h3>
  431. <ul>
  432. <li>This functions calls getaddrinfo(), socket(),
  433. setsockopt() and bind() but NOT listen().
  434. <li>The <em>reuseaddr</em>-option is automatically set before binding.
  435. </ul>
  436. <h3>Return value:</h3>
  437. Socket Object
  438. </dd>
  439. <dt><a name="nixio.chdir"></a><strong>chdir</strong>&nbsp;(path)</dt>
  440. <dd>
  441. Change the working directory.
  442. <h3>Parameters</h3>
  443. <ul>
  444. <li>
  445. path: New working directory
  446. </li>
  447. </ul>
  448. <h3>Return value:</h3>
  449. true
  450. </dd>
  451. <dt><a name="nixio.closelog"></a><strong>closelog</strong>&nbsp;()</dt>
  452. <dd>
  453. (POSIX) Close the connection to the system logger.
  454. </dd>
  455. <dt><a name="nixio.connect"></a><strong>connect</strong>&nbsp;(host, port, family, socktype)</dt>
  456. <dd>
  457. Create a new socket and connect to a network address.
  458. This function is a shortcut for calling nixio.socket and then connect()
  459. on the socket object.
  460. <h3>Parameters</h3>
  461. <ul>
  462. <li>
  463. host: Hostname or IP-Address (optional, default: localhost)
  464. </li>
  465. <li>
  466. port: Port or service description
  467. </li>
  468. <li>
  469. family: Address family [<strong>"any"</strong>, "inet", "inet6"]
  470. </li>
  471. <li>
  472. socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
  473. </li>
  474. </ul>
  475. <h3>Usage:</h3>
  476. This functions calls getaddrinfo(), socket() and connect().
  477. <h3>Return value:</h3>
  478. Socket Object
  479. </dd>
  480. <dt><a name="nixio.crypt"></a><strong>crypt</strong>&nbsp;(key, salt)</dt>
  481. <dd>
  482. (POSIX) Encrypt a user password.
  483. <h3>Parameters</h3>
  484. <ul>
  485. <li>
  486. key: Key
  487. </li>
  488. <li>
  489. salt: Salt
  490. </li>
  491. </ul>
  492. <h3>Return value:</h3>
  493. password hash
  494. </dd>
  495. <dt><a name="nixio.dup"></a><strong>dup</strong>&nbsp;(oldfd, newfd)</dt>
  496. <dd>
  497. Duplicate a file descriptor.
  498. <h3>Parameters</h3>
  499. <ul>
  500. <li>
  501. oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
  502. </li>
  503. <li>
  504. newfd: New descriptor to serve as copy (optional)
  505. </li>
  506. </ul>
  507. <h3>Usage:</h3>
  508. This funcation calls dup2() if <em>newfd</em> is set, otherwise dup().
  509. <h3>Return value:</h3>
  510. File Object of new descriptor
  511. </dd>
  512. <dt><a name="nixio.errno"></a><strong>errno</strong>&nbsp;()</dt>
  513. <dd>
  514. Get the last system error code.
  515. <h3>Return value:</h3>
  516. Error code
  517. </dd>
  518. <dt><a name="nixio.exec"></a><strong>exec</strong>&nbsp;(executable, ...)</dt>
  519. <dd>
  520. Execute a file to replace the current process.
  521. <h3>Parameters</h3>
  522. <ul>
  523. <li>
  524. executable: Executable
  525. </li>
  526. <li>
  527. ...: Parameters
  528. </li>
  529. </ul>
  530. <h3>Usage</h3>
  531. <ul>
  532. <li>The name of the executable is automatically passed as argv[0]
  533. <li>This function does not return on success.
  534. </ul>
  535. </dd>
  536. <dt><a name="nixio.exece"></a><strong>exece</strong>&nbsp;(executable, arguments, environment)</dt>
  537. <dd>
  538. Execute a file with a custom environment to replace the current process.
  539. <h3>Parameters</h3>
  540. <ul>
  541. <li>
  542. executable: Executable
  543. </li>
  544. <li>
  545. arguments: Argument Table
  546. </li>
  547. <li>
  548. environment: Environment Table (optional)
  549. </li>
  550. </ul>
  551. <h3>Usage</h3>
  552. <ul>
  553. <li>The name of the executable is automatically passed as argv[0]
  554. <li>This function does not return on success.
  555. </ul>
  556. </dd>
  557. <dt><a name="nixio.execp"></a><strong>execp</strong>&nbsp;(executable, ...)</dt>
  558. <dd>
  559. Invoke the shell and execute a file to replace the current process.
  560. <h3>Parameters</h3>
  561. <ul>
  562. <li>
  563. executable: Executable
  564. </li>
  565. <li>
  566. ...: Parameters
  567. </li>
  568. </ul>
  569. <h3>Usage</h3>
  570. <ul>
  571. <li>The name of the executable is automatically passed as argv[0]
  572. <li>This function does not return on success.
  573. </ul>
  574. </dd>
  575. <dt><a name="nixio.fork"></a><strong>fork</strong>&nbsp;()</dt>
  576. <dd>
  577. (POSIX) Clone the current process.
  578. <h3>Return value:</h3>
  579. the child process id for the parent process, 0 for the child process
  580. </dd>
  581. <dt><a name="nixio.getaddrinfo"></a><strong>getaddrinfo</strong>&nbsp;(host, family, service)</dt>
  582. <dd>
  583. Look up a hostname and service via DNS.
  584. <h3>Parameters</h3>
  585. <ul>
  586. <li>
  587. host: hostname to lookup (optional)
  588. </li>
  589. <li>
  590. family: address family [<strong>"any"</strong>, "inet", "inet6"]
  591. </li>
  592. <li>
  593. service: service name or port (optional)
  594. </li>
  595. </ul>
  596. <h3>Return value:</h3>
  597. Table containing one or more tables containing: <ul>
  598. <li>family = ["inet", "inet6"]</li>
  599. <li>socktype = ["stream", "dgram", "raw"]</li>
  600. <li>address = Resolved IP-Address</li>
  601. <li>port = Resolved Port (if service was given)</li>
  602. </ul>
  603. </dd>
  604. <dt><a name="nixio.getcwd"></a><strong>getcwd</strong>&nbsp;()</dt>
  605. <dd>
  606. Get the current working directory.
  607. <h3>Return value:</h3>
  608. workign directory
  609. </dd>
  610. <dt><a name="nixio.getenv"></a><strong>getenv</strong>&nbsp;(variable)</dt>
  611. <dd>
  612. Get the current environment table or a specific environment variable.
  613. <h3>Parameters</h3>
  614. <ul>
  615. <li>
  616. variable: Variable (optional)
  617. </li>
  618. </ul>
  619. <h3>Return value:</h3>
  620. environment table or single environment variable
  621. </dd>
  622. <dt><a name="nixio.getgid"></a><strong>getgid</strong>&nbsp;()</dt>
  623. <dd>
  624. (POSIX) Get the group id of the current process.
  625. <h3>Return value:</h3>
  626. process group id
  627. </dd>
  628. <dt><a name="nixio.getgr"></a><strong>getgr</strong>&nbsp;(group)</dt>
  629. <dd>
  630. (POSIX) Get all or a specific user group.
  631. <h3>Parameters</h3>
  632. <ul>
  633. <li>
  634. group: Group ID or groupname (optional)
  635. </li>
  636. </ul>
  637. <h3>Return value:</h3>
  638. Table containing: <ul>
  639. <li>name = Group Name</li>
  640. <li>gid = Group ID</li>
  641. <li>passwd = Password</li>
  642. <li>mem = {Member #1, Member #2, ...}</li>
  643. </ul>
  644. </dd>
  645. <dt><a name="nixio.getifaddrs"></a><strong>getifaddrs</strong>&nbsp;()</dt>
  646. <dd>
  647. (Linux, BSD) Get a list of available network interfaces and their addresses.
  648. <h3>Return value:</h3>
  649. Table containing one or more tables containing: <ul>
  650. <li>name = Interface Name</li>
  651. <li>family = ["inet", "inet6", "packet"]</li>
  652. <li>addr = Interface Address (IPv4, IPv6, MAC, ...)</li>
  653. <li>broadaddr = Broadcast Address</li>
  654. <li>dstaddr = Destination Address (Point-to-Point)</li>
  655. <li>netmask = Netmask (if available)</li>
  656. <li>prefix = Prefix (if available)</li>
  657. <li>flags = Table of interface flags (up, multicast, loopback, ...)</li>
  658. <li>data = Statistics (Linux, "packet"-family)</li>
  659. <li>hatype = Hardware Type Identifier (Linix, "packet"-family)</li>
  660. <li>ifindex = Interface Index (Linux, "packet"-family)</li>
  661. </ul>
  662. </dd>
  663. <dt><a name="nixio.getnameinfo"></a><strong>getnameinfo</strong>&nbsp;(ipaddr)</dt>
  664. <dd>
  665. Reverse look up an IP-Address via DNS.
  666. <h3>Parameters</h3>
  667. <ul>
  668. <li>
  669. ipaddr: IPv4 or IPv6-Address
  670. </li>
  671. </ul>
  672. <h3>Return value:</h3>
  673. FQDN
  674. </dd>
  675. <dt><a name="nixio.getpid"></a><strong>getpid</strong>&nbsp;()</dt>
  676. <dd>
  677. Get the ID of the current process.
  678. <h3>Return value:</h3>
  679. process id
  680. </dd>
  681. <dt><a name="nixio.getppid"></a><strong>getppid</strong>&nbsp;()</dt>
  682. <dd>
  683. (POSIX) Get the parent process id of the current process.
  684. <h3>Return value:</h3>
  685. parent process id
  686. </dd>
  687. <dt><a name="nixio.getproto"></a><strong>getproto</strong>&nbsp;(proto)</dt>
  688. <dd>
  689. Get all or a specific proto entry.
  690. <h3>Parameters</h3>
  691. <ul>
  692. <li>
  693. proto: protocol number or name to lookup (optional)
  694. </li>
  695. </ul>
  696. <h3>Return value:</h3>
  697. Table (or if no parameter is given, a table of tables)
  698. containing the following fields: <ul>
  699. <li>name = Protocol Name</li>
  700. <li>proto = Protocol Number</li>
  701. <li>aliases = Table of alias names</li>
  702. </ul>
  703. </dd>
  704. <dt><a name="nixio.getprotobyname"></a><strong>getprotobyname</strong>&nbsp;(name)</dt>
  705. <dd>
  706. Get protocol entry by name.
  707. <h3>Parameters</h3>
  708. <ul>
  709. <li>
  710. name: protocol name to lookup
  711. </li>
  712. </ul>
  713. <h3>Usage:</h3>
  714. This function returns nil if the given protocol is unknown.
  715. <h3>Return value:</h3>
  716. Table containing the following fields: <ul>
  717. <li>name = Protocol Name</li>
  718. <li>proto = Protocol Number</li>
  719. <li>aliases = Table of alias names</li>
  720. </ul>
  721. </dd>
  722. <dt><a name="nixio.getprotobynumber"></a><strong>getprotobynumber</strong>&nbsp;(proto)</dt>
  723. <dd>
  724. Get protocol entry by number.
  725. <h3>Parameters</h3>
  726. <ul>
  727. <li>
  728. proto: protocol number to lookup
  729. </li>
  730. </ul>
  731. <h3>Usage:</h3>
  732. This function returns nil if the given protocol is unknown.
  733. <h3>Return value:</h3>
  734. Table containing the following fields: <ul>
  735. <li>name = Protocol Name</li>
  736. <li>proto = Protocol Number</li>
  737. <li>aliases = Table of alias names</li>
  738. </ul>
  739. </dd>
  740. <dt><a name="nixio.getpw"></a><strong>getpw</strong>&nbsp;(user)</dt>
  741. <dd>
  742. (POSIX) Get all or a specific user account.
  743. <h3>Parameters</h3>
  744. <ul>
  745. <li>
  746. user: User ID or username (optional)
  747. </li>
  748. </ul>
  749. <h3>Return value:</h3>
  750. Table containing: <ul>
  751. <li>name = Name</li>
  752. <li>uid = ID</li>
  753. <li>gid = Group ID</li>
  754. <li>passwd = Password</li>
  755. <li>dir = Home directory</li>
  756. <li>gecos = Information</li>
  757. <li>shell = Shell</li>
  758. </ul>
  759. </dd>
  760. <dt><a name="nixio.getsp"></a><strong>getsp</strong>&nbsp;(user)</dt>
  761. <dd>
  762. (Linux, Solaris) Get all or a specific shadow password entry.
  763. <h3>Parameters</h3>
  764. <ul>
  765. <li>
  766. user: username (optional)
  767. </li>
  768. </ul>
  769. <h3>Return value:</h3>
  770. Table containing: <ul>
  771. <li>namp = Name</li>
  772. <li>expire = Expiration Date</li>
  773. <li>flag = Flags</li>
  774. <li>inact = Inactivity Date</li>
  775. <li>lstchg = Last change</li>
  776. <li>max = Maximum</li>
  777. <li>min = Minimum</li>
  778. <li>warn = Warning</li>
  779. <li>pwdp = Password Hash</li>
  780. </ul>
  781. </dd>
  782. <dt><a name="nixio.getuid"></a><strong>getuid</strong>&nbsp;()</dt>
  783. <dd>
  784. (POSIX) Get the user id of the current process.
  785. <h3>Return value:</h3>
  786. process user id
  787. </dd>
  788. <dt><a name="nixio.kill"></a><strong>kill</strong>&nbsp;(target, signal)</dt>
  789. <dd>
  790. (POSIX) Send a signal to one or more processes.
  791. <h3>Parameters</h3>
  792. <ul>
  793. <li>
  794. target: Target process of process group.
  795. </li>
  796. <li>
  797. signal: Signal to send
  798. </li>
  799. </ul>
  800. <h3>Return value:</h3>
  801. true
  802. </dd>
  803. <dt><a name="nixio.nanosleep"></a><strong>nanosleep</strong>&nbsp;(seconds, nanoseconds)</dt>
  804. <dd>
  805. Sleep for a specified amount of time.
  806. <h3>Parameters</h3>
  807. <ul>
  808. <li>
  809. seconds: Seconds to wait (optional)
  810. </li>
  811. <li>
  812. nanoseconds: Nanoseconds to wait (optional)
  813. </li>
  814. </ul>
  815. <h3>Usage</h3>
  816. <ul>
  817. <li>Not all systems support nanosecond precision but you can expect
  818. to have at least maillisecond precision.
  819. <li>This function is not signal-protected and may fail with EINTR.
  820. </ul>
  821. <h3>Return value:</h3>
  822. true
  823. </dd>
  824. <dt><a name="nixio.nice"></a><strong>nice</strong>&nbsp;(nice)</dt>
  825. <dd>
  826. (POSIX) Change priority of current process.
  827. <h3>Parameters</h3>
  828. <ul>
  829. <li>
  830. nice: Nice Value
  831. </li>
  832. </ul>
  833. <h3>Return value:</h3>
  834. true
  835. </dd>
  836. <dt><a name="nixio.open"></a><strong>open</strong>&nbsp;(path, flags, mode)</dt>
  837. <dd>
  838. Open a file.
  839. <h3>Parameters</h3>
  840. <ul>
  841. <li>
  842. path: Filesystem path to open
  843. </li>
  844. <li>
  845. flags: Flag string or number (see open_flags).
  846. [<strong>"r"</strong>, "r+", "w", "w+", "a", "a+"]
  847. </li>
  848. <li>
  849. mode: File mode for newly created files (see chmod, umask).
  850. </li>
  851. </ul>
  852. <h3>Usage:</h3>
  853. Although this function also supports the traditional fopen()
  854. file flags it does not create a file stream but uses the open() syscall.
  855. <h3>Return value:</h3>
  856. File Object
  857. <h3>See also:</h3>
  858. <ul>
  859. <li><a href="#nixio.umask">
  860. umask
  861. </a>
  862. <li><a href="#nixio.open_flags">
  863. open_flags
  864. </a>
  865. </ul>
  866. </dd>
  867. <dt><a name="nixio.open_flags"></a><strong>open_flags</strong>&nbsp;(flag1, ...)</dt>
  868. <dd>
  869. Generate flags for a call to open().
  870. <h3>Parameters</h3>
  871. <ul>
  872. <li>
  873. flag1: First Flag ["append", "creat", "excl", "nonblock", "ndelay",
  874. "sync", "trunc", "rdonly", "wronly", "rdwr"]
  875. </li>
  876. <li>
  877. ...: More Flags [-"-]
  878. </li>
  879. </ul>
  880. <h3>Usage</h3>
  881. <ul>
  882. <li>This function cannot fail and will never return nil.
  883. <li>The "nonblock" and "ndelay" flags are aliases.
  884. <li>The "nonblock", "ndelay" and "sync" flags are no-ops on Windows.
  885. </ul>
  886. <h3>Return value:</h3>
  887. flag to be used as second parameter to open
  888. </dd>
  889. <dt><a name="nixio.openlog"></a><strong>openlog</strong>&nbsp;(ident, flag1, ...)</dt>
  890. <dd>
  891. (POSIX) Open a connection to the system logger.
  892. <h3>Parameters</h3>
  893. <ul>
  894. <li>
  895. ident: Identifier
  896. </li>
  897. <li>
  898. flag1: Flag 1 ["cons", "nowait", "pid", "perror", "ndelay", "odelay"]
  899. </li>
  900. <li>
  901. ...: More flags [-"-]
  902. </li>
  903. </ul>
  904. </dd>
  905. <dt><a name="nixio.pipe"></a><strong>pipe</strong>&nbsp;()</dt>
  906. <dd>
  907. Create a pipe.
  908. <h3>Return values:</h3>
  909. <ol>
  910. <li>File Object of the read end
  911. <li>File Object of the write end
  912. </ol>
  913. </dd>
  914. <dt><a name="nixio.poll"></a><strong>poll</strong>&nbsp;(fds, timeout)</dt>
  915. <dd>
  916. Wait for some event on a file descriptor.
  917. poll() sets the revents-field of the tables provided by fds to a bitfield
  918. indicating the events that occurred.
  919. <h3>Parameters</h3>
  920. <ul>
  921. <li>
  922. fds: Table containing one or more tables containing <ul>
  923. <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]</li>
  924. <li> events = events to wait for (bitfield generated with poll_flags)</li>
  925. </ul>
  926. </li>
  927. <li>
  928. timeout: Timeout in milliseconds
  929. </li>
  930. </ul>
  931. <h3>Usage</h3>
  932. <ul>
  933. <li>This function works in-place on the provided table and only
  934. writes the revents field, you can use other fields on your demand.
  935. <li>All metamethods on the tables provided as fds are ignored.
  936. <li>The revents-fields are not reset when the call times out.
  937. You have to check the first return value to be 0 to handle this case.
  938. <li>If you want to wait on a TLS-Socket you have to use the underlying
  939. socket instead.
  940. <li>On Windows poll is emulated through select(), can only be used
  941. on socket descriptors and cannot take more than 64 descriptors per call.
  942. <li>This function is not signal-protected and may fail with EINTR.
  943. </ul>
  944. <h3>Return values:</h3>
  945. <ol>
  946. <li>number of ready IO descriptors
  947. <li>the fds-table with revents-fields set
  948. </ol>
  949. <h3>See also:</h3>
  950. <ul>
  951. <li><a href="#nixio.poll_flags">
  952. poll_flags
  953. </a>
  954. </ul>
  955. </dd>
  956. <dt><a name="nixio.poll_flags"></a><strong>poll_flags</strong>&nbsp;(mode1, ...)</dt>
  957. <dd>
  958. Generate events-bitfield or parse revents-bitfield for poll.
  959. <h3>Parameters</h3>
  960. <ul>
  961. <li>
  962. mode1: revents-Flag bitfield returned from poll to parse OR
  963. ["in", "out", "err", "pri" (POSIX), "hup" (POSIX), "nval" (POSIX)]
  964. </li>
  965. <li>
  966. ...: More mode strings for generating the flag [-"-]
  967. </li>
  968. </ul>
  969. <h3>Return value:</h3>
  970. table with boolean fields reflecting the mode parameter
  971. <strong>OR</strong> bitfield to use for the events-Flag field
  972. <h3>See also:</h3>
  973. <ul>
  974. <li><a href="#nixio.poll">
  975. poll
  976. </a>
  977. </ul>
  978. </dd>
  979. <dt><a name="nixio.sendfile"></a><strong>sendfile</strong>&nbsp;(socket, file, length)</dt>
  980. <dd>
  981. (POSIX) Send data from a file to a socket in kernel-space.
  982. <h3>Parameters</h3>
  983. <ul>
  984. <li>
  985. socket: Socket Object
  986. </li>
  987. <li>
  988. file: File Object
  989. </li>
  990. <li>
  991. length: Amount of data to send (in Bytes).
  992. </li>
  993. </ul>
  994. <h3>Return value:</h3>
  995. bytes sent
  996. </dd>
  997. <dt><a name="nixio.setenv"></a><strong>setenv</strong>&nbsp;(variable, value)</dt>
  998. <dd>
  999. Set or unset a environment variable.
  1000. <h3>Parameters</h3>
  1001. <ul>
  1002. <li>
  1003. variable: Variable
  1004. </li>
  1005. <li>
  1006. value: Value (optional)
  1007. </li>
  1008. </ul>
  1009. <h3>Usage:</h3>
  1010. The environment variable will be unset if value is omitted.
  1011. <h3>Return value:</h3>
  1012. true
  1013. </dd>
  1014. <dt><a name="nixio.setgid"></a><strong>setgid</strong>&nbsp;(gid)</dt>
  1015. <dd>
  1016. (POSIX) Set the group id of the current process.
  1017. <h3>Parameters</h3>
  1018. <ul>
  1019. <li>
  1020. gid: New Group ID
  1021. </li>
  1022. </ul>
  1023. <h3>Return value:</h3>
  1024. true
  1025. </dd>
  1026. <dt><a name="nixio.setlogmask"></a><strong>setlogmask</strong>&nbsp;(priority)</dt>
  1027. <dd>
  1028. (POSIX) Set the logmask of the system logger for current process.
  1029. <h3>Parameters</h3>
  1030. <ul>
  1031. <li>
  1032. priority: Priority ["emerg", "alert", "crit", "err", "warning",
  1033. "notice", "info", "debug"]
  1034. </li>
  1035. </ul>
  1036. </dd>
  1037. <dt><a name="nixio.setsid"></a><strong>setsid</strong>&nbsp;()</dt>
  1038. <dd>
  1039. (POSIX) Create a new session and set the process group ID.
  1040. <h3>Return value:</h3>
  1041. session id
  1042. </dd>
  1043. <dt><a name="nixio.setuid"></a><strong>setuid</strong>&nbsp;(gid)</dt>
  1044. <dd>
  1045. (POSIX) Set the user id of the current process.
  1046. <h3>Parameters</h3>
  1047. <ul>
  1048. <li>
  1049. gid: New User ID
  1050. </li>
  1051. </ul>
  1052. <h3>Return value:</h3>
  1053. true
  1054. </dd>
  1055. <dt><a name="nixio.signal"></a><strong>signal</strong>&nbsp;(signal, handler)</dt>
  1056. <dd>
  1057. Ignore or use set the default handler for a signal.
  1058. <h3>Parameters</h3>
  1059. <ul>
  1060. <li>
  1061. signal: Signal
  1062. </li>
  1063. <li>
  1064. handler: ["ign", "dfl"]
  1065. </li>
  1066. </ul>
  1067. <h3>Return value:</h3>
  1068. true
  1069. </dd>
  1070. <dt><a name="nixio.socket"></a><strong>socket</strong>&nbsp;(domain, type)</dt>
  1071. <dd>
  1072. Create a new socket.
  1073. <h3>Parameters</h3>
  1074. <ul>
  1075. <li>
  1076. domain: Domain ["inet", "inet6", "unix"]
  1077. </li>
  1078. <li>
  1079. type: Type ["stream", "dgram", "raw"]
  1080. </li>
  1081. </ul>
  1082. <h3>Return value:</h3>
  1083. Socket Object
  1084. </dd>
  1085. <dt><a name="nixio.splice"></a><strong>splice</strong>&nbsp;(fdin, fdout, length, flags)</dt>
  1086. <dd>
  1087. (Linux) Send data from / to a pipe in kernel-space.
  1088. <h3>Parameters</h3>
  1089. <ul>
  1090. <li>
  1091. fdin: Input I/O descriptor
  1092. </li>
  1093. <li>
  1094. fdout: Output I/O descriptor
  1095. </li>
  1096. <li>
  1097. length: Amount of data to send (in Bytes).
  1098. </li>
  1099. <li>
  1100. flags: (optional, bitfield generated by splice_flags)
  1101. </li>
  1102. </ul>
  1103. <h3>Return value:</h3>
  1104. bytes sent
  1105. <h3>See also:</h3>
  1106. <ul>
  1107. <li><a href="#nixio.splice_flags">
  1108. splice_flags
  1109. </a>
  1110. </ul>
  1111. </dd>
  1112. <dt><a name="nixio.splice_flags"></a><strong>splice_flags</strong>&nbsp;(flag1, ...)</dt>
  1113. <dd>
  1114. (Linux) Generate a flag bitfield for a call to splice.
  1115. <h3>Parameters</h3>
  1116. <ul>
  1117. <li>
  1118. flag1: First Flag ["move", "nonblock", "more"]
  1119. </li>
  1120. <li>
  1121. ...: More flags [-"-]
  1122. </li>
  1123. </ul>
  1124. <h3>Return value:</h3>
  1125. Flag bitfield
  1126. <h3>See also:</h3>
  1127. <ul>
  1128. <li><a href="#nixio.splice">
  1129. splice
  1130. </a>
  1131. </ul>
  1132. </dd>
  1133. <dt><a name="nixio.strerror"></a><strong>strerror</strong>&nbsp;(errno)</dt>
  1134. <dd>
  1135. Get the error message for the corresponding error code.
  1136. <h3>Parameters</h3>
  1137. <ul>
  1138. <li>
  1139. errno: System error code
  1140. </li>
  1141. </ul>
  1142. <h3>Return value:</h3>
  1143. Error message
  1144. </dd>
  1145. <dt><a name="nixio.sysinfo"></a><strong>sysinfo</strong>&nbsp;()</dt>
  1146. <dd>
  1147. (Linux) Get overall system statistics.
  1148. <h3>Return value:</h3>
  1149. Table containing: <ul>
  1150. <li>uptime = system uptime in seconds</li>
  1151. <li>loads = {loadavg1, loadavg5, loadavg15}</li>
  1152. <li>totalram = total RAM</li>
  1153. <li>freeram = free RAM</li>
  1154. <li>sharedram = shared RAM</li>
  1155. <li>bufferram = buffered RAM</li>
  1156. <li>totalswap = total SWAP</li>
  1157. <li>freeswap = free SWAP</li>
  1158. <li>procs = number of running processes</li>
  1159. </ul>
  1160. </dd>
  1161. <dt><a name="nixio.syslog"></a><strong>syslog</strong>&nbsp;(priority)</dt>
  1162. <dd>
  1163. (POSIX) Write a message to the system logger.
  1164. <h3>Parameters</h3>
  1165. <ul>
  1166. <li>
  1167. priority: Priority ["emerg", "alert", "crit", "err", "warning",
  1168. "notice", "info", "debug"]
  1169. </li>
  1170. </ul>
  1171. </dd>
  1172. <dt><a name="nixio.times"></a><strong>times</strong>&nbsp;()</dt>
  1173. <dd>
  1174. (POSIX) Get process times.
  1175. <h3>Return value:</h3>
  1176. Table containing: <ul>
  1177. <li>utime = user time</li>
  1178. <li>utime = system time</li>
  1179. <li>cutime = children user time</li>
  1180. <li>cstime = children system time</li>
  1181. </ul>
  1182. </dd>
  1183. <dt><a name="nixio.tls"></a><strong>tls</strong>&nbsp;(mode)</dt>
  1184. <dd>
  1185. Create a new TLS context.
  1186. <h3>Parameters</h3>
  1187. <ul>
  1188. <li>
  1189. mode: TLS-Mode ["client", "server"]
  1190. </li>
  1191. </ul>
  1192. <h3>Return value:</h3>
  1193. TLSContext Object
  1194. </dd>
  1195. <dt><a name="nixio.umask"></a><strong>umask</strong>&nbsp;(mask)</dt>
  1196. <dd>
  1197. Sets the file mode creation mask.
  1198. <h3>Parameters</h3>
  1199. <ul>
  1200. <li>
  1201. mask: New creation mask (see chmod for format specifications)
  1202. </li>
  1203. </ul>
  1204. <h3>Return values:</h3>
  1205. <ol>
  1206. <li>the old umask as decimal mode number
  1207. <li>the old umask as mode string
  1208. </ol>
  1209. </dd>
  1210. <dt><a name="nixio.uname"></a><strong>uname</strong>&nbsp;()</dt>
  1211. <dd>
  1212. (POSIX) Get information about current system and kernel.
  1213. <h3>Return value:</h3>
  1214. Table containing: <ul>
  1215. <li>sysname = operating system</li>
  1216. <li>nodename = network name (usually hostname)</li>
  1217. <li>release = OS release</li>
  1218. <li>version = OS version</li>
  1219. <li>machine = hardware identifier</li>
  1220. </ul>
  1221. </dd>
  1222. <dt><a name="nixio.waitpid"></a><strong>waitpid</strong>&nbsp;(pid, flag1, ...)</dt>
  1223. <dd>
  1224. (POSIX) Wait for a process to change state.
  1225. <h3>Parameters</h3>
  1226. <ul>
  1227. <li>
  1228. pid: Process ID (optional, default: any childprocess)
  1229. </li>
  1230. <li>
  1231. flag1: Flag (optional) ["nohang", "untraced", "continued"]
  1232. </li>
  1233. <li>
  1234. ...: More Flags [-"-]
  1235. </li>
  1236. </ul>
  1237. <h3>Usage:</h3>
  1238. If the "nohang" is given this function becomes non-blocking.
  1239. <h3>Return values:</h3>
  1240. <ol>
  1241. <li>process id of child or 0 if no child has changed state
  1242. <li>["exited", "signaled", "stopped"]
  1243. <li>[exit code, terminate signal, stop signal]
  1244. </ol>
  1245. </dd>
  1246. </dl>
  1247. </div> <!-- id="content" -->
  1248. </div> <!-- id="main" -->
  1249. <div id="about">
  1250. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
  1251. </div> <!-- id="about" -->
  1252. </div> <!-- id="container" -->
  1253. </body>
  1254. </html>