diff options
Diffstat (limited to 'documentation/api/modules/nixio.html')
-rw-r--r-- | documentation/api/modules/nixio.html | 2373 |
1 files changed, 2373 insertions, 0 deletions
diff --git a/documentation/api/modules/nixio.html b/documentation/api/modules/nixio.html new file mode 100644 index 000000000..8b0f84b1a --- /dev/null +++ b/documentation/api/modules/nixio.html @@ -0,0 +1,2373 @@ +<!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.protocol.html">luci.http.protocol</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a> + </li> + + <li> + <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.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.jsonc.html">luci.jsonc</a> + </li> + + <li> + <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</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><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 specifc 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 specifc 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 paramter 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 occured. + + +<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 ommited. + + + +<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> |