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>
130 <a href=
"../modules/luci.xml.html">luci.xml
</a>
133 <li><strong>nixio
</strong></li>
136 <a href=
"../modules/nixio.CHANGELOG.html">nixio.CHANGELOG
</a>
140 <a href=
"../modules/nixio.CryptoHash.html">nixio.CryptoHash
</a>
144 <a href=
"../modules/nixio.File.html">nixio.File
</a>
148 <a href=
"../modules/nixio.README.html">nixio.README
</a>
152 <a href=
"../modules/nixio.Socket.html">nixio.Socket
</a>
156 <a href=
"../modules/nixio.TLSContext.html">nixio.TLSContext
</a>
160 <a href=
"../modules/nixio.TLSSocket.html">nixio.TLSSocket
</a>
164 <a href=
"../modules/nixio.UnifiedIO.html">nixio.UnifiedIO
</a>
168 <a href=
"../modules/nixio.bin.html">nixio.bin
</a>
172 <a href=
"../modules/nixio.bit.html">nixio.bit
</a>
176 <a href=
"../modules/nixio.crypto.html">nixio.crypto
</a>
180 <a href=
"../modules/nixio.fs.html">nixio.fs
</a>
195 </div><!-- id="navigation" -->
199 <h1>Class
<code>nixio
</code></h1>
202 General POSIX IO library.
</p>
211 <table class=
"function_list">
214 <td class=
"name" nowrap
><a href=
"#nixio.bind">bind
</a> (host, port, family, socktype)
</td>
216 Create a new socket and bind it to a network address.
</td>
220 <td class=
"name" nowrap
><a href=
"#nixio.chdir">chdir
</a> (path)
</td>
222 Change the working directory.
</td>
226 <td class=
"name" nowrap
><a href=
"#nixio.closelog">closelog
</a> ()
</td>
228 (POSIX) Close the connection to the system logger.
</td>
232 <td class=
"name" nowrap
><a href=
"#nixio.connect">connect
</a> (host, port, family, socktype)
</td>
234 Create a new socket and connect to a network address.
</td>
238 <td class=
"name" nowrap
><a href=
"#nixio.crypt">crypt
</a> (key, salt)
</td>
240 (POSIX) Encrypt a user password.
</td>
244 <td class=
"name" nowrap
><a href=
"#nixio.dup">dup
</a> (oldfd, newfd)
</td>
246 Duplicate a file descriptor.
</td>
250 <td class=
"name" nowrap
><a href=
"#nixio.errno">errno
</a> ()
</td>
252 Get the last system error code.
</td>
256 <td class=
"name" nowrap
><a href=
"#nixio.exec">exec
</a> (executable, ...)
</td>
258 Execute a file to replace the current process.
</td>
262 <td class=
"name" nowrap
><a href=
"#nixio.exece">exece
</a> (executable, arguments, environment)
</td>
264 Execute a file with a custom environment to replace the current process.
</td>
268 <td class=
"name" nowrap
><a href=
"#nixio.execp">execp
</a> (executable, ...)
</td>
270 Invoke the shell and execute a file to replace the current process.
</td>
274 <td class=
"name" nowrap
><a href=
"#nixio.fork">fork
</a> ()
</td>
276 (POSIX) Clone the current process.
</td>
280 <td class=
"name" nowrap
><a href=
"#nixio.getaddrinfo">getaddrinfo
</a> (host, family, service)
</td>
282 Look up a hostname and service via DNS.
</td>
286 <td class=
"name" nowrap
><a href=
"#nixio.getcwd">getcwd
</a> ()
</td>
288 Get the current working directory.
</td>
292 <td class=
"name" nowrap
><a href=
"#nixio.getenv">getenv
</a> (variable)
</td>
294 Get the current environment table or a specific environment variable.
</td>
298 <td class=
"name" nowrap
><a href=
"#nixio.getgid">getgid
</a> ()
</td>
300 (POSIX) Get the group id of the current process.
</td>
304 <td class=
"name" nowrap
><a href=
"#nixio.getgr">getgr
</a> (group)
</td>
306 (POSIX) Get all or a specific user group.
</td>
310 <td class=
"name" nowrap
><a href=
"#nixio.getifaddrs">getifaddrs
</a> ()
</td>
312 (Linux, BSD) Get a list of available network interfaces and their addresses.
</td>
316 <td class=
"name" nowrap
><a href=
"#nixio.getnameinfo">getnameinfo
</a> (ipaddr)
</td>
318 Reverse look up an IP-Address via DNS.
</td>
322 <td class=
"name" nowrap
><a href=
"#nixio.getpid">getpid
</a> ()
</td>
324 Get the ID of the current process.
</td>
328 <td class=
"name" nowrap
><a href=
"#nixio.getppid">getppid
</a> ()
</td>
330 (POSIX) Get the parent process id of the current process.
</td>
334 <td class=
"name" nowrap
><a href=
"#nixio.getproto">getproto
</a> (proto)
</td>
336 Get all or a specific proto entry.
</td>
340 <td class=
"name" nowrap
><a href=
"#nixio.getprotobyname">getprotobyname
</a> (name)
</td>
342 Get protocol entry by name.
</td>
346 <td class=
"name" nowrap
><a href=
"#nixio.getprotobynumber">getprotobynumber
</a> (proto)
</td>
348 Get protocol entry by number.
</td>
352 <td class=
"name" nowrap
><a href=
"#nixio.getpw">getpw
</a> (user)
</td>
354 (POSIX) Get all or a specific user account.
</td>
358 <td class=
"name" nowrap
><a href=
"#nixio.getsp">getsp
</a> (user)
</td>
360 (Linux, Solaris) Get all or a specific shadow password entry.
</td>
364 <td class=
"name" nowrap
><a href=
"#nixio.getuid">getuid
</a> ()
</td>
366 (POSIX) Get the user id of the current process.
</td>
370 <td class=
"name" nowrap
><a href=
"#nixio.kill">kill
</a> (target, signal)
</td>
372 (POSIX) Send a signal to one or more processes.
</td>
376 <td class=
"name" nowrap
><a href=
"#nixio.nanosleep">nanosleep
</a> (seconds, nanoseconds)
</td>
378 Sleep for a specified amount of time.
</td>
382 <td class=
"name" nowrap
><a href=
"#nixio.nice">nice
</a> (nice)
</td>
384 (POSIX) Change priority of current process.
</td>
388 <td class=
"name" nowrap
><a href=
"#nixio.open">open
</a> (path, flags, mode)
</td>
394 <td class=
"name" nowrap
><a href=
"#nixio.open_flags">open_flags
</a> (flag1, ...)
</td>
396 Generate flags for a call to open().
</td>
400 <td class=
"name" nowrap
><a href=
"#nixio.openlog">openlog
</a> (ident, flag1, ...)
</td>
402 (POSIX) Open a connection to the system logger.
</td>
406 <td class=
"name" nowrap
><a href=
"#nixio.pipe">pipe
</a> ()
</td>
412 <td class=
"name" nowrap
><a href=
"#nixio.poll">poll
</a> (fds, timeout)
</td>
414 Wait for some event on a file descriptor.
</td>
418 <td class=
"name" nowrap
><a href=
"#nixio.poll_flags">poll_flags
</a> (mode1, ...)
</td>
420 Generate events-bitfield or parse revents-bitfield for poll.
</td>
424 <td class=
"name" nowrap
><a href=
"#nixio.sendfile">sendfile
</a> (socket, file, length)
</td>
426 (POSIX) Send data from a file to a socket in kernel-space.
</td>
430 <td class=
"name" nowrap
><a href=
"#nixio.setenv">setenv
</a> (variable, value)
</td>
432 Set or unset a environment variable.
</td>
436 <td class=
"name" nowrap
><a href=
"#nixio.setgid">setgid
</a> (gid)
</td>
438 (POSIX) Set the group id of the current process.
</td>
442 <td class=
"name" nowrap
><a href=
"#nixio.setlogmask">setlogmask
</a> (priority)
</td>
444 (POSIX) Set the logmask of the system logger for current process.
</td>
448 <td class=
"name" nowrap
><a href=
"#nixio.setsid">setsid
</a> ()
</td>
450 (POSIX) Create a new session and set the process group ID.
</td>
454 <td class=
"name" nowrap
><a href=
"#nixio.setuid">setuid
</a> (gid)
</td>
456 (POSIX) Set the user id of the current process.
</td>
460 <td class=
"name" nowrap
><a href=
"#nixio.signal">signal
</a> (signal, handler)
</td>
462 Ignore or use set the default handler for a signal.
</td>
466 <td class=
"name" nowrap
><a href=
"#nixio.socket">socket
</a> (domain, type)
</td>
468 Create a new socket.
</td>
472 <td class=
"name" nowrap
><a href=
"#nixio.splice">splice
</a> (fdin, fdout, length, flags)
</td>
474 (Linux) Send data from / to a pipe in kernel-space.
</td>
478 <td class=
"name" nowrap
><a href=
"#nixio.splice_flags">splice_flags
</a> (flag1, ...)
</td>
480 (Linux) Generate a flag bitfield for a call to splice.
</td>
484 <td class=
"name" nowrap
><a href=
"#nixio.strerror">strerror
</a> (errno)
</td>
486 Get the error message for the corresponding error code.
</td>
490 <td class=
"name" nowrap
><a href=
"#nixio.sysinfo">sysinfo
</a> ()
</td>
492 (Linux) Get overall system statistics.
</td>
496 <td class=
"name" nowrap
><a href=
"#nixio.syslog">syslog
</a> (priority)
</td>
498 (POSIX) Write a message to the system logger.
</td>
502 <td class=
"name" nowrap
><a href=
"#nixio.times">times
</a> ()
</td>
504 (POSIX) Get process times.
</td>
508 <td class=
"name" nowrap
><a href=
"#nixio.tls">tls
</a> (mode)
</td>
510 Create a new TLS context.
</td>
514 <td class=
"name" nowrap
><a href=
"#nixio.umask">umask
</a> (mask)
</td>
516 Sets the file mode creation mask.
</td>
520 <td class=
"name" nowrap
><a href=
"#nixio.uname">uname
</a> ()
</td>
522 (POSIX) Get information about current system and kernel.
</td>
526 <td class=
"name" nowrap
><a href=
"#nixio.waitpid">waitpid
</a> (pid, flag1, ...)
</td>
528 (POSIX) Wait for a process to change state.
</td>
542 <h2><a name=
"functions"></a>Functions
</h2>
543 <dl class=
"function">
547 <dt><a name=
"nixio.bind"></a><strong>bind
</strong> (host, port, family, socktype)
</dt>
550 Create a new socket and bind it to a network address.
551 This function is a shortcut for calling nixio.socket and then bind()
552 on the socket object.
559 host: Hostname or IP-Address (optional, default: all addresses)
563 port: Port or service description
567 family: Address family [
<strong>"any"</strong>,
"inet",
"inet6"]
571 socktype: Socket Type [
<strong>"stream"</strong>,
"dgram"]
582 <li>This functions calls getaddrinfo(), socket(),
583 setsockopt() and bind() but NOT listen().
585 <li>The
<em>reuseaddr
</em>-option is automatically set before binding.
591 <h3>Return value:
</h3>
601 <dt><a name=
"nixio.chdir"></a><strong>chdir
</strong> (path)
</dt>
604 Change the working directory.
611 path: New working directory
621 <h3>Return value:
</h3>
631 <dt><a name=
"nixio.closelog"></a><strong>closelog
</strong> ()
</dt>
634 (POSIX) Close the connection to the system logger.
649 <dt><a name=
"nixio.connect"></a><strong>connect
</strong> (host, port, family, socktype)
</dt>
652 Create a new socket and connect to a network address.
653 This function is a shortcut for calling nixio.socket and then connect()
654 on the socket object.
661 host: Hostname or IP-Address (optional, default: localhost)
665 port: Port or service description
669 family: Address family [
<strong>"any"</strong>,
"inet",
"inet6"]
673 socktype: Socket Type [
<strong>"stream"</strong>,
"dgram"]
682 This functions calls getaddrinfo(), socket() and connect().
686 <h3>Return value:
</h3>
696 <dt><a name=
"nixio.crypt"></a><strong>crypt
</strong> (key, salt)
</dt>
699 (POSIX) Encrypt a user password.
720 <h3>Return value:
</h3>
730 <dt><a name=
"nixio.dup"></a><strong>dup
</strong> (oldfd, newfd)
</dt>
733 Duplicate a file descriptor.
740 oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
744 newfd: New descriptor to serve as copy (optional)
753 This funcation calls dup2() if
<em>newfd
</em> is set, otherwise dup().
757 <h3>Return value:
</h3>
758 File Object of new descriptor
767 <dt><a name=
"nixio.errno"></a><strong>errno
</strong> ()
</dt>
770 Get the last system error code.
778 <h3>Return value:
</h3>
788 <dt><a name=
"nixio.exec"></a><strong>exec
</strong> (executable, ...)
</dt>
791 Execute a file to replace the current process.
798 executable: Executable
813 <li>The name of the executable is automatically passed as argv[
0]
815 <li>This function does not return on success.
828 <dt><a name=
"nixio.exece"></a><strong>exece
</strong> (executable, arguments, environment)
</dt>
831 Execute a file with a custom environment to replace the current process.
838 executable: Executable
842 arguments: Argument Table
846 environment: Environment Table (optional)
857 <li>The name of the executable is automatically passed as argv[
0]
859 <li>This function does not return on success.
872 <dt><a name=
"nixio.execp"></a><strong>execp
</strong> (executable, ...)
</dt>
875 Invoke the shell and execute a file to replace the current process.
882 executable: Executable
897 <li>The name of the executable is automatically passed as argv[
0]
899 <li>This function does not return on success.
912 <dt><a name=
"nixio.fork"></a><strong>fork
</strong> ()
</dt>
915 (POSIX) Clone the current process.
923 <h3>Return value:
</h3>
924 the child process id for the parent process,
0 for the child process
933 <dt><a name=
"nixio.getaddrinfo"></a><strong>getaddrinfo
</strong> (host, family, service)
</dt>
936 Look up a hostname and service via DNS.
943 host: hostname to lookup (optional)
947 family: address family [
<strong>"any"</strong>,
"inet",
"inet6"]
951 service: service name or port (optional)
961 <h3>Return value:
</h3>
962 Table containing one or more tables containing:
<ul>
963 <li>family = [
"inet",
"inet6"]
</li>
964 <li>socktype = [
"stream",
"dgram",
"raw"]
</li>
965 <li>address = Resolved IP-Address
</li>
966 <li>port = Resolved Port (if service was given)
</li>
976 <dt><a name=
"nixio.getcwd"></a><strong>getcwd
</strong> ()
</dt>
979 Get the current working directory.
987 <h3>Return value:
</h3>
997 <dt><a name=
"nixio.getenv"></a><strong>getenv
</strong> (variable)
</dt>
1000 Get the current environment table or a specific environment variable.
1007 variable: Variable (optional)
1017 <h3>Return value:
</h3>
1018 environment table or single environment variable
1027 <dt><a name=
"nixio.getgid"></a><strong>getgid
</strong> ()
</dt>
1030 (POSIX) Get the group id of the current process.
1038 <h3>Return value:
</h3>
1048 <dt><a name=
"nixio.getgr"></a><strong>getgr
</strong> (group)
</dt>
1051 (POSIX) Get all or a specific user group.
1058 group: Group ID or groupname (optional)
1068 <h3>Return value:
</h3>
1069 Table containing:
<ul>
1070 <li>name = Group Name
</li>
1071 <li>gid = Group ID
</li>
1072 <li>passwd = Password
</li>
1073 <li>mem = {Member #
1, Member #
2, ...}
</li>
1083 <dt><a name=
"nixio.getifaddrs"></a><strong>getifaddrs
</strong> ()
</dt>
1086 (Linux, BSD) Get a list of available network interfaces and their addresses.
1094 <h3>Return value:
</h3>
1095 Table containing one or more tables containing:
<ul>
1096 <li>name = Interface Name
</li>
1097 <li>family = [
"inet",
"inet6",
"packet"]
</li>
1098 <li>addr = Interface Address (IPv4, IPv6, MAC, ...)
</li>
1099 <li>broadaddr = Broadcast Address
</li>
1100 <li>dstaddr = Destination Address (Point-to-Point)
</li>
1101 <li>netmask = Netmask (if available)
</li>
1102 <li>prefix = Prefix (if available)
</li>
1103 <li>flags = Table of interface flags (up, multicast, loopback, ...)
</li>
1104 <li>data = Statistics (Linux,
"packet"-family)
</li>
1105 <li>hatype = Hardware Type Identifier (Linix,
"packet"-family)
</li>
1106 <li>ifindex = Interface Index (Linux,
"packet"-family)
</li>
1116 <dt><a name=
"nixio.getnameinfo"></a><strong>getnameinfo
</strong> (ipaddr)
</dt>
1119 Reverse look up an IP-Address via DNS.
1126 ipaddr: IPv4 or IPv6-Address
1136 <h3>Return value:
</h3>
1146 <dt><a name=
"nixio.getpid"></a><strong>getpid
</strong> ()
</dt>
1149 Get the ID of the current process.
1157 <h3>Return value:
</h3>
1167 <dt><a name=
"nixio.getppid"></a><strong>getppid
</strong> ()
</dt>
1170 (POSIX) Get the parent process id of the current process.
1178 <h3>Return value:
</h3>
1188 <dt><a name=
"nixio.getproto"></a><strong>getproto
</strong> (proto)
</dt>
1191 Get all or a specific proto entry.
1198 proto: protocol number or name to lookup (optional)
1208 <h3>Return value:
</h3>
1209 Table (or if no parameter is given, a table of tables)
1210 containing the following fields:
<ul>
1211 <li>name = Protocol Name
</li>
1212 <li>proto = Protocol Number
</li>
1213 <li>aliases = Table of alias names
</li>
1223 <dt><a name=
"nixio.getprotobyname"></a><strong>getprotobyname
</strong> (name)
</dt>
1226 Get protocol entry by name.
1233 name: protocol name to lookup
1242 This function returns nil if the given protocol is unknown.
1246 <h3>Return value:
</h3>
1247 Table containing the following fields:
<ul>
1248 <li>name = Protocol Name
</li>
1249 <li>proto = Protocol Number
</li>
1250 <li>aliases = Table of alias names
</li>
1260 <dt><a name=
"nixio.getprotobynumber"></a><strong>getprotobynumber
</strong> (proto)
</dt>
1263 Get protocol entry by number.
1270 proto: protocol number to lookup
1279 This function returns nil if the given protocol is unknown.
1283 <h3>Return value:
</h3>
1284 Table containing the following fields:
<ul>
1285 <li>name = Protocol Name
</li>
1286 <li>proto = Protocol Number
</li>
1287 <li>aliases = Table of alias names
</li>
1297 <dt><a name=
"nixio.getpw"></a><strong>getpw
</strong> (user)
</dt>
1300 (POSIX) Get all or a specific user account.
1307 user: User ID or username (optional)
1317 <h3>Return value:
</h3>
1318 Table containing:
<ul>
1319 <li>name = Name
</li>
1321 <li>gid = Group ID
</li>
1322 <li>passwd = Password
</li>
1323 <li>dir = Home directory
</li>
1324 <li>gecos = Information
</li>
1325 <li>shell = Shell
</li>
1335 <dt><a name=
"nixio.getsp"></a><strong>getsp
</strong> (user)
</dt>
1338 (Linux, Solaris) Get all or a specific shadow password entry.
1345 user: username (optional)
1355 <h3>Return value:
</h3>
1356 Table containing:
<ul>
1357 <li>namp = Name
</li>
1358 <li>expire = Expiration Date
</li>
1359 <li>flag = Flags
</li>
1360 <li>inact = Inactivity Date
</li>
1361 <li>lstchg = Last change
</li>
1362 <li>max = Maximum
</li>
1363 <li>min = Minimum
</li>
1364 <li>warn = Warning
</li>
1365 <li>pwdp = Password Hash
</li>
1375 <dt><a name=
"nixio.getuid"></a><strong>getuid
</strong> ()
</dt>
1378 (POSIX) Get the user id of the current process.
1386 <h3>Return value:
</h3>
1396 <dt><a name=
"nixio.kill"></a><strong>kill
</strong> (target, signal)
</dt>
1399 (POSIX) Send a signal to one or more processes.
1406 target: Target process of process group.
1410 signal: Signal to send
1420 <h3>Return value:
</h3>
1430 <dt><a name=
"nixio.nanosleep"></a><strong>nanosleep
</strong> (seconds, nanoseconds)
</dt>
1433 Sleep for a specified amount of time.
1440 seconds: Seconds to wait (optional)
1444 nanoseconds: Nanoseconds to wait (optional)
1455 <li>Not all systems support nanosecond precision but you can expect
1456 to have at least maillisecond precision.
1458 <li>This function is not signal-protected and may fail with EINTR.
1464 <h3>Return value:
</h3>
1474 <dt><a name=
"nixio.nice"></a><strong>nice
</strong> (nice)
</dt>
1477 (POSIX) Change priority of current process.
1494 <h3>Return value:
</h3>
1504 <dt><a name=
"nixio.open"></a><strong>open
</strong> (path, flags, mode)
</dt>
1514 path: Filesystem path to open
1518 flags: Flag string or number (see open_flags).
1519 [
<strong>"r"</strong>,
"r+",
"w",
"w+",
"a",
"a+"]
1523 mode: File mode for newly created files (see chmod, umask).
1532 Although this function also supports the traditional fopen()
1533 file flags it does not create a file stream but uses the open() syscall.
1537 <h3>Return value:
</h3>
1545 <li><a href=
"#nixio.umask">
1549 <li><a href=
"#nixio.open_flags">
1560 <dt><a name=
"nixio.open_flags"></a><strong>open_flags
</strong> (flag1, ...)
</dt>
1563 Generate flags for a call to open().
1570 flag1: First Flag [
"append",
"creat",
"excl",
"nonblock",
"ndelay",
1571 "sync",
"trunc",
"rdonly",
"wronly",
"rdwr"]
1575 ...: More Flags [-
"-]
1586 <li>This function cannot fail and will never return nil.
1588 <li>The "nonblock
" and "ndelay
" flags are aliases.
1590 <li>The "nonblock
", "ndelay
" and "sync
" flags are no-ops on Windows.
1596 <h3>Return value:</h3>
1597 flag to be used as second parameter to open
1606 <dt><a name="nixio.openlog
"></a><strong>openlog</strong> (ident, flag1, ...)</dt>
1609 (POSIX) Open a connection to the system logger.
1620 flag1: Flag 1 ["cons
", "nowait
", "pid
", "perror
", "ndelay
", "odelay
"]
1624 ...: More flags [-"-]
1641 <dt><a name=
"nixio.pipe"></a><strong>pipe
</strong> ()
</dt>
1652 <h3>Return values:
</h3>
1655 <li>File Object of the read end
1657 <li>File Object of the write end
1668 <dt><a name=
"nixio.poll"></a><strong>poll
</strong> (fds, timeout)
</dt>
1671 Wait for some event on a file descriptor.
1672 poll() sets the revents-field of the tables provided by fds to a bitfield
1673 indicating the events that occurred.
1680 fds: Table containing one or more tables containing
<ul>
1681 <li> fd = I/O Descriptor [Socket Object, File Object (POSIX)]
</li>
1682 <li> events = events to wait for (bitfield generated with poll_flags)
</li>
1687 timeout: Timeout in milliseconds
1698 <li>This function works in-place on the provided table and only
1699 writes the revents field, you can use other fields on your demand.
1701 <li>All metamethods on the tables provided as fds are ignored.
1703 <li>The revents-fields are not reset when the call times out.
1704 You have to check the first return value to be
0 to handle this case.
1706 <li>If you want to wait on a TLS-Socket you have to use the underlying
1709 <li>On Windows poll is emulated through select(), can only be used
1710 on socket descriptors and cannot take more than
64 descriptors per call.
1712 <li>This function is not signal-protected and may fail with EINTR.
1718 <h3>Return values:
</h3>
1721 <li>number of ready IO descriptors
1723 <li>the fds-table with revents-fields set
1732 <li><a href=
"#nixio.poll_flags">
1743 <dt><a name=
"nixio.poll_flags"></a><strong>poll_flags
</strong> (mode1, ...)
</dt>
1746 Generate events-bitfield or parse revents-bitfield for poll.
1753 mode1: revents-Flag bitfield returned from poll to parse OR
1754 [
"in",
"out",
"err",
"pri" (POSIX),
"hup" (POSIX),
"nval" (POSIX)]
1758 ...: More mode strings for generating the flag [-
"-]
1768 <h3>Return value:</h3>
1769 table with boolean fields reflecting the mode parameter
1770 <strong>OR</strong> bitfield to use for the events-Flag field
1777 <li><a href="#nixio.poll
">
1788 <dt><a name="nixio.sendfile
"></a><strong>sendfile</strong> (socket, file, length)</dt>
1791 (POSIX) Send data from a file to a socket in kernel-space.
1798 socket: Socket Object
1806 length: Amount of data to send (in Bytes).
1816 <h3>Return value:</h3>
1826 <dt><a name="nixio.setenv
"></a><strong>setenv</strong> (variable, value)</dt>
1829 Set or unset a environment variable.
1840 value: Value (optional)
1849 The environment variable will be unset if value is omitted.
1853 <h3>Return value:</h3>
1863 <dt><a name="nixio.setgid
"></a><strong>setgid</strong> (gid)</dt>
1866 (POSIX) Set the group id of the current process.
1883 <h3>Return value:</h3>
1893 <dt><a name="nixio.setlogmask
"></a><strong>setlogmask</strong> (priority)</dt>
1896 (POSIX) Set the logmask of the system logger for current process.
1903 priority: Priority ["emerg
", "alert
", "crit
", "err
", "warning
",
1904 "notice
", "info
", "debug
"]
1921 <dt><a name="nixio.setsid
"></a><strong>setsid</strong> ()</dt>
1924 (POSIX) Create a new session and set the process group ID.
1932 <h3>Return value:</h3>
1942 <dt><a name="nixio.setuid
"></a><strong>setuid</strong> (gid)</dt>
1945 (POSIX) Set the user id of the current process.
1962 <h3>Return value:</h3>
1972 <dt><a name="nixio.signal
"></a><strong>signal</strong> (signal, handler)</dt>
1975 Ignore or use set the default handler for a signal.
1986 handler: ["ign
", "dfl
"]
1996 <h3>Return value:</h3>
2006 <dt><a name="nixio.socket
"></a><strong>socket</strong> (domain, type)</dt>
2009 Create a new socket.
2016 domain: Domain ["inet
", "inet6
", "unix
"]
2020 type: Type ["stream
", "dgram
", "raw
"]
2030 <h3>Return value:</h3>
2040 <dt><a name="nixio.splice
"></a><strong>splice</strong> (fdin, fdout, length, flags)</dt>
2043 (Linux) Send data from / to a pipe in kernel-space.
2050 fdin: Input I/O descriptor
2054 fdout: Output I/O descriptor
2058 length: Amount of data to send (in Bytes).
2062 flags: (optional, bitfield generated by splice_flags)
2072 <h3>Return value:</h3>
2080 <li><a href="#nixio.splice_flags
">
2091 <dt><a name="nixio.splice_flags
"></a><strong>splice_flags</strong> (flag1, ...)</dt>
2094 (Linux) Generate a flag bitfield for a call to splice.
2101 flag1: First Flag ["move
", "nonblock
", "more
"]
2105 ...: More flags [-"-]
2115 <h3>Return value:
</h3>
2123 <li><a href=
"#nixio.splice">
2134 <dt><a name=
"nixio.strerror"></a><strong>strerror
</strong> (errno)
</dt>
2137 Get the error message for the corresponding error code.
2144 errno: System error code
2154 <h3>Return value:
</h3>
2164 <dt><a name=
"nixio.sysinfo"></a><strong>sysinfo
</strong> ()
</dt>
2167 (Linux) Get overall system statistics.
2175 <h3>Return value:
</h3>
2176 Table containing:
<ul>
2177 <li>uptime = system uptime in seconds
</li>
2178 <li>loads = {loadavg1, loadavg5, loadavg15}
</li>
2179 <li>totalram = total RAM
</li>
2180 <li>freeram = free RAM
</li>
2181 <li>sharedram = shared RAM
</li>
2182 <li>bufferram = buffered RAM
</li>
2183 <li>totalswap = total SWAP
</li>
2184 <li>freeswap = free SWAP
</li>
2185 <li>procs = number of running processes
</li>
2195 <dt><a name=
"nixio.syslog"></a><strong>syslog
</strong> (priority)
</dt>
2198 (POSIX) Write a message to the system logger.
2205 priority: Priority [
"emerg",
"alert",
"crit",
"err",
"warning",
2206 "notice",
"info",
"debug"]
2223 <dt><a name=
"nixio.times"></a><strong>times
</strong> ()
</dt>
2226 (POSIX) Get process times.
2234 <h3>Return value:
</h3>
2235 Table containing:
<ul>
2236 <li>utime = user time
</li>
2237 <li>utime = system time
</li>
2238 <li>cutime = children user time
</li>
2239 <li>cstime = children system time
</li>
2249 <dt><a name=
"nixio.tls"></a><strong>tls
</strong> (mode)
</dt>
2252 Create a new TLS context.
2259 mode: TLS-Mode [
"client",
"server"]
2269 <h3>Return value:
</h3>
2279 <dt><a name=
"nixio.umask"></a><strong>umask
</strong> (mask)
</dt>
2282 Sets the file mode creation mask.
2289 mask: New creation mask (see chmod for format specifications)
2299 <h3>Return values:
</h3>
2302 <li>the old umask as decimal mode number
2304 <li>the old umask as mode string
2315 <dt><a name=
"nixio.uname"></a><strong>uname
</strong> ()
</dt>
2318 (POSIX) Get information about current system and kernel.
2326 <h3>Return value:
</h3>
2327 Table containing:
<ul>
2328 <li>sysname = operating system
</li>
2329 <li>nodename = network name (usually hostname)
</li>
2330 <li>release = OS release
</li>
2331 <li>version = OS version
</li>
2332 <li>machine = hardware identifier
</li>
2342 <dt><a name=
"nixio.waitpid"></a><strong>waitpid
</strong> (pid, flag1, ...)
</dt>
2345 (POSIX) Wait for a process to change state.
2352 pid: Process ID (optional, default: any childprocess)
2356 flag1: Flag (optional) [
"nohang",
"untraced",
"continued"]
2360 ...: More Flags [-
"-]
2369 If the "nohang
" is given this function becomes non-blocking.
2373 <h3>Return values:</h3>
2376 <li>process id of child or 0 if no child has changed state
2378 <li>["exited
", "signaled
", "stopped
"]
2380 <li>[exit code, terminate signal, stop signal]
2395 </div> <!-- id="content
" -->
2397 </div> <!-- id="main
" -->
2400 <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>
2401 </div> <!-- id="about
" -->
2403 </div> <!-- id="container
" -->