nixio.html 34 KB

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