1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401 |
- <!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><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>
|