12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html>
- <head>
- <title>Reference</title>
- <link rel="stylesheet" href="../luadoc.css" type="text/css" />
- <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
- </head>
- <body>
- <div id="container">
- <div id="product">
- <div id="product_logo"></div>
- <div id="product_name"><big><b></b></big></div>
- <div id="product_description"></div>
- </div> <!-- id="product" -->
- <div id="main">
- <div id="navigation">
- <h1>LuaDoc</h1>
- <ul>
-
- <li><a href="../index.html">Index</a></li>
-
- </ul>
- <!-- Module list -->
- <h1>Modules</h1>
- <ul>
- <li>
- <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
- </li>
- <li>
- <a href="../modules/luci.http.html">luci.http</a>
- </li>
- <li>
- <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
- </li>
- <li>
- <a href="../modules/luci.http.date.html">luci.http.date</a>
- </li>
- <li>
- <a href="../modules/luci.http.mime.html">luci.http.mime</a>
- </li>
- <li>
- <a href="../modules/luci.i18n.html">luci.i18n</a>
- </li>
- <li>
- <a href="../modules/luci.ip.html">luci.ip</a>
- </li>
- <li>
- <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
- </li>
- <li>
- <a href="../modules/luci.json.html">luci.json</a>
- </li>
- <li>
- <a href="../modules/luci.jsonc.html">luci.jsonc</a>
- </li>
- <li>
- <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
- </li>
- <li>
- <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
- </li>
- <li>
- <a href="../modules/luci.model.uci.html">luci.model.uci</a>
- </li>
- <li>
- <a href="../modules/luci.rpcc.html">luci.rpcc</a>
- </li>
- <li>
- <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
- </li>
- <li>
- <a href="../modules/luci.sys.html">luci.sys</a>
- </li>
- <li>
- <a href="../modules/luci.sys.init.html">luci.sys.init</a>
- </li>
- <li>
- <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
- </li>
- <li>
- <a href="../modules/luci.sys.net.html">luci.sys.net</a>
- </li>
- <li>
- <a href="../modules/luci.sys.process.html">luci.sys.process</a>
- </li>
- <li>
- <a href="../modules/luci.sys.user.html">luci.sys.user</a>
- </li>
- <li>
- <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
- </li>
- <li>
- <a href="../modules/luci.util.html">luci.util</a>
- </li>
- <li>
- <a href="../modules/luci.xml.html">luci.xml</a>
- </li>
- <li><strong>nixio</strong></li>
-
- <li>
- <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
- </li>
- <li>
- <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
- </li>
- <li>
- <a href="../modules/nixio.File.html">nixio.File</a>
- </li>
- <li>
- <a href="../modules/nixio.README.html">nixio.README</a>
- </li>
- <li>
- <a href="../modules/nixio.Socket.html">nixio.Socket</a>
- </li>
- <li>
- <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
- </li>
- <li>
- <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
- </li>
- <li>
- <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
- </li>
- <li>
- <a href="../modules/nixio.bin.html">nixio.bin</a>
- </li>
- <li>
- <a href="../modules/nixio.bit.html">nixio.bit</a>
- </li>
- <li>
- <a href="../modules/nixio.crypto.html">nixio.crypto</a>
- </li>
- <li>
- <a href="../modules/nixio.fs.html">nixio.fs</a>
- </li>
- </ul>
- <!-- File list -->
- </div><!-- id="navigation" -->
- <div id="content">
- <h1>Class <code>nixio</code></h1>
- <p>
- General POSIX IO library.</p>
- <h2>Functions</h2>
- <table class="function_list">
- <tr>
- <td class="name" nowrap><a href="#nixio.bind">bind</a> (host, port, family, socktype)</td>
- <td class="summary">
- Create a new socket and bind it to a network address.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.chdir">chdir</a> (path)</td>
- <td class="summary">
- Change the working directory.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.closelog">closelog</a> ()</td>
- <td class="summary">
- (POSIX) Close the connection to the system logger.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.connect">connect</a> (host, port, family, socktype)</td>
- <td class="summary">
- Create a new socket and connect to a network address.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.crypt">crypt</a> (key, salt)</td>
- <td class="summary">
- (POSIX) Encrypt a user password.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.dup">dup</a> (oldfd, newfd)</td>
- <td class="summary">
- Duplicate a file descriptor.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.errno">errno</a> ()</td>
- <td class="summary">
- Get the last system error code.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.exec">exec</a> (executable, ...)</td>
- <td class="summary">
- Execute a file to replace the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.exece">exece</a> (executable, arguments, environment)</td>
- <td class="summary">
- Execute a file with a custom environment to replace the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.execp">execp</a> (executable, ...)</td>
- <td class="summary">
- Invoke the shell and execute a file to replace the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.fork">fork</a> ()</td>
- <td class="summary">
- (POSIX) Clone the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getaddrinfo">getaddrinfo</a> (host, family, service)</td>
- <td class="summary">
- Look up a hostname and service via DNS.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getcwd">getcwd</a> ()</td>
- <td class="summary">
- Get the current working directory.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getenv">getenv</a> (variable)</td>
- <td class="summary">
- Get the current environment table or a specific environment variable.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getgid">getgid</a> ()</td>
- <td class="summary">
- (POSIX) Get the group id of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getgr">getgr</a> (group)</td>
- <td class="summary">
- (POSIX) Get all or a specific user group.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getifaddrs">getifaddrs</a> ()</td>
- <td class="summary">
- (Linux, BSD) Get a list of available network interfaces and their addresses.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getnameinfo">getnameinfo</a> (ipaddr)</td>
- <td class="summary">
- Reverse look up an IP-Address via DNS.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getpid">getpid</a> ()</td>
- <td class="summary">
- Get the ID of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getppid">getppid</a> ()</td>
- <td class="summary">
- (POSIX) Get the parent process id of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getproto">getproto</a> (proto)</td>
- <td class="summary">
- Get all or a specific proto entry.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getprotobyname">getprotobyname</a> (name)</td>
- <td class="summary">
- Get protocol entry by name.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getprotobynumber">getprotobynumber</a> (proto)</td>
- <td class="summary">
- Get protocol entry by number.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getpw">getpw</a> (user)</td>
- <td class="summary">
- (POSIX) Get all or a specific user account.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getsp">getsp</a> (user)</td>
- <td class="summary">
- (Linux, Solaris) Get all or a specific shadow password entry.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.getuid">getuid</a> ()</td>
- <td class="summary">
- (POSIX) Get the user id of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.kill">kill</a> (target, signal)</td>
- <td class="summary">
- (POSIX) Send a signal to one or more processes.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.nanosleep">nanosleep</a> (seconds, nanoseconds)</td>
- <td class="summary">
- Sleep for a specified amount of time.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.nice">nice</a> (nice)</td>
- <td class="summary">
- (POSIX) Change priority of current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.open">open</a> (path, flags, mode)</td>
- <td class="summary">
- Open a file.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.open_flags">open_flags</a> (flag1, ...)</td>
- <td class="summary">
- Generate flags for a call to open().</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.openlog">openlog</a> (ident, flag1, ...)</td>
- <td class="summary">
- (POSIX) Open a connection to the system logger.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.pipe">pipe</a> ()</td>
- <td class="summary">
- Create a pipe.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.poll">poll</a> (fds, timeout)</td>
- <td class="summary">
- Wait for some event on a file descriptor.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.poll_flags">poll_flags</a> (mode1, ...)</td>
- <td class="summary">
- Generate events-bitfield or parse revents-bitfield for poll.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.sendfile">sendfile</a> (socket, file, length)</td>
- <td class="summary">
- (POSIX) Send data from a file to a socket in kernel-space.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.setenv">setenv</a> (variable, value)</td>
- <td class="summary">
- Set or unset a environment variable.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.setgid">setgid</a> (gid)</td>
- <td class="summary">
- (POSIX) Set the group id of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.setlogmask">setlogmask</a> (priority)</td>
- <td class="summary">
- (POSIX) Set the logmask of the system logger for current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.setsid">setsid</a> ()</td>
- <td class="summary">
- (POSIX) Create a new session and set the process group ID.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.setuid">setuid</a> (gid)</td>
- <td class="summary">
- (POSIX) Set the user id of the current process.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.signal">signal</a> (signal, handler)</td>
- <td class="summary">
- Ignore or use set the default handler for a signal.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.socket">socket</a> (domain, type)</td>
- <td class="summary">
- Create a new socket.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.splice">splice</a> (fdin, fdout, length, flags)</td>
- <td class="summary">
- (Linux) Send data from / to a pipe in kernel-space.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.splice_flags">splice_flags</a> (flag1, ...)</td>
- <td class="summary">
- (Linux) Generate a flag bitfield for a call to splice.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.strerror">strerror</a> (errno)</td>
- <td class="summary">
- Get the error message for the corresponding error code.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.sysinfo">sysinfo</a> ()</td>
- <td class="summary">
- (Linux) Get overall system statistics.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.syslog">syslog</a> (priority)</td>
- <td class="summary">
- (POSIX) Write a message to the system logger.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.times">times</a> ()</td>
- <td class="summary">
- (POSIX) Get process times.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.tls">tls</a> (mode)</td>
- <td class="summary">
- Create a new TLS context.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.umask">umask</a> (mask)</td>
- <td class="summary">
- Sets the file mode creation mask.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.uname">uname</a> ()</td>
- <td class="summary">
- (POSIX) Get information about current system and kernel.</td>
- </tr>
- <tr>
- <td class="name" nowrap><a href="#nixio.waitpid">waitpid</a> (pid, flag1, ...)</td>
- <td class="summary">
- (POSIX) Wait for a process to change state.</td>
- </tr>
- </table>
- <br/>
- <br/>
- <h2><a name="functions"></a>Functions</h2>
- <dl class="function">
- <dt><a name="nixio.bind"></a><strong>bind</strong> (host, port, family, socktype)</dt>
- <dd>
- Create a new socket and bind it to a network address.
- This function is a shortcut for calling nixio.socket and then bind()
- on the socket object.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- host: Hostname or IP-Address (optional, default: all addresses)
- </li>
-
- <li>
- port: Port or service description
- </li>
-
- <li>
- family: Address family [<strong>"any"</strong>, "inet", "inet6"]
- </li>
-
- <li>
- socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>This functions calls getaddrinfo(), socket(),
- setsockopt() and bind() but NOT listen().
-
- <li>The <em>reuseaddr</em>-option is automatically set before binding.
-
- </ul>
- <h3>Return value:</h3>
- Socket Object
- </dd>
- <dt><a name="nixio.chdir"></a><strong>chdir</strong> (path)</dt>
- <dd>
- Change the working directory.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- path: New working directory
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.closelog"></a><strong>closelog</strong> ()</dt>
- <dd>
- (POSIX) Close the connection to the system logger.
- </dd>
- <dt><a name="nixio.connect"></a><strong>connect</strong> (host, port, family, socktype)</dt>
- <dd>
- Create a new socket and connect to a network address.
- This function is a shortcut for calling nixio.socket and then connect()
- on the socket object.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- host: Hostname or IP-Address (optional, default: localhost)
- </li>
-
- <li>
- port: Port or service description
- </li>
-
- <li>
- family: Address family [<strong>"any"</strong>, "inet", "inet6"]
- </li>
-
- <li>
- socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
- </li>
-
- </ul>
- <h3>Usage:</h3>
- This functions calls getaddrinfo(), socket() and connect().
- <h3>Return value:</h3>
- Socket Object
- </dd>
- <dt><a name="nixio.crypt"></a><strong>crypt</strong> (key, salt)</dt>
- <dd>
- (POSIX) Encrypt a user password.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- key: Key
- </li>
-
- <li>
- salt: Salt
- </li>
-
- </ul>
- <h3>Return value:</h3>
- password hash
- </dd>
- <dt><a name="nixio.dup"></a><strong>dup</strong> (oldfd, newfd)</dt>
- <dd>
- Duplicate a file descriptor.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
- </li>
-
- <li>
- newfd: New descriptor to serve as copy (optional)
- </li>
-
- </ul>
- <h3>Usage:</h3>
- This funcation calls dup2() if <em>newfd</em> is set, otherwise dup().
- <h3>Return value:</h3>
- File Object of new descriptor
- </dd>
- <dt><a name="nixio.errno"></a><strong>errno</strong> ()</dt>
- <dd>
- Get the last system error code.
- <h3>Return value:</h3>
- Error code
- </dd>
- <dt><a name="nixio.exec"></a><strong>exec</strong> (executable, ...)</dt>
- <dd>
- Execute a file to replace the current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- executable: Executable
- </li>
-
- <li>
- ...: Parameters
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>The name of the executable is automatically passed as argv[0]
-
- <li>This function does not return on success.
-
- </ul>
- </dd>
- <dt><a name="nixio.exece"></a><strong>exece</strong> (executable, arguments, environment)</dt>
- <dd>
- Execute a file with a custom environment to replace the current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- executable: Executable
- </li>
-
- <li>
- arguments: Argument Table
- </li>
-
- <li>
- environment: Environment Table (optional)
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>The name of the executable is automatically passed as argv[0]
-
- <li>This function does not return on success.
-
- </ul>
- </dd>
- <dt><a name="nixio.execp"></a><strong>execp</strong> (executable, ...)</dt>
- <dd>
- Invoke the shell and execute a file to replace the current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- executable: Executable
- </li>
-
- <li>
- ...: Parameters
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>The name of the executable is automatically passed as argv[0]
-
- <li>This function does not return on success.
-
- </ul>
- </dd>
- <dt><a name="nixio.fork"></a><strong>fork</strong> ()</dt>
- <dd>
- (POSIX) Clone the current process.
- <h3>Return value:</h3>
- the child process id for the parent process, 0 for the child process
- </dd>
- <dt><a name="nixio.getaddrinfo"></a><strong>getaddrinfo</strong> (host, family, service)</dt>
- <dd>
- Look up a hostname and service via DNS.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- host: hostname to lookup (optional)
- </li>
-
- <li>
- family: address family [<strong>"any"</strong>, "inet", "inet6"]
- </li>
-
- <li>
- service: service name or port (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Table containing one or more tables containing: <ul>
- <li>family = ["inet", "inet6"]</li>
- <li>socktype = ["stream", "dgram", "raw"]</li>
- <li>address = Resolved IP-Address</li>
- <li>port = Resolved Port (if service was given)</li>
- </ul>
- </dd>
- <dt><a name="nixio.getcwd"></a><strong>getcwd</strong> ()</dt>
- <dd>
- Get the current working directory.
- <h3>Return value:</h3>
- workign directory
- </dd>
- <dt><a name="nixio.getenv"></a><strong>getenv</strong> (variable)</dt>
- <dd>
- Get the current environment table or a specific environment variable.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- variable: Variable (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- environment table or single environment variable
- </dd>
- <dt><a name="nixio.getgid"></a><strong>getgid</strong> ()</dt>
- <dd>
- (POSIX) Get the group id of the current process.
- <h3>Return value:</h3>
- process group id
- </dd>
- <dt><a name="nixio.getgr"></a><strong>getgr</strong> (group)</dt>
- <dd>
- (POSIX) Get all or a specific user group.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- group: Group ID or groupname (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>name = Group Name</li>
- <li>gid = Group ID</li>
- <li>passwd = Password</li>
- <li>mem = {Member #1, Member #2, ...}</li>
- </ul>
- </dd>
- <dt><a name="nixio.getifaddrs"></a><strong>getifaddrs</strong> ()</dt>
- <dd>
- (Linux, BSD) Get a list of available network interfaces and their addresses.
- <h3>Return value:</h3>
- Table containing one or more tables containing: <ul>
- <li>name = Interface Name</li>
- <li>family = ["inet", "inet6", "packet"]</li>
- <li>addr = Interface Address (IPv4, IPv6, MAC, ...)</li>
- <li>broadaddr = Broadcast Address</li>
- <li>dstaddr = Destination Address (Point-to-Point)</li>
- <li>netmask = Netmask (if available)</li>
- <li>prefix = Prefix (if available)</li>
- <li>flags = Table of interface flags (up, multicast, loopback, ...)</li>
- <li>data = Statistics (Linux, "packet"-family)</li>
- <li>hatype = Hardware Type Identifier (Linix, "packet"-family)</li>
- <li>ifindex = Interface Index (Linux, "packet"-family)</li>
- </ul>
- </dd>
- <dt><a name="nixio.getnameinfo"></a><strong>getnameinfo</strong> (ipaddr)</dt>
- <dd>
- Reverse look up an IP-Address via DNS.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- ipaddr: IPv4 or IPv6-Address
- </li>
-
- </ul>
- <h3>Return value:</h3>
- FQDN
- </dd>
- <dt><a name="nixio.getpid"></a><strong>getpid</strong> ()</dt>
- <dd>
- Get the ID of the current process.
- <h3>Return value:</h3>
- process id
- </dd>
- <dt><a name="nixio.getppid"></a><strong>getppid</strong> ()</dt>
- <dd>
- (POSIX) Get the parent process id of the current process.
- <h3>Return value:</h3>
- parent process id
- </dd>
- <dt><a name="nixio.getproto"></a><strong>getproto</strong> (proto)</dt>
- <dd>
- Get all or a specific proto entry.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- proto: protocol number or name to lookup (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Table (or if no parameter is given, a table of tables)
- containing the following fields: <ul>
- <li>name = Protocol Name</li>
- <li>proto = Protocol Number</li>
- <li>aliases = Table of alias names</li>
- </ul>
- </dd>
- <dt><a name="nixio.getprotobyname"></a><strong>getprotobyname</strong> (name)</dt>
- <dd>
- Get protocol entry by name.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- name: protocol name to lookup
- </li>
-
- </ul>
- <h3>Usage:</h3>
- This function returns nil if the given protocol is unknown.
- <h3>Return value:</h3>
- Table containing the following fields: <ul>
- <li>name = Protocol Name</li>
- <li>proto = Protocol Number</li>
- <li>aliases = Table of alias names</li>
- </ul>
- </dd>
- <dt><a name="nixio.getprotobynumber"></a><strong>getprotobynumber</strong> (proto)</dt>
- <dd>
- Get protocol entry by number.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- proto: protocol number to lookup
- </li>
-
- </ul>
- <h3>Usage:</h3>
- This function returns nil if the given protocol is unknown.
- <h3>Return value:</h3>
- Table containing the following fields: <ul>
- <li>name = Protocol Name</li>
- <li>proto = Protocol Number</li>
- <li>aliases = Table of alias names</li>
- </ul>
- </dd>
- <dt><a name="nixio.getpw"></a><strong>getpw</strong> (user)</dt>
- <dd>
- (POSIX) Get all or a specific user account.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- user: User ID or username (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>name = Name</li>
- <li>uid = ID</li>
- <li>gid = Group ID</li>
- <li>passwd = Password</li>
- <li>dir = Home directory</li>
- <li>gecos = Information</li>
- <li>shell = Shell</li>
- </ul>
- </dd>
- <dt><a name="nixio.getsp"></a><strong>getsp</strong> (user)</dt>
- <dd>
- (Linux, Solaris) Get all or a specific shadow password entry.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- user: username (optional)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>namp = Name</li>
- <li>expire = Expiration Date</li>
- <li>flag = Flags</li>
- <li>inact = Inactivity Date</li>
- <li>lstchg = Last change</li>
- <li>max = Maximum</li>
- <li>min = Minimum</li>
- <li>warn = Warning</li>
- <li>pwdp = Password Hash</li>
- </ul>
- </dd>
- <dt><a name="nixio.getuid"></a><strong>getuid</strong> ()</dt>
- <dd>
- (POSIX) Get the user id of the current process.
- <h3>Return value:</h3>
- process user id
- </dd>
- <dt><a name="nixio.kill"></a><strong>kill</strong> (target, signal)</dt>
- <dd>
- (POSIX) Send a signal to one or more processes.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- target: Target process of process group.
- </li>
-
- <li>
- signal: Signal to send
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.nanosleep"></a><strong>nanosleep</strong> (seconds, nanoseconds)</dt>
- <dd>
- Sleep for a specified amount of time.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- seconds: Seconds to wait (optional)
- </li>
-
- <li>
- nanoseconds: Nanoseconds to wait (optional)
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>Not all systems support nanosecond precision but you can expect
- to have at least maillisecond precision.
-
- <li>This function is not signal-protected and may fail with EINTR.
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.nice"></a><strong>nice</strong> (nice)</dt>
- <dd>
- (POSIX) Change priority of current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- nice: Nice Value
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.open"></a><strong>open</strong> (path, flags, mode)</dt>
- <dd>
- Open a file.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- path: Filesystem path to open
- </li>
-
- <li>
- flags: Flag string or number (see open_flags).
- [<strong>"r"</strong>, "r+", "w", "w+", "a", "a+"]
- </li>
-
- <li>
- mode: File mode for newly created files (see chmod, umask).
- </li>
-
- </ul>
- <h3>Usage:</h3>
- Although this function also supports the traditional fopen()
- file flags it does not create a file stream but uses the open() syscall.
- <h3>Return value:</h3>
- File Object
- <h3>See also:</h3>
- <ul>
-
- <li><a href="#nixio.umask">
- umask
- </a>
-
- <li><a href="#nixio.open_flags">
- open_flags
- </a>
-
- </ul>
- </dd>
- <dt><a name="nixio.open_flags"></a><strong>open_flags</strong> (flag1, ...)</dt>
- <dd>
- Generate flags for a call to open().
- <h3>Parameters</h3>
- <ul>
-
- <li>
- flag1: First Flag ["append", "creat", "excl", "nonblock", "ndelay",
- "sync", "trunc", "rdonly", "wronly", "rdwr"]
- </li>
-
- <li>
- ...: More Flags [-"-]
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>This function cannot fail and will never return nil.
-
- <li>The "nonblock" and "ndelay" flags are aliases.
-
- <li>The "nonblock", "ndelay" and "sync" flags are no-ops on Windows.
-
- </ul>
- <h3>Return value:</h3>
- flag to be used as second parameter to open
- </dd>
- <dt><a name="nixio.openlog"></a><strong>openlog</strong> (ident, flag1, ...)</dt>
- <dd>
- (POSIX) Open a connection to the system logger.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- ident: Identifier
- </li>
-
- <li>
- flag1: Flag 1 ["cons", "nowait", "pid", "perror", "ndelay", "odelay"]
- </li>
-
- <li>
- ...: More flags [-"-]
- </li>
-
- </ul>
- </dd>
- <dt><a name="nixio.pipe"></a><strong>pipe</strong> ()</dt>
- <dd>
- Create a pipe.
- <h3>Return values:</h3>
- <ol>
-
- <li>File Object of the read end
-
- <li>File Object of the write end
-
- </ol>
- </dd>
- <dt><a name="nixio.poll"></a><strong>poll</strong> (fds, timeout)</dt>
- <dd>
- Wait for some event on a file descriptor.
- poll() sets the revents-field of the tables provided by fds to a bitfield
- indicating the events that occurred.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- fds: Table containing one or more tables containing <ul>
- <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]</li>
- <li> events = events to wait for (bitfield generated with poll_flags)</li>
- </ul>
- </li>
-
- <li>
- timeout: Timeout in milliseconds
- </li>
-
- </ul>
- <h3>Usage</h3>
- <ul>
-
- <li>This function works in-place on the provided table and only
- writes the revents field, you can use other fields on your demand.
-
- <li>All metamethods on the tables provided as fds are ignored.
-
- <li>The revents-fields are not reset when the call times out.
- You have to check the first return value to be 0 to handle this case.
-
- <li>If you want to wait on a TLS-Socket you have to use the underlying
- socket instead.
-
- <li>On Windows poll is emulated through select(), can only be used
- on socket descriptors and cannot take more than 64 descriptors per call.
-
- <li>This function is not signal-protected and may fail with EINTR.
-
- </ul>
- <h3>Return values:</h3>
- <ol>
-
- <li>number of ready IO descriptors
-
- <li>the fds-table with revents-fields set
-
- </ol>
- <h3>See also:</h3>
- <ul>
-
- <li><a href="#nixio.poll_flags">
- poll_flags
- </a>
-
- </ul>
- </dd>
- <dt><a name="nixio.poll_flags"></a><strong>poll_flags</strong> (mode1, ...)</dt>
- <dd>
- Generate events-bitfield or parse revents-bitfield for poll.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- mode1: revents-Flag bitfield returned from poll to parse OR
- ["in", "out", "err", "pri" (POSIX), "hup" (POSIX), "nval" (POSIX)]
- </li>
-
- <li>
- ...: More mode strings for generating the flag [-"-]
- </li>
-
- </ul>
- <h3>Return value:</h3>
- table with boolean fields reflecting the mode parameter
- <strong>OR</strong> bitfield to use for the events-Flag field
- <h3>See also:</h3>
- <ul>
-
- <li><a href="#nixio.poll">
- poll
- </a>
-
- </ul>
- </dd>
- <dt><a name="nixio.sendfile"></a><strong>sendfile</strong> (socket, file, length)</dt>
- <dd>
- (POSIX) Send data from a file to a socket in kernel-space.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- socket: Socket Object
- </li>
-
- <li>
- file: File Object
- </li>
-
- <li>
- length: Amount of data to send (in Bytes).
- </li>
-
- </ul>
- <h3>Return value:</h3>
- bytes sent
- </dd>
- <dt><a name="nixio.setenv"></a><strong>setenv</strong> (variable, value)</dt>
- <dd>
- Set or unset a environment variable.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- variable: Variable
- </li>
-
- <li>
- value: Value (optional)
- </li>
-
- </ul>
- <h3>Usage:</h3>
- The environment variable will be unset if value is omitted.
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.setgid"></a><strong>setgid</strong> (gid)</dt>
- <dd>
- (POSIX) Set the group id of the current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- gid: New Group ID
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.setlogmask"></a><strong>setlogmask</strong> (priority)</dt>
- <dd>
- (POSIX) Set the logmask of the system logger for current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- priority: Priority ["emerg", "alert", "crit", "err", "warning",
- "notice", "info", "debug"]
- </li>
-
- </ul>
- </dd>
- <dt><a name="nixio.setsid"></a><strong>setsid</strong> ()</dt>
- <dd>
- (POSIX) Create a new session and set the process group ID.
- <h3>Return value:</h3>
- session id
- </dd>
- <dt><a name="nixio.setuid"></a><strong>setuid</strong> (gid)</dt>
- <dd>
- (POSIX) Set the user id of the current process.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- gid: New User ID
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.signal"></a><strong>signal</strong> (signal, handler)</dt>
- <dd>
- Ignore or use set the default handler for a signal.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- signal: Signal
- </li>
-
- <li>
- handler: ["ign", "dfl"]
- </li>
-
- </ul>
- <h3>Return value:</h3>
- true
- </dd>
- <dt><a name="nixio.socket"></a><strong>socket</strong> (domain, type)</dt>
- <dd>
- Create a new socket.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- domain: Domain ["inet", "inet6", "unix"]
- </li>
-
- <li>
- type: Type ["stream", "dgram", "raw"]
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Socket Object
- </dd>
- <dt><a name="nixio.splice"></a><strong>splice</strong> (fdin, fdout, length, flags)</dt>
- <dd>
- (Linux) Send data from / to a pipe in kernel-space.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- fdin: Input I/O descriptor
- </li>
-
- <li>
- fdout: Output I/O descriptor
- </li>
-
- <li>
- length: Amount of data to send (in Bytes).
- </li>
-
- <li>
- flags: (optional, bitfield generated by splice_flags)
- </li>
-
- </ul>
- <h3>Return value:</h3>
- bytes sent
- <h3>See also:</h3>
- <ul>
-
- <li><a href="#nixio.splice_flags">
- splice_flags
- </a>
-
- </ul>
- </dd>
- <dt><a name="nixio.splice_flags"></a><strong>splice_flags</strong> (flag1, ...)</dt>
- <dd>
- (Linux) Generate a flag bitfield for a call to splice.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- flag1: First Flag ["move", "nonblock", "more"]
- </li>
-
- <li>
- ...: More flags [-"-]
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Flag bitfield
- <h3>See also:</h3>
- <ul>
-
- <li><a href="#nixio.splice">
- splice
- </a>
-
- </ul>
- </dd>
- <dt><a name="nixio.strerror"></a><strong>strerror</strong> (errno)</dt>
- <dd>
- Get the error message for the corresponding error code.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- errno: System error code
- </li>
-
- </ul>
- <h3>Return value:</h3>
- Error message
- </dd>
- <dt><a name="nixio.sysinfo"></a><strong>sysinfo</strong> ()</dt>
- <dd>
- (Linux) Get overall system statistics.
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>uptime = system uptime in seconds</li>
- <li>loads = {loadavg1, loadavg5, loadavg15}</li>
- <li>totalram = total RAM</li>
- <li>freeram = free RAM</li>
- <li>sharedram = shared RAM</li>
- <li>bufferram = buffered RAM</li>
- <li>totalswap = total SWAP</li>
- <li>freeswap = free SWAP</li>
- <li>procs = number of running processes</li>
- </ul>
- </dd>
- <dt><a name="nixio.syslog"></a><strong>syslog</strong> (priority)</dt>
- <dd>
- (POSIX) Write a message to the system logger.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- priority: Priority ["emerg", "alert", "crit", "err", "warning",
- "notice", "info", "debug"]
- </li>
-
- </ul>
- </dd>
- <dt><a name="nixio.times"></a><strong>times</strong> ()</dt>
- <dd>
- (POSIX) Get process times.
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>utime = user time</li>
- <li>utime = system time</li>
- <li>cutime = children user time</li>
- <li>cstime = children system time</li>
- </ul>
- </dd>
- <dt><a name="nixio.tls"></a><strong>tls</strong> (mode)</dt>
- <dd>
- Create a new TLS context.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- mode: TLS-Mode ["client", "server"]
- </li>
-
- </ul>
- <h3>Return value:</h3>
- TLSContext Object
- </dd>
- <dt><a name="nixio.umask"></a><strong>umask</strong> (mask)</dt>
- <dd>
- Sets the file mode creation mask.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- mask: New creation mask (see chmod for format specifications)
- </li>
-
- </ul>
- <h3>Return values:</h3>
- <ol>
-
- <li>the old umask as decimal mode number
-
- <li>the old umask as mode string
-
- </ol>
- </dd>
- <dt><a name="nixio.uname"></a><strong>uname</strong> ()</dt>
- <dd>
- (POSIX) Get information about current system and kernel.
- <h3>Return value:</h3>
- Table containing: <ul>
- <li>sysname = operating system</li>
- <li>nodename = network name (usually hostname)</li>
- <li>release = OS release</li>
- <li>version = OS version</li>
- <li>machine = hardware identifier</li>
- </ul>
- </dd>
- <dt><a name="nixio.waitpid"></a><strong>waitpid</strong> (pid, flag1, ...)</dt>
- <dd>
- (POSIX) Wait for a process to change state.
- <h3>Parameters</h3>
- <ul>
-
- <li>
- pid: Process ID (optional, default: any childprocess)
- </li>
-
- <li>
- flag1: Flag (optional) ["nohang", "untraced", "continued"]
- </li>
-
- <li>
- ...: More Flags [-"-]
- </li>
-
- </ul>
- <h3>Usage:</h3>
- If the "nohang" is given this function becomes non-blocking.
- <h3>Return values:</h3>
- <ol>
-
- <li>process id of child or 0 if no child has changed state
-
- <li>["exited", "signaled", "stopped"]
-
- <li>[exit code, terminate signal, stop signal]
-
- </ol>
- </dd>
- </dl>
- </div> <!-- id="content" -->
- </div> <!-- id="main" -->
- <div id="about">
- <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>
- </div> <!-- id="about" -->
- </div> <!-- id="container" -->
- </body>
- </html>
|