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.html">luci.http
</a>
46 <a href=
"../modules/luci.http.conditionals.html">luci.http.conditionals
</a>
50 <a href=
"../modules/luci.http.date.html">luci.http.date
</a>
54 <a href=
"../modules/luci.http.mime.html">luci.http.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.json.html">luci.json
</a>
74 <a href=
"../modules/luci.jsonc.html">luci.jsonc
</a>
78 <a href=
"../modules/luci.jsonc.parser.html">luci.jsonc.parser
</a>
82 <a href=
"../modules/luci.model.ipkg.html">luci.model.ipkg
</a>
86 <a href=
"../modules/luci.model.uci.html">luci.model.uci
</a>
90 <a href=
"../modules/luci.rpcc.html">luci.rpcc
</a>
94 <a href=
"../modules/luci.rpcc.ruci.html">luci.rpcc.ruci
</a>
98 <a href=
"../modules/luci.sys.html">luci.sys
</a>
102 <a href=
"../modules/luci.sys.init.html">luci.sys.init
</a>
106 <a href=
"../modules/luci.sys.iptparser.html">luci.sys.iptparser
</a>
110 <a href=
"../modules/luci.sys.net.html">luci.sys.net
</a>
114 <a href=
"../modules/luci.sys.process.html">luci.sys.process
</a>
118 <a href=
"../modules/luci.sys.user.html">luci.sys.user
</a>
122 <a href=
"../modules/luci.sys.wifi.html">luci.sys.wifi
</a>
126 <a href=
"../modules/luci.util.html">luci.util
</a>
129 <li><strong>nixio
</strong></li>
132 <a href=
"../modules/nixio.CHANGELOG.html">nixio.CHANGELOG
</a>
136 <a href=
"../modules/nixio.CryptoHash.html">nixio.CryptoHash
</a>
140 <a href=
"../modules/nixio.File.html">nixio.File
</a>
144 <a href=
"../modules/nixio.README.html">nixio.README
</a>
148 <a href=
"../modules/nixio.Socket.html">nixio.Socket
</a>
152 <a href=
"../modules/nixio.TLSContext.html">nixio.TLSContext
</a>
156 <a href=
"../modules/nixio.TLSSocket.html">nixio.TLSSocket
</a>
160 <a href=
"../modules/nixio.UnifiedIO.html">nixio.UnifiedIO
</a>
164 <a href=
"../modules/nixio.bin.html">nixio.bin
</a>
168 <a href=
"../modules/nixio.bit.html">nixio.bit
</a>
172 <a href=
"../modules/nixio.crypto.html">nixio.crypto
</a>
176 <a href=
"../modules/nixio.fs.html">nixio.fs
</a>
191 </div><!-- id="navigation" -->
195 <h1>Class
<code>nixio
</code></h1>
198 General POSIX IO library.
</p>
207 <table class=
"function_list">
210 <td class=
"name" nowrap
><a href=
"#nixio.bind">bind
</a> (host, port, family, socktype)
</td>
212 Create a new socket and bind it to a network address.
</td>
216 <td class=
"name" nowrap
><a href=
"#nixio.chdir">chdir
</a> (path)
</td>
218 Change the working directory.
</td>
222 <td class=
"name" nowrap
><a href=
"#nixio.closelog">closelog
</a> ()
</td>
224 (POSIX) Close the connection to the system logger.
</td>
228 <td class=
"name" nowrap
><a href=
"#nixio.connect">connect
</a> (host, port, family, socktype)
</td>
230 Create a new socket and connect to a network address.
</td>
234 <td class=
"name" nowrap
><a href=
"#nixio.crypt">crypt
</a> (key, salt)
</td>
236 (POSIX) Encrypt a user password.
</td>
240 <td class=
"name" nowrap
><a href=
"#nixio.dup">dup
</a> (oldfd, newfd)
</td>
242 Duplicate a file descriptor.
</td>
246 <td class=
"name" nowrap
><a href=
"#nixio.errno">errno
</a> ()
</td>
248 Get the last system error code.
</td>
252 <td class=
"name" nowrap
><a href=
"#nixio.exec">exec
</a> (executable, ...)
</td>
254 Execute a file to replace the current process.
</td>
258 <td class=
"name" nowrap
><a href=
"#nixio.exece">exece
</a> (executable, arguments, environment)
</td>
260 Execute a file with a custom environment to replace the current process.
</td>
264 <td class=
"name" nowrap
><a href=
"#nixio.execp">execp
</a> (executable, ...)
</td>
266 Invoke the shell and execute a file to replace the current process.
</td>
270 <td class=
"name" nowrap
><a href=
"#nixio.fork">fork
</a> ()
</td>
272 (POSIX) Clone the current process.
</td>
276 <td class=
"name" nowrap
><a href=
"#nixio.getaddrinfo">getaddrinfo
</a> (host, family, service)
</td>
278 Look up a hostname and service via DNS.
</td>
282 <td class=
"name" nowrap
><a href=
"#nixio.getcwd">getcwd
</a> ()
</td>
284 Get the current working directory.
</td>
288 <td class=
"name" nowrap
><a href=
"#nixio.getenv">getenv
</a> (variable)
</td>
290 Get the current environment table or a specific environment variable.
</td>
294 <td class=
"name" nowrap
><a href=
"#nixio.getgid">getgid
</a> ()
</td>
296 (POSIX) Get the group id of the current process.
</td>
300 <td class=
"name" nowrap
><a href=
"#nixio.getgr">getgr
</a> (group)
</td>
302 (POSIX) Get all or a specific user group.
</td>
306 <td class=
"name" nowrap
><a href=
"#nixio.getifaddrs">getifaddrs
</a> ()
</td>
308 (Linux, BSD) Get a list of available network interfaces and their addresses.
</td>
312 <td class=
"name" nowrap
><a href=
"#nixio.getnameinfo">getnameinfo
</a> (ipaddr)
</td>
314 Reverse look up an IP-Address via DNS.
</td>
318 <td class=
"name" nowrap
><a href=
"#nixio.getpid">getpid
</a> ()
</td>
320 Get the ID of the current process.
</td>
324 <td class=
"name" nowrap
><a href=
"#nixio.getppid">getppid
</a> ()
</td>
326 (POSIX) Get the parent process id of the current process.
</td>
330 <td class=
"name" nowrap
><a href=
"#nixio.getproto">getproto
</a> (proto)
</td>
332 Get all or a specific proto entry.
</td>
336 <td class=
"name" nowrap
><a href=
"#nixio.getprotobyname">getprotobyname
</a> (name)
</td>
338 Get protocol entry by name.
</td>
342 <td class=
"name" nowrap
><a href=
"#nixio.getprotobynumber">getprotobynumber
</a> (proto)
</td>
344 Get protocol entry by number.
</td>
348 <td class=
"name" nowrap
><a href=
"#nixio.getpw">getpw
</a> (user)
</td>
350 (POSIX) Get all or a specific user account.
</td>
354 <td class=
"name" nowrap
><a href=
"#nixio.getsp">getsp
</a> (user)
</td>
356 (Linux, Solaris) Get all or a specific shadow password entry.
</td>
360 <td class=
"name" nowrap
><a href=
"#nixio.getuid">getuid
</a> ()
</td>
362 (POSIX) Get the user id of the current process.
</td>
366 <td class=
"name" nowrap
><a href=
"#nixio.kill">kill
</a> (target, signal)
</td>
368 (POSIX) Send a signal to one or more processes.
</td>
372 <td class=
"name" nowrap
><a href=
"#nixio.nanosleep">nanosleep
</a> (seconds, nanoseconds)
</td>
374 Sleep for a specified amount of time.
</td>
378 <td class=
"name" nowrap
><a href=
"#nixio.nice">nice
</a> (nice)
</td>
380 (POSIX) Change priority of current process.
</td>
384 <td class=
"name" nowrap
><a href=
"#nixio.open">open
</a> (path, flags, mode)
</td>
390 <td class=
"name" nowrap
><a href=
"#nixio.open_flags">open_flags
</a> (flag1, ...)
</td>
392 Generate flags for a call to open().
</td>
396 <td class=
"name" nowrap
><a href=
"#nixio.openlog">openlog
</a> (ident, flag1, ...)
</td>
398 (POSIX) Open a connection to the system logger.
</td>
402 <td class=
"name" nowrap
><a href=
"#nixio.pipe">pipe
</a> ()
</td>
408 <td class=
"name" nowrap
><a href=
"#nixio.poll">poll
</a> (fds, timeout)
</td>
410 Wait for some event on a file descriptor.
</td>
414 <td class=
"name" nowrap
><a href=
"#nixio.poll_flags">poll_flags
</a> (mode1, ...)
</td>
416 Generate events-bitfield or parse revents-bitfield for poll.
</td>
420 <td class=
"name" nowrap
><a href=
"#nixio.sendfile">sendfile
</a> (socket, file, length)
</td>
422 (POSIX) Send data from a file to a socket in kernel-space.
</td>
426 <td class=
"name" nowrap
><a href=
"#nixio.setenv">setenv
</a> (variable, value)
</td>
428 Set or unset a environment variable.
</td>
432 <td class=
"name" nowrap
><a href=
"#nixio.setgid">setgid
</a> (gid)
</td>
434 (POSIX) Set the group id of the current process.
</td>
438 <td class=
"name" nowrap
><a href=
"#nixio.setlogmask">setlogmask
</a> (priority)
</td>
440 (POSIX) Set the logmask of the system logger for current process.
</td>
444 <td class=
"name" nowrap
><a href=
"#nixio.setsid">setsid
</a> ()
</td>
446 (POSIX) Create a new session and set the process group ID.
</td>
450 <td class=
"name" nowrap
><a href=
"#nixio.setuid">setuid
</a> (gid)
</td>
452 (POSIX) Set the user id of the current process.
</td>
456 <td class=
"name" nowrap
><a href=
"#nixio.signal">signal
</a> (signal, handler)
</td>
458 Ignore or use set the default handler for a signal.
</td>
462 <td class=
"name" nowrap
><a href=
"#nixio.socket">socket
</a> (domain, type)
</td>
464 Create a new socket.
</td>
468 <td class=
"name" nowrap
><a href=
"#nixio.splice">splice
</a> (fdin, fdout, length, flags)
</td>
470 (Linux) Send data from / to a pipe in kernel-space.
</td>
474 <td class=
"name" nowrap
><a href=
"#nixio.splice_flags">splice_flags
</a> (flag1, ...)
</td>
476 (Linux) Generate a flag bitfield for a call to splice.
</td>
480 <td class=
"name" nowrap
><a href=
"#nixio.strerror">strerror
</a> (errno)
</td>
482 Get the error message for the corresponding error code.
</td>
486 <td class=
"name" nowrap
><a href=
"#nixio.sysinfo">sysinfo
</a> ()
</td>
488 (Linux) Get overall system statistics.
</td>
492 <td class=
"name" nowrap
><a href=
"#nixio.syslog">syslog
</a> (priority)
</td>
494 (POSIX) Write a message to the system logger.
</td>
498 <td class=
"name" nowrap
><a href=
"#nixio.times">times
</a> ()
</td>
500 (POSIX) Get process times.
</td>
504 <td class=
"name" nowrap
><a href=
"#nixio.tls">tls
</a> (mode)
</td>
506 Create a new TLS context.
</td>
510 <td class=
"name" nowrap
><a href=
"#nixio.umask">umask
</a> (mask)
</td>
512 Sets the file mode creation mask.
</td>
516 <td class=
"name" nowrap
><a href=
"#nixio.uname">uname
</a> ()
</td>
518 (POSIX) Get information about current system and kernel.
</td>
522 <td class=
"name" nowrap
><a href=
"#nixio.waitpid">waitpid
</a> (pid, flag1, ...)
</td>
524 (POSIX) Wait for a process to change state.
</td>
538 <h2><a name=
"functions"></a>Functions
</h2>
539 <dl class=
"function">
543 <dt><a name=
"nixio.bind"></a><strong>bind
</strong> (host, port, family, socktype)
</dt>
546 Create a new socket and bind it to a network address.
547 This function is a shortcut for calling nixio.socket and then bind()
548 on the socket object.
555 host: Hostname or IP-Address (optional, default: all addresses)
559 port: Port or service description
563 family: Address family [
<strong>"any"</strong>,
"inet",
"inet6"]
567 socktype: Socket Type [
<strong>"stream"</strong>,
"dgram"]
578 <li>This functions calls getaddrinfo(), socket(),
579 setsockopt() and bind() but NOT listen().
581 <li>The
<em>reuseaddr
</em>-option is automatically set before binding.
587 <h3>Return value:
</h3>
597 <dt><a name=
"nixio.chdir"></a><strong>chdir
</strong> (path)
</dt>
600 Change the working directory.
607 path: New working directory
617 <h3>Return value:
</h3>
627 <dt><a name=
"nixio.closelog"></a><strong>closelog
</strong> ()
</dt>
630 (POSIX) Close the connection to the system logger.
645 <dt><a name=
"nixio.connect"></a><strong>connect
</strong> (host, port, family, socktype)
</dt>
648 Create a new socket and connect to a network address.
649 This function is a shortcut for calling nixio.socket and then connect()
650 on the socket object.
657 host: Hostname or IP-Address (optional, default: localhost)
661 port: Port or service description
665 family: Address family [
<strong>"any"</strong>,
"inet",
"inet6"]
669 socktype: Socket Type [
<strong>"stream"</strong>,
"dgram"]
678 This functions calls getaddrinfo(), socket() and connect().
682 <h3>Return value:
</h3>
692 <dt><a name=
"nixio.crypt"></a><strong>crypt
</strong> (key, salt)
</dt>
695 (POSIX) Encrypt a user password.
716 <h3>Return value:
</h3>
726 <dt><a name=
"nixio.dup"></a><strong>dup
</strong> (oldfd, newfd)
</dt>
729 Duplicate a file descriptor.
736 oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
740 newfd: New descriptor to serve as copy (optional)
749 This funcation calls dup2() if
<em>newfd
</em> is set, otherwise dup().
753 <h3>Return value:
</h3>
754 File Object of new descriptor
763 <dt><a name=
"nixio.errno"></a><strong>errno
</strong> ()
</dt>
766 Get the last system error code.
774 <h3>Return value:
</h3>
784 <dt><a name=
"nixio.exec"></a><strong>exec
</strong> (executable, ...)
</dt>
787 Execute a file to replace the current process.
794 executable: Executable
809 <li>The name of the executable is automatically passed as argv[
0]
811 <li>This function does not return on success.
824 <dt><a name=
"nixio.exece"></a><strong>exece
</strong> (executable, arguments, environment)
</dt>
827 Execute a file with a custom environment to replace the current process.
834 executable: Executable
838 arguments: Argument Table
842 environment: Environment Table (optional)
853 <li>The name of the executable is automatically passed as argv[
0]
855 <li>This function does not return on success.
868 <dt><a name=
"nixio.execp"></a><strong>execp
</strong> (executable, ...)
</dt>
871 Invoke the shell and execute a file to replace the current process.
878 executable: Executable
893 <li>The name of the executable is automatically passed as argv[
0]
895 <li>This function does not return on success.
908 <dt><a name=
"nixio.fork"></a><strong>fork
</strong> ()
</dt>
911 (POSIX) Clone the current process.
919 <h3>Return value:
</h3>
920 the child process id for the parent process,
0 for the child process
929 <dt><a name=
"nixio.getaddrinfo"></a><strong>getaddrinfo
</strong> (host, family, service)
</dt>
932 Look up a hostname and service via DNS.
939 host: hostname to lookup (optional)
943 family: address family [
<strong>"any"</strong>,
"inet",
"inet6"]
947 service: service name or port (optional)
957 <h3>Return value:
</h3>
958 Table containing one or more tables containing:
<ul>
959 <li>family = [
"inet",
"inet6"]
</li>
960 <li>socktype = [
"stream",
"dgram",
"raw"]
</li>
961 <li>address = Resolved IP-Address
</li>
962 <li>port = Resolved Port (if service was given)
</li>
972 <dt><a name=
"nixio.getcwd"></a><strong>getcwd
</strong> ()
</dt>
975 Get the current working directory.
983 <h3>Return value:
</h3>
993 <dt><a name=
"nixio.getenv"></a><strong>getenv
</strong> (variable)
</dt>
996 Get the current environment table or a specific environment variable.
1003 variable: Variable (optional)
1013 <h3>Return value:
</h3>
1014 environment table or single environment variable
1023 <dt><a name=
"nixio.getgid"></a><strong>getgid
</strong> ()
</dt>
1026 (POSIX) Get the group id of the current process.
1034 <h3>Return value:
</h3>
1044 <dt><a name=
"nixio.getgr"></a><strong>getgr
</strong> (group)
</dt>
1047 (POSIX) Get all or a specific user group.
1054 group: Group ID or groupname (optional)
1064 <h3>Return value:
</h3>
1065 Table containing:
<ul>
1066 <li>name = Group Name
</li>
1067 <li>gid = Group ID
</li>
1068 <li>passwd = Password
</li>
1069 <li>mem = {Member #
1, Member #
2, ...}
</li>
1079 <dt><a name=
"nixio.getifaddrs"></a><strong>getifaddrs
</strong> ()
</dt>
1082 (Linux, BSD) Get a list of available network interfaces and their addresses.
1090 <h3>Return value:
</h3>
1091 Table containing one or more tables containing:
<ul>
1092 <li>name = Interface Name
</li>
1093 <li>family = [
"inet",
"inet6",
"packet"]
</li>
1094 <li>addr = Interface Address (IPv4, IPv6, MAC, ...)
</li>
1095 <li>broadaddr = Broadcast Address
</li>
1096 <li>dstaddr = Destination Address (Point-to-Point)
</li>
1097 <li>netmask = Netmask (if available)
</li>
1098 <li>prefix = Prefix (if available)
</li>
1099 <li>flags = Table of interface flags (up, multicast, loopback, ...)
</li>
1100 <li>data = Statistics (Linux,
"packet"-family)
</li>
1101 <li>hatype = Hardware Type Identifier (Linix,
"packet"-family)
</li>
1102 <li>ifindex = Interface Index (Linux,
"packet"-family)
</li>
1112 <dt><a name=
"nixio.getnameinfo"></a><strong>getnameinfo
</strong> (ipaddr)
</dt>
1115 Reverse look up an IP-Address via DNS.
1122 ipaddr: IPv4 or IPv6-Address
1132 <h3>Return value:
</h3>
1142 <dt><a name=
"nixio.getpid"></a><strong>getpid
</strong> ()
</dt>
1145 Get the ID of the current process.
1153 <h3>Return value:
</h3>
1163 <dt><a name=
"nixio.getppid"></a><strong>getppid
</strong> ()
</dt>
1166 (POSIX) Get the parent process id of the current process.
1174 <h3>Return value:
</h3>
1184 <dt><a name=
"nixio.getproto"></a><strong>getproto
</strong> (proto)
</dt>
1187 Get all or a specific proto entry.
1194 proto: protocol number or name to lookup (optional)
1204 <h3>Return value:
</h3>
1205 Table (or if no parameter is given, a table of tables)
1206 containing the following fields:
<ul>
1207 <li>name = Protocol Name
</li>
1208 <li>proto = Protocol Number
</li>
1209 <li>aliases = Table of alias names
</li>
1219 <dt><a name=
"nixio.getprotobyname"></a><strong>getprotobyname
</strong> (name)
</dt>
1222 Get protocol entry by name.
1229 name: protocol name to lookup
1238 This function returns nil if the given protocol is unknown.
1242 <h3>Return value:
</h3>
1243 Table containing the following fields:
<ul>
1244 <li>name = Protocol Name
</li>
1245 <li>proto = Protocol Number
</li>
1246 <li>aliases = Table of alias names
</li>
1256 <dt><a name=
"nixio.getprotobynumber"></a><strong>getprotobynumber
</strong> (proto)
</dt>
1259 Get protocol entry by number.
1266 proto: protocol number to lookup
1275 This function returns nil if the given protocol is unknown.
1279 <h3>Return value:
</h3>
1280 Table containing the following fields:
<ul>
1281 <li>name = Protocol Name
</li>
1282 <li>proto = Protocol Number
</li>
1283 <li>aliases = Table of alias names
</li>
1293 <dt><a name=
"nixio.getpw"></a><strong>getpw
</strong> (user)
</dt>
1296 (POSIX) Get all or a specific user account.
1303 user: User ID or username (optional)
1313 <h3>Return value:
</h3>
1314 Table containing:
<ul>
1315 <li>name = Name
</li>
1317 <li>gid = Group ID
</li>
1318 <li>passwd = Password
</li>
1319 <li>dir = Home directory
</li>
1320 <li>gecos = Information
</li>
1321 <li>shell = Shell
</li>
1331 <dt><a name=
"nixio.getsp"></a><strong>getsp
</strong> (user)
</dt>
1334 (Linux, Solaris) Get all or a specific shadow password entry.
1341 user: username (optional)
1351 <h3>Return value:
</h3>
1352 Table containing:
<ul>
1353 <li>namp = Name
</li>
1354 <li>expire = Expiration Date
</li>
1355 <li>flag = Flags
</li>
1356 <li>inact = Inactivity Date
</li>
1357 <li>lstchg = Last change
</li>
1358 <li>max = Maximum
</li>
1359 <li>min = Minimum
</li>
1360 <li>warn = Warning
</li>
1361 <li>pwdp = Password Hash
</li>
1371 <dt><a name=
"nixio.getuid"></a><strong>getuid
</strong> ()
</dt>
1374 (POSIX) Get the user id of the current process.
1382 <h3>Return value:
</h3>
1392 <dt><a name=
"nixio.kill"></a><strong>kill
</strong> (target, signal)
</dt>
1395 (POSIX) Send a signal to one or more processes.
1402 target: Target process of process group.
1406 signal: Signal to send
1416 <h3>Return value:
</h3>
1426 <dt><a name=
"nixio.nanosleep"></a><strong>nanosleep
</strong> (seconds, nanoseconds)
</dt>
1429 Sleep for a specified amount of time.
1436 seconds: Seconds to wait (optional)
1440 nanoseconds: Nanoseconds to wait (optional)
1451 <li>Not all systems support nanosecond precision but you can expect
1452 to have at least maillisecond precision.
1454 <li>This function is not signal-protected and may fail with EINTR.
1460 <h3>Return value:
</h3>
1470 <dt><a name=
"nixio.nice"></a><strong>nice
</strong> (nice)
</dt>
1473 (POSIX) Change priority of current process.
1490 <h3>Return value:
</h3>
1500 <dt><a name=
"nixio.open"></a><strong>open
</strong> (path, flags, mode)
</dt>
1510 path: Filesystem path to open
1514 flags: Flag string or number (see open_flags).
1515 [
<strong>"r"</strong>,
"r+",
"w",
"w+",
"a",
"a+"]
1519 mode: File mode for newly created files (see chmod, umask).
1528 Although this function also supports the traditional fopen()
1529 file flags it does not create a file stream but uses the open() syscall.
1533 <h3>Return value:
</h3>
1541 <li><a href=
"#nixio.umask">
1545 <li><a href=
"#nixio.open_flags">
1556 <dt><a name=
"nixio.open_flags"></a><strong>open_flags
</strong> (flag1, ...)
</dt>
1559 Generate flags for a call to open().
1566 flag1: First Flag [
"append",
"creat",
"excl",
"nonblock",
"ndelay",
1567 "sync",
"trunc",
"rdonly",
"wronly",
"rdwr"]
1571 ...: More Flags [-
"-]
1582 <li>This function cannot fail and will never return nil.
1584 <li>The "nonblock
" and "ndelay
" flags are aliases.
1586 <li>The "nonblock
", "ndelay
" and "sync
" flags are no-ops on Windows.
1592 <h3>Return value:</h3>
1593 flag to be used as second parameter to open
1602 <dt><a name="nixio.openlog
"></a><strong>openlog</strong> (ident, flag1, ...)</dt>
1605 (POSIX) Open a connection to the system logger.
1616 flag1: Flag 1 ["cons
", "nowait
", "pid
", "perror
", "ndelay
", "odelay
"]
1620 ...: More flags [-"-]
1637 <dt><a name=
"nixio.pipe"></a><strong>pipe
</strong> ()
</dt>
1648 <h3>Return values:
</h3>
1651 <li>File Object of the read end
1653 <li>File Object of the write end
1664 <dt><a name=
"nixio.poll"></a><strong>poll
</strong> (fds, timeout)
</dt>
1667 Wait for some event on a file descriptor.
1668 poll() sets the revents-field of the tables provided by fds to a bitfield
1669 indicating the events that occurred.
1676 fds: Table containing one or more tables containing
<ul>
1677 <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]
</li>
1678 <li> events = events to wait for (bitfield generated with poll_flags)
</li>
1683 timeout: Timeout in milliseconds
1694 <li>This function works in-place on the provided table and only
1695 writes the revents field, you can use other fields on your demand.
1697 <li>All metamethods on the tables provided as fds are ignored.
1699 <li>The revents-fields are not reset when the call times out.
1700 You have to check the first return value to be
0 to handle this case.
1702 <li>If you want to wait on a TLS-Socket you have to use the underlying
1705 <li>On Windows poll is emulated through select(), can only be used
1706 on socket descriptors and cannot take more than
64 descriptors per call.
1708 <li>This function is not signal-protected and may fail with EINTR.
1714 <h3>Return values:
</h3>
1717 <li>number of ready IO descriptors
1719 <li>the fds-table with revents-fields set
1728 <li><a href=
"#nixio.poll_flags">
1739 <dt><a name=
"nixio.poll_flags"></a><strong>poll_flags
</strong> (mode1, ...)
</dt>
1742 Generate events-bitfield or parse revents-bitfield for poll.
1749 mode1: revents-Flag bitfield returned from poll to parse OR
1750 [
"in",
"out",
"err",
"pri" (POSIX),
"hup" (POSIX),
"nval" (POSIX)]
1754 ...: More mode strings for generating the flag [-
"-]
1764 <h3>Return value:</h3>
1765 table with boolean fields reflecting the mode parameter
1766 <strong>OR</strong> bitfield to use for the events-Flag field
1773 <li><a href="#nixio.poll
">
1784 <dt><a name="nixio.sendfile
"></a><strong>sendfile</strong> (socket, file, length)</dt>
1787 (POSIX) Send data from a file to a socket in kernel-space.
1794 socket: Socket Object
1802 length: Amount of data to send (in Bytes).
1812 <h3>Return value:</h3>
1822 <dt><a name="nixio.setenv
"></a><strong>setenv</strong> (variable, value)</dt>
1825 Set or unset a environment variable.
1836 value: Value (optional)
1845 The environment variable will be unset if value is omitted.
1849 <h3>Return value:</h3>
1859 <dt><a name="nixio.setgid
"></a><strong>setgid</strong> (gid)</dt>
1862 (POSIX) Set the group id of the current process.
1879 <h3>Return value:</h3>
1889 <dt><a name="nixio.setlogmask
"></a><strong>setlogmask</strong> (priority)</dt>
1892 (POSIX) Set the logmask of the system logger for current process.
1899 priority: Priority ["emerg
", "alert
", "crit
", "err
", "warning
",
1900 "notice
", "info
", "debug
"]
1917 <dt><a name="nixio.setsid
"></a><strong>setsid</strong> ()</dt>
1920 (POSIX) Create a new session and set the process group ID.
1928 <h3>Return value:</h3>
1938 <dt><a name="nixio.setuid
"></a><strong>setuid</strong> (gid)</dt>
1941 (POSIX) Set the user id of the current process.
1958 <h3>Return value:</h3>
1968 <dt><a name="nixio.signal
"></a><strong>signal</strong> (signal, handler)</dt>
1971 Ignore or use set the default handler for a signal.
1982 handler: ["ign
", "dfl
"]
1992 <h3>Return value:</h3>
2002 <dt><a name="nixio.socket
"></a><strong>socket</strong> (domain, type)</dt>
2005 Create a new socket.
2012 domain: Domain ["inet
", "inet6
", "unix
"]
2016 type: Type ["stream
", "dgram
", "raw
"]
2026 <h3>Return value:</h3>
2036 <dt><a name="nixio.splice
"></a><strong>splice</strong> (fdin, fdout, length, flags)</dt>
2039 (Linux) Send data from / to a pipe in kernel-space.
2046 fdin: Input I/O descriptor
2050 fdout: Output I/O descriptor
2054 length: Amount of data to send (in Bytes).
2058 flags: (optional, bitfield generated by splice_flags)
2068 <h3>Return value:</h3>
2076 <li><a href="#nixio.splice_flags
">
2087 <dt><a name="nixio.splice_flags
"></a><strong>splice_flags</strong> (flag1, ...)</dt>
2090 (Linux) Generate a flag bitfield for a call to splice.
2097 flag1: First Flag ["move
", "nonblock
", "more
"]
2101 ...: More flags [-"-]
2111 <h3>Return value:
</h3>
2119 <li><a href=
"#nixio.splice">
2130 <dt><a name=
"nixio.strerror"></a><strong>strerror
</strong> (errno)
</dt>
2133 Get the error message for the corresponding error code.
2140 errno: System error code
2150 <h3>Return value:
</h3>
2160 <dt><a name=
"nixio.sysinfo"></a><strong>sysinfo
</strong> ()
</dt>
2163 (Linux) Get overall system statistics.
2171 <h3>Return value:
</h3>
2172 Table containing:
<ul>
2173 <li>uptime = system uptime in seconds
</li>
2174 <li>loads = {loadavg1, loadavg5, loadavg15}
</li>
2175 <li>totalram = total RAM
</li>
2176 <li>freeram = free RAM
</li>
2177 <li>sharedram = shared RAM
</li>
2178 <li>bufferram = buffered RAM
</li>
2179 <li>totalswap = total SWAP
</li>
2180 <li>freeswap = free SWAP
</li>
2181 <li>procs = number of running processes
</li>
2191 <dt><a name=
"nixio.syslog"></a><strong>syslog
</strong> (priority)
</dt>
2194 (POSIX) Write a message to the system logger.
2201 priority: Priority [
"emerg",
"alert",
"crit",
"err",
"warning",
2202 "notice",
"info",
"debug"]
2219 <dt><a name=
"nixio.times"></a><strong>times
</strong> ()
</dt>
2222 (POSIX) Get process times.
2230 <h3>Return value:
</h3>
2231 Table containing:
<ul>
2232 <li>utime = user time
</li>
2233 <li>utime = system time
</li>
2234 <li>cutime = children user time
</li>
2235 <li>cstime = children system time
</li>
2245 <dt><a name=
"nixio.tls"></a><strong>tls
</strong> (mode)
</dt>
2248 Create a new TLS context.
2255 mode: TLS-Mode [
"client",
"server"]
2265 <h3>Return value:
</h3>
2275 <dt><a name=
"nixio.umask"></a><strong>umask
</strong> (mask)
</dt>
2278 Sets the file mode creation mask.
2285 mask: New creation mask (see chmod for format specifications)
2295 <h3>Return values:
</h3>
2298 <li>the old umask as decimal mode number
2300 <li>the old umask as mode string
2311 <dt><a name=
"nixio.uname"></a><strong>uname
</strong> ()
</dt>
2314 (POSIX) Get information about current system and kernel.
2322 <h3>Return value:
</h3>
2323 Table containing:
<ul>
2324 <li>sysname = operating system
</li>
2325 <li>nodename = network name (usually hostname)
</li>
2326 <li>release = OS release
</li>
2327 <li>version = OS version
</li>
2328 <li>machine = hardware identifier
</li>
2338 <dt><a name=
"nixio.waitpid"></a><strong>waitpid
</strong> (pid, flag1, ...)
</dt>
2341 (POSIX) Wait for a process to change state.
2348 pid: Process ID (optional, default: any childprocess)
2352 flag1: Flag (optional) [
"nohang",
"untraced",
"continued"]
2356 ...: More Flags [-
"-]
2365 If the "nohang
" is given this function becomes non-blocking.
2369 <h3>Return values:</h3>
2372 <li>process id of child or 0 if no child has changed state
2374 <li>["exited
", "signaled
", "stopped
"]
2376 <li>[exit code, terminate signal, stop signal]
2391 </div> <!-- id="content
" -->
2393 </div> <!-- id="main
" -->
2396 <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>
2397 </div> <!-- id="about
" -->
2399 </div> <!-- id="container
" -->