1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Reference</title>
6 <link rel="stylesheet" href="../luadoc.css" type="text/css" />
7 <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
14 <div id="product_logo"></div>
15 <div id="product_name"><big><b></b></big></div>
16 <div id="product_description"></div>
17 </div> <!-- id="product" -->
27 <li><a href="../index.html">Index</a></li>
38 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
42 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
46 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
50 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
54 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
58 <a href="../modules/luci.i18n.html">luci.i18n</a>
62 <a href="../modules/luci.ip.html">luci.ip</a>
66 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
70 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
74 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
78 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
82 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
86 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
90 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
94 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
98 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
101 <li><strong>nixio</strong></li>
104 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
108 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
112 <a href="../modules/nixio.File.html">nixio.File</a>
116 <a href="../modules/nixio.README.html">nixio.README</a>
120 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
124 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
128 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
132 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
136 <a href="../modules/nixio.bin.html">nixio.bin</a>
140 <a href="../modules/nixio.bit.html">nixio.bit</a>
144 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
148 <a href="../modules/nixio.fs.html">nixio.fs</a>
163 </div><!-- id="navigation" -->
167 <h1>Class <code>nixio</code></h1>
170 General POSIX IO library.</p>
179 <table class="function_list">
182 <td class="name" nowrap><a href="#nixio.bind">bind</a> (host, port, family, socktype)</td>
184 Create a new socket and bind it to a network address.</td>
188 <td class="name" nowrap><a href="#nixio.chdir">chdir</a> (path)</td>
190 Change the working directory.</td>
194 <td class="name" nowrap><a href="#nixio.closelog">closelog</a> ()</td>
196 (POSIX) Close the connection to the system logger.</td>
200 <td class="name" nowrap><a href="#nixio.connect">connect</a> (host, port, family, socktype)</td>
202 Create a new socket and connect to a network address.</td>
206 <td class="name" nowrap><a href="#nixio.crypt">crypt</a> (key, salt)</td>
208 (POSIX) Encrypt a user password.</td>
212 <td class="name" nowrap><a href="#nixio.dup">dup</a> (oldfd, newfd)</td>
214 Duplicate a file descriptor.</td>
218 <td class="name" nowrap><a href="#nixio.errno">errno</a> ()</td>
220 Get the last system error code.</td>
224 <td class="name" nowrap><a href="#nixio.exec">exec</a> (executable, ...)</td>
226 Execute a file to replace the current process.</td>
230 <td class="name" nowrap><a href="#nixio.exece">exece</a> (executable, arguments, environment)</td>
232 Execute a file with a custom environment to replace the current process.</td>
236 <td class="name" nowrap><a href="#nixio.execp">execp</a> (executable, ...)</td>
238 Invoke the shell and execute a file to replace the current process.</td>
242 <td class="name" nowrap><a href="#nixio.fork">fork</a> ()</td>
244 (POSIX) Clone the current process.</td>
248 <td class="name" nowrap><a href="#nixio.getaddrinfo">getaddrinfo</a> (host, family, service)</td>
250 Look up a hostname and service via DNS.</td>
254 <td class="name" nowrap><a href="#nixio.getcwd">getcwd</a> ()</td>
256 Get the current working directory.</td>
260 <td class="name" nowrap><a href="#nixio.getenv">getenv</a> (variable)</td>
262 Get the current environment table or a specific environment variable.</td>
266 <td class="name" nowrap><a href="#nixio.getgid">getgid</a> ()</td>
268 (POSIX) Get the group id of the current process.</td>
272 <td class="name" nowrap><a href="#nixio.getgr">getgr</a> (group)</td>
274 (POSIX) Get all or a specific user group.</td>
278 <td class="name" nowrap><a href="#nixio.getifaddrs">getifaddrs</a> ()</td>
280 (Linux, BSD) Get a list of available network interfaces and their addresses.</td>
284 <td class="name" nowrap><a href="#nixio.getnameinfo">getnameinfo</a> (ipaddr)</td>
286 Reverse look up an IP-Address via DNS.</td>
290 <td class="name" nowrap><a href="#nixio.getpid">getpid</a> ()</td>
292 Get the ID of the current process.</td>
296 <td class="name" nowrap><a href="#nixio.getppid">getppid</a> ()</td>
298 (POSIX) Get the parent process id of the current process.</td>
302 <td class="name" nowrap><a href="#nixio.getproto">getproto</a> (proto)</td>
304 Get all or a specifc proto entry.</td>
308 <td class="name" nowrap><a href="#nixio.getprotobyname">getprotobyname</a> (name)</td>
310 Get protocol entry by name.</td>
314 <td class="name" nowrap><a href="#nixio.getprotobynumber">getprotobynumber</a> (proto)</td>
316 Get protocol entry by number.</td>
320 <td class="name" nowrap><a href="#nixio.getpw">getpw</a> (user)</td>
322 (POSIX) Get all or a specific user account.</td>
326 <td class="name" nowrap><a href="#nixio.getsp">getsp</a> (user)</td>
328 (Linux, Solaris) Get all or a specific shadow password entry.</td>
332 <td class="name" nowrap><a href="#nixio.getuid">getuid</a> ()</td>
334 (POSIX) Get the user id of the current process.</td>
338 <td class="name" nowrap><a href="#nixio.kill">kill</a> (target, signal)</td>
340 (POSIX) Send a signal to one or more processes.</td>
344 <td class="name" nowrap><a href="#nixio.nanosleep">nanosleep</a> (seconds, nanoseconds)</td>
346 Sleep for a specified amount of time.</td>
350 <td class="name" nowrap><a href="#nixio.nice">nice</a> (nice)</td>
352 (POSIX) Change priority of current process.</td>
356 <td class="name" nowrap><a href="#nixio.open">open</a> (path, flags, mode)</td>
362 <td class="name" nowrap><a href="#nixio.open_flags">open_flags</a> (flag1, ...)</td>
364 Generate flags for a call to open().</td>
368 <td class="name" nowrap><a href="#nixio.openlog">openlog</a> (ident, flag1, ...)</td>
370 (POSIX) Open a connection to the system logger.</td>
374 <td class="name" nowrap><a href="#nixio.pipe">pipe</a> ()</td>
380 <td class="name" nowrap><a href="#nixio.poll">poll</a> (fds, timeout)</td>
382 Wait for some event on a file descriptor.</td>
386 <td class="name" nowrap><a href="#nixio.poll_flags">poll_flags</a> (mode1, ...)</td>
388 Generate events-bitfield or parse revents-bitfield for poll.</td>
392 <td class="name" nowrap><a href="#nixio.sendfile">sendfile</a> (socket, file, length)</td>
394 (POSIX) Send data from a file to a socket in kernel-space.</td>
398 <td class="name" nowrap><a href="#nixio.setenv">setenv</a> (variable, value)</td>
400 Set or unset a environment variable.</td>
404 <td class="name" nowrap><a href="#nixio.setgid">setgid</a> (gid)</td>
406 (POSIX) Set the group id of the current process.</td>
410 <td class="name" nowrap><a href="#nixio.setlogmask">setlogmask</a> (priority)</td>
412 (POSIX) Set the logmask of the system logger for current process.</td>
416 <td class="name" nowrap><a href="#nixio.setsid">setsid</a> ()</td>
418 (POSIX) Create a new session and set the process group ID.</td>
422 <td class="name" nowrap><a href="#nixio.setuid">setuid</a> (gid)</td>
424 (POSIX) Set the user id of the current process.</td>
428 <td class="name" nowrap><a href="#nixio.signal">signal</a> (signal, handler)</td>
430 Ignore or use set the default handler for a signal.</td>
434 <td class="name" nowrap><a href="#nixio.socket">socket</a> (domain, type)</td>
436 Create a new socket.</td>
440 <td class="name" nowrap><a href="#nixio.splice">splice</a> (fdin, fdout, length, flags)</td>
442 (Linux) Send data from / to a pipe in kernel-space.</td>
446 <td class="name" nowrap><a href="#nixio.splice_flags">splice_flags</a> (flag1, ...)</td>
448 (Linux) Generate a flag bitfield for a call to splice.</td>
452 <td class="name" nowrap><a href="#nixio.strerror">strerror</a> (errno)</td>
454 Get the error message for the corresponding error code.</td>
458 <td class="name" nowrap><a href="#nixio.sysinfo">sysinfo</a> ()</td>
460 (Linux) Get overall system statistics.</td>
464 <td class="name" nowrap><a href="#nixio.syslog">syslog</a> (priority)</td>
466 (POSIX) Write a message to the system logger.</td>
470 <td class="name" nowrap><a href="#nixio.times">times</a> ()</td>
472 (POSIX) Get process times.</td>
476 <td class="name" nowrap><a href="#nixio.tls">tls</a> (mode)</td>
478 Create a new TLS context.</td>
482 <td class="name" nowrap><a href="#nixio.umask">umask</a> (mask)</td>
484 Sets the file mode creation mask.</td>
488 <td class="name" nowrap><a href="#nixio.uname">uname</a> ()</td>
490 (POSIX) Get information about current system and kernel.</td>
494 <td class="name" nowrap><a href="#nixio.waitpid">waitpid</a> (pid, flag1, ...)</td>
496 (POSIX) Wait for a process to change state.</td>
510 <h2><a name="functions"></a>Functions</h2>
511 <dl class="function">
515 <dt><a name="nixio.bind"></a><strong>bind</strong> (host, port, family, socktype)</dt>
518 Create a new socket and bind it to a network address.
519 This function is a shortcut for calling nixio.socket and then bind()
520 on the socket object.
527 host: Hostname or IP-Address (optional, default: all addresses)
531 port: Port or service description
535 family: Address family [<strong>"any"</strong>, "inet", "inet6"]
539 socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
550 <li>This functions calls getaddrinfo(), socket(),
551 setsockopt() and bind() but NOT listen().
553 <li>The <em>reuseaddr</em>-option is automatically set before binding.
559 <h3>Return value:</h3>
569 <dt><a name="nixio.chdir"></a><strong>chdir</strong> (path)</dt>
572 Change the working directory.
579 path: New working directory
589 <h3>Return value:</h3>
599 <dt><a name="nixio.closelog"></a><strong>closelog</strong> ()</dt>
602 (POSIX) Close the connection to the system logger.
617 <dt><a name="nixio.connect"></a><strong>connect</strong> (host, port, family, socktype)</dt>
620 Create a new socket and connect to a network address.
621 This function is a shortcut for calling nixio.socket and then connect()
622 on the socket object.
629 host: Hostname or IP-Address (optional, default: localhost)
633 port: Port or service description
637 family: Address family [<strong>"any"</strong>, "inet", "inet6"]
641 socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
650 This functions calls getaddrinfo(), socket() and connect().
654 <h3>Return value:</h3>
664 <dt><a name="nixio.crypt"></a><strong>crypt</strong> (key, salt)</dt>
667 (POSIX) Encrypt a user password.
688 <h3>Return value:</h3>
698 <dt><a name="nixio.dup"></a><strong>dup</strong> (oldfd, newfd)</dt>
701 Duplicate a file descriptor.
708 oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
712 newfd: New descriptor to serve as copy (optional)
721 This funcation calls dup2() if <em>newfd</em> is set, otherwise dup().
725 <h3>Return value:</h3>
726 File Object of new descriptor
735 <dt><a name="nixio.errno"></a><strong>errno</strong> ()</dt>
738 Get the last system error code.
746 <h3>Return value:</h3>
756 <dt><a name="nixio.exec"></a><strong>exec</strong> (executable, ...)</dt>
759 Execute a file to replace the current process.
766 executable: Executable
781 <li>The name of the executable is automatically passed as argv[0]
783 <li>This function does not return on success.
796 <dt><a name="nixio.exece"></a><strong>exece</strong> (executable, arguments, environment)</dt>
799 Execute a file with a custom environment to replace the current process.
806 executable: Executable
810 arguments: Argument Table
814 environment: Environment Table (optional)
825 <li>The name of the executable is automatically passed as argv[0]
827 <li>This function does not return on success.
840 <dt><a name="nixio.execp"></a><strong>execp</strong> (executable, ...)</dt>
843 Invoke the shell and execute a file to replace the current process.
850 executable: Executable
865 <li>The name of the executable is automatically passed as argv[0]
867 <li>This function does not return on success.
880 <dt><a name="nixio.fork"></a><strong>fork</strong> ()</dt>
883 (POSIX) Clone the current process.
891 <h3>Return value:</h3>
892 the child process id for the parent process, 0 for the child process
901 <dt><a name="nixio.getaddrinfo"></a><strong>getaddrinfo</strong> (host, family, service)</dt>
904 Look up a hostname and service via DNS.
911 host: hostname to lookup (optional)
915 family: address family [<strong>"any"</strong>, "inet", "inet6"]
919 service: service name or port (optional)
929 <h3>Return value:</h3>
930 Table containing one or more tables containing: <ul>
931 <li>family = ["inet", "inet6"]</li>
932 <li>socktype = ["stream", "dgram", "raw"]</li>
933 <li>address = Resolved IP-Address</li>
934 <li>port = Resolved Port (if service was given)</li>
944 <dt><a name="nixio.getcwd"></a><strong>getcwd</strong> ()</dt>
947 Get the current working directory.
955 <h3>Return value:</h3>
965 <dt><a name="nixio.getenv"></a><strong>getenv</strong> (variable)</dt>
968 Get the current environment table or a specific environment variable.
975 variable: Variable (optional)
985 <h3>Return value:</h3>
986 environment table or single environment variable
995 <dt><a name="nixio.getgid"></a><strong>getgid</strong> ()</dt>
998 (POSIX) Get the group id of the current process.
1006 <h3>Return value:</h3>
1016 <dt><a name="nixio.getgr"></a><strong>getgr</strong> (group)</dt>
1019 (POSIX) Get all or a specific user group.
1026 group: Group ID or groupname (optional)
1036 <h3>Return value:</h3>
1037 Table containing: <ul>
1038 <li>name = Group Name</li>
1039 <li>gid = Group ID</li>
1040 <li>passwd = Password</li>
1041 <li>mem = {Member #1, Member #2, ...}</li>
1051 <dt><a name="nixio.getifaddrs"></a><strong>getifaddrs</strong> ()</dt>
1054 (Linux, BSD) Get a list of available network interfaces and their addresses.
1062 <h3>Return value:</h3>
1063 Table containing one or more tables containing: <ul>
1064 <li>name = Interface Name</li>
1065 <li>family = ["inet", "inet6", "packet"]</li>
1066 <li>addr = Interface Address (IPv4, IPv6, MAC, ...)</li>
1067 <li>broadaddr = Broadcast Address</li>
1068 <li>dstaddr = Destination Address (Point-to-Point)</li>
1069 <li>netmask = Netmask (if available)</li>
1070 <li>prefix = Prefix (if available)</li>
1071 <li>flags = Table of interface flags (up, multicast, loopback, ...)</li>
1072 <li>data = Statistics (Linux, "packet"-family)</li>
1073 <li>hatype = Hardware Type Identifier (Linix, "packet"-family)</li>
1074 <li>ifindex = Interface Index (Linux, "packet"-family)</li>
1084 <dt><a name="nixio.getnameinfo"></a><strong>getnameinfo</strong> (ipaddr)</dt>
1087 Reverse look up an IP-Address via DNS.
1094 ipaddr: IPv4 or IPv6-Address
1104 <h3>Return value:</h3>
1114 <dt><a name="nixio.getpid"></a><strong>getpid</strong> ()</dt>
1117 Get the ID of the current process.
1125 <h3>Return value:</h3>
1135 <dt><a name="nixio.getppid"></a><strong>getppid</strong> ()</dt>
1138 (POSIX) Get the parent process id of the current process.
1146 <h3>Return value:</h3>
1156 <dt><a name="nixio.getproto"></a><strong>getproto</strong> (proto)</dt>
1159 Get all or a specifc proto entry.
1166 proto: protocol number or name to lookup (optional)
1176 <h3>Return value:</h3>
1177 Table (or if no parameter is given, a table of tables)
1178 containing the following fields: <ul>
1179 <li>name = Protocol Name</li>
1180 <li>proto = Protocol Number</li>
1181 <li>aliases = Table of alias names</li>
1191 <dt><a name="nixio.getprotobyname"></a><strong>getprotobyname</strong> (name)</dt>
1194 Get protocol entry by name.
1201 name: protocol name to lookup
1210 This function returns nil if the given protocol is unknown.
1214 <h3>Return value:</h3>
1215 Table containing the following fields: <ul>
1216 <li>name = Protocol Name</li>
1217 <li>proto = Protocol Number</li>
1218 <li>aliases = Table of alias names</li>
1228 <dt><a name="nixio.getprotobynumber"></a><strong>getprotobynumber</strong> (proto)</dt>
1231 Get protocol entry by number.
1238 proto: protocol number to lookup
1247 This function returns nil if the given protocol is unknown.
1251 <h3>Return value:</h3>
1252 Table containing the following fields: <ul>
1253 <li>name = Protocol Name</li>
1254 <li>proto = Protocol Number</li>
1255 <li>aliases = Table of alias names</li>
1265 <dt><a name="nixio.getpw"></a><strong>getpw</strong> (user)</dt>
1268 (POSIX) Get all or a specific user account.
1275 user: User ID or username (optional)
1285 <h3>Return value:</h3>
1286 Table containing: <ul>
1287 <li>name = Name</li>
1289 <li>gid = Group ID</li>
1290 <li>passwd = Password</li>
1291 <li>dir = Home directory</li>
1292 <li>gecos = Information</li>
1293 <li>shell = Shell</li>
1303 <dt><a name="nixio.getsp"></a><strong>getsp</strong> (user)</dt>
1306 (Linux, Solaris) Get all or a specific shadow password entry.
1313 user: username (optional)
1323 <h3>Return value:</h3>
1324 Table containing: <ul>
1325 <li>namp = Name</li>
1326 <li>expire = Expiration Date</li>
1327 <li>flag = Flags</li>
1328 <li>inact = Inactivity Date</li>
1329 <li>lstchg = Last change</li>
1330 <li>max = Maximum</li>
1331 <li>min = Minimum</li>
1332 <li>warn = Warning</li>
1333 <li>pwdp = Password Hash</li>
1343 <dt><a name="nixio.getuid"></a><strong>getuid</strong> ()</dt>
1346 (POSIX) Get the user id of the current process.
1354 <h3>Return value:</h3>
1364 <dt><a name="nixio.kill"></a><strong>kill</strong> (target, signal)</dt>
1367 (POSIX) Send a signal to one or more processes.
1374 target: Target process of process group.
1378 signal: Signal to send
1388 <h3>Return value:</h3>
1398 <dt><a name="nixio.nanosleep"></a><strong>nanosleep</strong> (seconds, nanoseconds)</dt>
1401 Sleep for a specified amount of time.
1408 seconds: Seconds to wait (optional)
1412 nanoseconds: Nanoseconds to wait (optional)
1423 <li>Not all systems support nanosecond precision but you can expect
1424 to have at least maillisecond precision.
1426 <li>This function is not signal-protected and may fail with EINTR.
1432 <h3>Return value:</h3>
1442 <dt><a name="nixio.nice"></a><strong>nice</strong> (nice)</dt>
1445 (POSIX) Change priority of current process.
1462 <h3>Return value:</h3>
1472 <dt><a name="nixio.open"></a><strong>open</strong> (path, flags, mode)</dt>
1482 path: Filesystem path to open
1486 flags: Flag string or number (see open_flags).
1487 [<strong>"r"</strong>, "r+", "w", "w+", "a", "a+"]
1491 mode: File mode for newly created files (see chmod, umask).
1500 Although this function also supports the traditional fopen()
1501 file flags it does not create a file stream but uses the open() syscall.
1505 <h3>Return value:</h3>
1513 <li><a href="#nixio.umask">
1517 <li><a href="#nixio.open_flags">
1528 <dt><a name="nixio.open_flags"></a><strong>open_flags</strong> (flag1, ...)</dt>
1531 Generate flags for a call to open().
1538 flag1: First Flag ["append", "creat", "excl", "nonblock", "ndelay",
1539 "sync", "trunc", "rdonly", "wronly", "rdwr"]
1543 ...: More Flags [-"-]
1554 <li>This function cannot fail and will never return nil.
1556 <li>The "nonblock" and "ndelay" flags are aliases.
1558 <li>The "nonblock", "ndelay" and "sync" flags are no-ops on Windows.
1564 <h3>Return value:</h3>
1565 flag to be used as second paramter to open
1574 <dt><a name="nixio.openlog"></a><strong>openlog</strong> (ident, flag1, ...)</dt>
1577 (POSIX) Open a connection to the system logger.
1588 flag1: Flag 1 ["cons", "nowait", "pid", "perror", "ndelay", "odelay"]
1592 ...: More flags [-"-]
1609 <dt><a name="nixio.pipe"></a><strong>pipe</strong> ()</dt>
1620 <h3>Return values:</h3>
1623 <li>File Object of the read end
1625 <li>File Object of the write end
1636 <dt><a name="nixio.poll"></a><strong>poll</strong> (fds, timeout)</dt>
1639 Wait for some event on a file descriptor.
1640 poll() sets the revents-field of the tables provided by fds to a bitfield
1641 indicating the events that occured.
1648 fds: Table containing one or more tables containing <ul>
1649 <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]</li>
1650 <li> events = events to wait for (bitfield generated with poll_flags)</li>
1655 timeout: Timeout in milliseconds
1666 <li>This function works in-place on the provided table and only
1667 writes the revents field, you can use other fields on your demand.
1669 <li>All metamethods on the tables provided as fds are ignored.
1671 <li>The revents-fields are not reset when the call times out.
1672 You have to check the first return value to be 0 to handle this case.
1674 <li>If you want to wait on a TLS-Socket you have to use the underlying
1677 <li>On Windows poll is emulated through select(), can only be used
1678 on socket descriptors and cannot take more than 64 descriptors per call.
1680 <li>This function is not signal-protected and may fail with EINTR.
1686 <h3>Return values:</h3>
1689 <li>number of ready IO descriptors
1691 <li>the fds-table with revents-fields set
1700 <li><a href="#nixio.poll_flags">
1711 <dt><a name="nixio.poll_flags"></a><strong>poll_flags</strong> (mode1, ...)</dt>
1714 Generate events-bitfield or parse revents-bitfield for poll.
1721 mode1: revents-Flag bitfield returned from poll to parse OR
1722 ["in", "out", "err", "pri" (POSIX), "hup" (POSIX), "nval" (POSIX)]
1726 ...: More mode strings for generating the flag [-"-]
1736 <h3>Return value:</h3>
1737 table with boolean fields reflecting the mode parameter
1738 <strong>OR</strong> bitfield to use for the events-Flag field
1745 <li><a href="#nixio.poll">
1756 <dt><a name="nixio.sendfile"></a><strong>sendfile</strong> (socket, file, length)</dt>
1759 (POSIX) Send data from a file to a socket in kernel-space.
1766 socket: Socket Object
1774 length: Amount of data to send (in Bytes).
1784 <h3>Return value:</h3>
1794 <dt><a name="nixio.setenv"></a><strong>setenv</strong> (variable, value)</dt>
1797 Set or unset a environment variable.
1808 value: Value (optional)
1817 The environment variable will be unset if value is ommited.
1821 <h3>Return value:</h3>
1831 <dt><a name="nixio.setgid"></a><strong>setgid</strong> (gid)</dt>
1834 (POSIX) Set the group id of the current process.
1851 <h3>Return value:</h3>
1861 <dt><a name="nixio.setlogmask"></a><strong>setlogmask</strong> (priority)</dt>
1864 (POSIX) Set the logmask of the system logger for current process.
1871 priority: Priority ["emerg", "alert", "crit", "err", "warning",
1872 "notice", "info", "debug"]
1889 <dt><a name="nixio.setsid"></a><strong>setsid</strong> ()</dt>
1892 (POSIX) Create a new session and set the process group ID.
1900 <h3>Return value:</h3>
1910 <dt><a name="nixio.setuid"></a><strong>setuid</strong> (gid)</dt>
1913 (POSIX) Set the user id of the current process.
1930 <h3>Return value:</h3>
1940 <dt><a name="nixio.signal"></a><strong>signal</strong> (signal, handler)</dt>
1943 Ignore or use set the default handler for a signal.
1954 handler: ["ign", "dfl"]
1964 <h3>Return value:</h3>
1974 <dt><a name="nixio.socket"></a><strong>socket</strong> (domain, type)</dt>
1977 Create a new socket.
1984 domain: Domain ["inet", "inet6", "unix"]
1988 type: Type ["stream", "dgram", "raw"]
1998 <h3>Return value:</h3>
2008 <dt><a name="nixio.splice"></a><strong>splice</strong> (fdin, fdout, length, flags)</dt>
2011 (Linux) Send data from / to a pipe in kernel-space.
2018 fdin: Input I/O descriptor
2022 fdout: Output I/O descriptor
2026 length: Amount of data to send (in Bytes).
2030 flags: (optional, bitfield generated by splice_flags)
2040 <h3>Return value:</h3>
2048 <li><a href="#nixio.splice_flags">
2059 <dt><a name="nixio.splice_flags"></a><strong>splice_flags</strong> (flag1, ...)</dt>
2062 (Linux) Generate a flag bitfield for a call to splice.
2069 flag1: First Flag ["move", "nonblock", "more"]
2073 ...: More flags [-"-]
2083 <h3>Return value:</h3>
2091 <li><a href="#nixio.splice">
2102 <dt><a name="nixio.strerror"></a><strong>strerror</strong> (errno)</dt>
2105 Get the error message for the corresponding error code.
2112 errno: System error code
2122 <h3>Return value:</h3>
2132 <dt><a name="nixio.sysinfo"></a><strong>sysinfo</strong> ()</dt>
2135 (Linux) Get overall system statistics.
2143 <h3>Return value:</h3>
2144 Table containing: <ul>
2145 <li>uptime = system uptime in seconds</li>
2146 <li>loads = {loadavg1, loadavg5, loadavg15}</li>
2147 <li>totalram = total RAM</li>
2148 <li>freeram = free RAM</li>
2149 <li>sharedram = shared RAM</li>
2150 <li>bufferram = buffered RAM</li>
2151 <li>totalswap = total SWAP</li>
2152 <li>freeswap = free SWAP</li>
2153 <li>procs = number of running processes</li>
2163 <dt><a name="nixio.syslog"></a><strong>syslog</strong> (priority)</dt>
2166 (POSIX) Write a message to the system logger.
2173 priority: Priority ["emerg", "alert", "crit", "err", "warning",
2174 "notice", "info", "debug"]
2191 <dt><a name="nixio.times"></a><strong>times</strong> ()</dt>
2194 (POSIX) Get process times.
2202 <h3>Return value:</h3>
2203 Table containing: <ul>
2204 <li>utime = user time</li>
2205 <li>utime = system time</li>
2206 <li>cutime = children user time</li>
2207 <li>cstime = children system time</li>
2217 <dt><a name="nixio.tls"></a><strong>tls</strong> (mode)</dt>
2220 Create a new TLS context.
2227 mode: TLS-Mode ["client", "server"]
2237 <h3>Return value:</h3>
2247 <dt><a name="nixio.umask"></a><strong>umask</strong> (mask)</dt>
2250 Sets the file mode creation mask.
2257 mask: New creation mask (see chmod for format specifications)
2267 <h3>Return values:</h3>
2270 <li>the old umask as decimal mode number
2272 <li>the old umask as mode string
2283 <dt><a name="nixio.uname"></a><strong>uname</strong> ()</dt>
2286 (POSIX) Get information about current system and kernel.
2294 <h3>Return value:</h3>
2295 Table containing: <ul>
2296 <li>sysname = operating system</li>
2297 <li>nodename = network name (usually hostname)</li>
2298 <li>release = OS release</li>
2299 <li>version = OS version</li>
2300 <li>machine = hardware identifier</li>
2310 <dt><a name="nixio.waitpid"></a><strong>waitpid</strong> (pid, flag1, ...)</dt>
2313 (POSIX) Wait for a process to change state.
2320 pid: Process ID (optional, default: any childprocess)
2324 flag1: Flag (optional) ["nohang", "untraced", "continued"]
2328 ...: More Flags [-"-]
2337 If the "nohang" is given this function becomes non-blocking.
2341 <h3>Return values:</h3>
2344 <li>process id of child or 0 if no child has changed state
2346 <li>["exited", "signaled", "stopped"]
2348 <li>[exit code, terminate signal, stop signal]
2363 </div> <!-- id="content" -->
2365 </div> <!-- id="main" -->
2368 <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>
2369 </div> <!-- id="about" -->
2371 </div> <!-- id="container" -->