Merge pull request #656 from nlhintz/pull-request
[project/luci.git] / documentation / api / modules / nixio.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html>
4 <head>
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"/-->
8 </head>
9
10 <body>
11 <div id="container">
12
13 <div id="product">
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" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li>
38                 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39         </li>
40
41         <li>
42                 <a href="../modules/luci.http.html">luci.http</a>
43         </li>
44
45         <li>
46                 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
47         </li>
48
49         <li>
50                 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
51         </li>
52
53         <li>
54                 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
55         </li>
56
57         <li>
58                 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
59         </li>
60
61         <li>
62                 <a href="../modules/luci.i18n.html">luci.i18n</a>
63         </li>
64
65         <li>
66                 <a href="../modules/luci.ip.html">luci.ip</a>
67         </li>
68
69         <li>
70                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
71         </li>
72
73         <li>
74                 <a href="../modules/luci.json.html">luci.json</a>
75         </li>
76
77         <li>
78                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
79         </li>
80
81         <li>
82                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
83         </li>
84
85         <li>
86                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
87         </li>
88
89         <li>
90                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
91         </li>
92
93         <li>
94                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
95         </li>
96
97         <li>
98                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
99         </li>
100
101         <li>
102                 <a href="../modules/luci.sys.html">luci.sys</a>
103         </li>
104
105         <li>
106                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
107         </li>
108
109         <li>
110                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
111         </li>
112
113         <li>
114                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
115         </li>
116
117         <li>
118                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
119         </li>
120
121         <li>
122                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
123         </li>
124
125         <li>
126                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
127         </li>
128
129         <li>
130                 <a href="../modules/luci.util.html">luci.util</a>
131         </li>
132
133         <li><strong>nixio</strong></li>
134         
135         <li>
136                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
137         </li>
138
139         <li>
140                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
141         </li>
142
143         <li>
144                 <a href="../modules/nixio.File.html">nixio.File</a>
145         </li>
146
147         <li>
148                 <a href="../modules/nixio.README.html">nixio.README</a>
149         </li>
150
151         <li>
152                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
153         </li>
154
155         <li>
156                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
157         </li>
158
159         <li>
160                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
161         </li>
162
163         <li>
164                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
165         </li>
166
167         <li>
168                 <a href="../modules/nixio.bin.html">nixio.bin</a>
169         </li>
170
171         <li>
172                 <a href="../modules/nixio.bit.html">nixio.bit</a>
173         </li>
174
175         <li>
176                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
177         </li>
178
179         <li>
180                 <a href="../modules/nixio.fs.html">nixio.fs</a>
181         </li>
182
183 </ul>
184
185
186
187 <!-- File list -->
188
189
190
191
192
193
194
195 </div><!-- id="navigation" -->
196
197 <div id="content">
198
199 <h1>Class <code>nixio</code></h1>
200
201 <p>
202  General POSIX IO library.</p>
203
204
205
206
207
208
209
210 <h2>Functions</h2>
211 <table class="function_list">
212
213         <tr>
214         <td class="name" nowrap><a href="#nixio.bind">bind</a>&nbsp;(host, port, family, socktype)</td>
215         <td class="summary">
216  Create a new socket and bind it to a network address.</td>
217         </tr>
218
219         <tr>
220         <td class="name" nowrap><a href="#nixio.chdir">chdir</a>&nbsp;(path)</td>
221         <td class="summary">
222  Change the working directory.</td>
223         </tr>
224
225         <tr>
226         <td class="name" nowrap><a href="#nixio.closelog">closelog</a>&nbsp;()</td>
227         <td class="summary">
228  (POSIX) Close the connection to the system logger.</td>
229         </tr>
230
231         <tr>
232         <td class="name" nowrap><a href="#nixio.connect">connect</a>&nbsp;(host, port, family, socktype)</td>
233         <td class="summary">
234  Create a new socket and connect to a network address.</td>
235         </tr>
236
237         <tr>
238         <td class="name" nowrap><a href="#nixio.crypt">crypt</a>&nbsp;(key, salt)</td>
239         <td class="summary">
240  (POSIX) Encrypt a user password.</td>
241         </tr>
242
243         <tr>
244         <td class="name" nowrap><a href="#nixio.dup">dup</a>&nbsp;(oldfd, newfd)</td>
245         <td class="summary">
246  Duplicate a file descriptor.</td>
247         </tr>
248
249         <tr>
250         <td class="name" nowrap><a href="#nixio.errno">errno</a>&nbsp;()</td>
251         <td class="summary">
252  Get the last system error code.</td>
253         </tr>
254
255         <tr>
256         <td class="name" nowrap><a href="#nixio.exec">exec</a>&nbsp;(executable, ...)</td>
257         <td class="summary">
258  Execute a file to replace the current process.</td>
259         </tr>
260
261         <tr>
262         <td class="name" nowrap><a href="#nixio.exece">exece</a>&nbsp;(executable, arguments, environment)</td>
263         <td class="summary">
264  Execute a file with a custom environment to replace the current process.</td>
265         </tr>
266
267         <tr>
268         <td class="name" nowrap><a href="#nixio.execp">execp</a>&nbsp;(executable, ...)</td>
269         <td class="summary">
270  Invoke the shell and execute a file to replace the current process.</td>
271         </tr>
272
273         <tr>
274         <td class="name" nowrap><a href="#nixio.fork">fork</a>&nbsp;()</td>
275         <td class="summary">
276  (POSIX) Clone the current process.</td>
277         </tr>
278
279         <tr>
280         <td class="name" nowrap><a href="#nixio.getaddrinfo">getaddrinfo</a>&nbsp;(host, family, service)</td>
281         <td class="summary">
282  Look up a hostname and service via DNS.</td>
283         </tr>
284
285         <tr>
286         <td class="name" nowrap><a href="#nixio.getcwd">getcwd</a>&nbsp;()</td>
287         <td class="summary">
288  Get the current working directory.</td>
289         </tr>
290
291         <tr>
292         <td class="name" nowrap><a href="#nixio.getenv">getenv</a>&nbsp;(variable)</td>
293         <td class="summary">
294  Get the current environment table or a specific environment variable.</td>
295         </tr>
296
297         <tr>
298         <td class="name" nowrap><a href="#nixio.getgid">getgid</a>&nbsp;()</td>
299         <td class="summary">
300  (POSIX) Get the group id of the current process.</td>
301         </tr>
302
303         <tr>
304         <td class="name" nowrap><a href="#nixio.getgr">getgr</a>&nbsp;(group)</td>
305         <td class="summary">
306  (POSIX) Get all or a specific user group.</td>
307         </tr>
308
309         <tr>
310         <td class="name" nowrap><a href="#nixio.getifaddrs">getifaddrs</a>&nbsp;()</td>
311         <td class="summary">
312  (Linux, BSD) Get a list of available network interfaces and their addresses.</td>
313         </tr>
314
315         <tr>
316         <td class="name" nowrap><a href="#nixio.getnameinfo">getnameinfo</a>&nbsp;(ipaddr)</td>
317         <td class="summary">
318  Reverse look up an IP-Address via DNS.</td>
319         </tr>
320
321         <tr>
322         <td class="name" nowrap><a href="#nixio.getpid">getpid</a>&nbsp;()</td>
323         <td class="summary">
324  Get the ID of the current process.</td>
325         </tr>
326
327         <tr>
328         <td class="name" nowrap><a href="#nixio.getppid">getppid</a>&nbsp;()</td>
329         <td class="summary">
330  (POSIX) Get the parent process id of the current process.</td>
331         </tr>
332
333         <tr>
334         <td class="name" nowrap><a href="#nixio.getproto">getproto</a>&nbsp;(proto)</td>
335         <td class="summary">
336  Get all or a specifc proto entry.</td>
337         </tr>
338
339         <tr>
340         <td class="name" nowrap><a href="#nixio.getprotobyname">getprotobyname</a>&nbsp;(name)</td>
341         <td class="summary">
342  Get protocol entry by name.</td>
343         </tr>
344
345         <tr>
346         <td class="name" nowrap><a href="#nixio.getprotobynumber">getprotobynumber</a>&nbsp;(proto)</td>
347         <td class="summary">
348  Get protocol entry by number.</td>
349         </tr>
350
351         <tr>
352         <td class="name" nowrap><a href="#nixio.getpw">getpw</a>&nbsp;(user)</td>
353         <td class="summary">
354  (POSIX) Get all or a specific user account.</td>
355         </tr>
356
357         <tr>
358         <td class="name" nowrap><a href="#nixio.getsp">getsp</a>&nbsp;(user)</td>
359         <td class="summary">
360  (Linux, Solaris) Get all or a specific shadow password entry.</td>
361         </tr>
362
363         <tr>
364         <td class="name" nowrap><a href="#nixio.getuid">getuid</a>&nbsp;()</td>
365         <td class="summary">
366  (POSIX) Get the user id of the current process.</td>
367         </tr>
368
369         <tr>
370         <td class="name" nowrap><a href="#nixio.kill">kill</a>&nbsp;(target, signal)</td>
371         <td class="summary">
372  (POSIX) Send a signal to one or more processes.</td>
373         </tr>
374
375         <tr>
376         <td class="name" nowrap><a href="#nixio.nanosleep">nanosleep</a>&nbsp;(seconds, nanoseconds)</td>
377         <td class="summary">
378  Sleep for a specified amount of time.</td>
379         </tr>
380
381         <tr>
382         <td class="name" nowrap><a href="#nixio.nice">nice</a>&nbsp;(nice)</td>
383         <td class="summary">
384  (POSIX) Change priority of current process.</td>
385         </tr>
386
387         <tr>
388         <td class="name" nowrap><a href="#nixio.open">open</a>&nbsp;(path, flags, mode)</td>
389         <td class="summary">
390  Open a file.</td>
391         </tr>
392
393         <tr>
394         <td class="name" nowrap><a href="#nixio.open_flags">open_flags</a>&nbsp;(flag1, ...)</td>
395         <td class="summary">
396  Generate flags for a call to open().</td>
397         </tr>
398
399         <tr>
400         <td class="name" nowrap><a href="#nixio.openlog">openlog</a>&nbsp;(ident, flag1, ...)</td>
401         <td class="summary">
402  (POSIX) Open a connection to the system logger.</td>
403         </tr>
404
405         <tr>
406         <td class="name" nowrap><a href="#nixio.pipe">pipe</a>&nbsp;()</td>
407         <td class="summary">
408  Create a pipe.</td>
409         </tr>
410
411         <tr>
412         <td class="name" nowrap><a href="#nixio.poll">poll</a>&nbsp;(fds, timeout)</td>
413         <td class="summary">
414  Wait for some event on a file descriptor.</td>
415         </tr>
416
417         <tr>
418         <td class="name" nowrap><a href="#nixio.poll_flags">poll_flags</a>&nbsp;(mode1, ...)</td>
419         <td class="summary">
420  Generate events-bitfield or parse revents-bitfield for poll.</td>
421         </tr>
422
423         <tr>
424         <td class="name" nowrap><a href="#nixio.sendfile">sendfile</a>&nbsp;(socket, file, length)</td>
425         <td class="summary">
426  (POSIX) Send data from a file to a socket in kernel-space.</td>
427         </tr>
428
429         <tr>
430         <td class="name" nowrap><a href="#nixio.setenv">setenv</a>&nbsp;(variable, value)</td>
431         <td class="summary">
432  Set or unset a environment variable.</td>
433         </tr>
434
435         <tr>
436         <td class="name" nowrap><a href="#nixio.setgid">setgid</a>&nbsp;(gid)</td>
437         <td class="summary">
438  (POSIX) Set the group id of the current process.</td>
439         </tr>
440
441         <tr>
442         <td class="name" nowrap><a href="#nixio.setlogmask">setlogmask</a>&nbsp;(priority)</td>
443         <td class="summary">
444  (POSIX) Set the logmask of the system logger for current process.</td>
445         </tr>
446
447         <tr>
448         <td class="name" nowrap><a href="#nixio.setsid">setsid</a>&nbsp;()</td>
449         <td class="summary">
450  (POSIX) Create a new session and set the process group ID.</td>
451         </tr>
452
453         <tr>
454         <td class="name" nowrap><a href="#nixio.setuid">setuid</a>&nbsp;(gid)</td>
455         <td class="summary">
456  (POSIX) Set the user id of the current process.</td>
457         </tr>
458
459         <tr>
460         <td class="name" nowrap><a href="#nixio.signal">signal</a>&nbsp;(signal, handler)</td>
461         <td class="summary">
462  Ignore or use set the default handler for a signal.</td>
463         </tr>
464
465         <tr>
466         <td class="name" nowrap><a href="#nixio.socket">socket</a>&nbsp;(domain, type)</td>
467         <td class="summary">
468  Create a new socket.</td>
469         </tr>
470
471         <tr>
472         <td class="name" nowrap><a href="#nixio.splice">splice</a>&nbsp;(fdin, fdout, length, flags)</td>
473         <td class="summary">
474  (Linux) Send data from / to a pipe in kernel-space.</td>
475         </tr>
476
477         <tr>
478         <td class="name" nowrap><a href="#nixio.splice_flags">splice_flags</a>&nbsp;(flag1, ...)</td>
479         <td class="summary">
480  (Linux) Generate a flag bitfield for a call to splice.</td>
481         </tr>
482
483         <tr>
484         <td class="name" nowrap><a href="#nixio.strerror">strerror</a>&nbsp;(errno)</td>
485         <td class="summary">
486  Get the error message for the corresponding error code.</td>
487         </tr>
488
489         <tr>
490         <td class="name" nowrap><a href="#nixio.sysinfo">sysinfo</a>&nbsp;()</td>
491         <td class="summary">
492  (Linux) Get overall system statistics.</td>
493         </tr>
494
495         <tr>
496         <td class="name" nowrap><a href="#nixio.syslog">syslog</a>&nbsp;(priority)</td>
497         <td class="summary">
498  (POSIX) Write a message to the system logger.</td>
499         </tr>
500
501         <tr>
502         <td class="name" nowrap><a href="#nixio.times">times</a>&nbsp;()</td>
503         <td class="summary">
504  (POSIX) Get process times.</td>
505         </tr>
506
507         <tr>
508         <td class="name" nowrap><a href="#nixio.tls">tls</a>&nbsp;(mode)</td>
509         <td class="summary">
510  Create a new TLS context.</td>
511         </tr>
512
513         <tr>
514         <td class="name" nowrap><a href="#nixio.umask">umask</a>&nbsp;(mask)</td>
515         <td class="summary">
516  Sets the file mode creation mask.</td>
517         </tr>
518
519         <tr>
520         <td class="name" nowrap><a href="#nixio.uname">uname</a>&nbsp;()</td>
521         <td class="summary">
522  (POSIX) Get information about current system and kernel.</td>
523         </tr>
524
525         <tr>
526         <td class="name" nowrap><a href="#nixio.waitpid">waitpid</a>&nbsp;(pid, flag1, ...)</td>
527         <td class="summary">
528  (POSIX) Wait for a process to change state.</td>
529         </tr>
530
531 </table>
532
533
534
535
536
537
538 <br/>
539 <br/>
540
541
542 <h2><a name="functions"></a>Functions</h2>
543 <dl class="function">
544
545
546
547 <dt><a name="nixio.bind"></a><strong>bind</strong>&nbsp;(host, port, family, socktype)</dt>
548 <dd>
549
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.
553
554
555 <h3>Parameters</h3>
556 <ul>
557         
558         <li>
559           host: Hostname or IP-Address (optional, default: all addresses)
560         </li>
561         
562         <li>
563           port: Port or service description
564         </li>
565         
566         <li>
567           family: Address family [<strong>"any"</strong>, "inet", "inet6"]
568         </li>
569         
570         <li>
571           socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
572         </li>
573         
574 </ul>
575
576
577
578
579 <h3>Usage</h3>
580 <ul>
581         
582         <li>This functions calls getaddrinfo(), socket(), 
583  setsockopt() and bind() but NOT listen().
584         
585         <li>The <em>reuseaddr</em>-option is automatically set before binding.
586         
587 </ul>
588
589
590
591 <h3>Return value:</h3>
592 Socket Object
593
594
595
596 </dd>
597
598
599
600
601 <dt><a name="nixio.chdir"></a><strong>chdir</strong>&nbsp;(path)</dt>
602 <dd>
603
604  Change the working directory.
605
606
607 <h3>Parameters</h3>
608 <ul>
609         
610         <li>
611           path: New working directory
612         </li>
613         
614 </ul>
615
616
617
618
619
620
621 <h3>Return value:</h3>
622 true
623
624
625
626 </dd>
627
628
629
630
631 <dt><a name="nixio.closelog"></a><strong>closelog</strong>&nbsp;()</dt>
632 <dd>
633
634  (POSIX) Close the connection to the system logger.
635
636
637
638
639
640
641
642
643
644 </dd>
645
646
647
648
649 <dt><a name="nixio.connect"></a><strong>connect</strong>&nbsp;(host, port, family, socktype)</dt>
650 <dd>
651
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.
655
656
657 <h3>Parameters</h3>
658 <ul>
659         
660         <li>
661           host: Hostname or IP-Address (optional, default: localhost)
662         </li>
663         
664         <li>
665           port: Port or service description
666         </li>
667         
668         <li>
669           family: Address family [<strong>"any"</strong>, "inet", "inet6"]
670         </li>
671         
672         <li>
673           socktype: Socket Type [<strong>"stream"</strong>, "dgram"]
674         </li>
675         
676 </ul>
677
678
679
680
681 <h3>Usage:</h3>
682 This functions calls getaddrinfo(), socket() and connect().
683
684
685
686 <h3>Return value:</h3>
687 Socket Object
688
689
690
691 </dd>
692
693
694
695
696 <dt><a name="nixio.crypt"></a><strong>crypt</strong>&nbsp;(key, salt)</dt>
697 <dd>
698
699  (POSIX) Encrypt a user password.
700
701
702 <h3>Parameters</h3>
703 <ul>
704         
705         <li>
706           key: Key
707         </li>
708         
709         <li>
710           salt: Salt
711         </li>
712         
713 </ul>
714
715
716
717
718
719
720 <h3>Return value:</h3>
721 password hash
722
723
724
725 </dd>
726
727
728
729
730 <dt><a name="nixio.dup"></a><strong>dup</strong>&nbsp;(oldfd, newfd)</dt>
731 <dd>
732
733  Duplicate a file descriptor.
734
735
736 <h3>Parameters</h3>
737 <ul>
738         
739         <li>
740           oldfd: Old descriptor [File Object, Socket Object (POSIX only)]
741         </li>
742         
743         <li>
744           newfd: New descriptor to serve as copy (optional)
745         </li>
746         
747 </ul>
748
749
750
751
752 <h3>Usage:</h3>
753 This funcation calls dup2() if <em>newfd</em> is set, otherwise dup().
754
755
756
757 <h3>Return value:</h3>
758 File Object of new descriptor
759
760
761
762 </dd>
763
764
765
766
767 <dt><a name="nixio.errno"></a><strong>errno</strong>&nbsp;()</dt>
768 <dd>
769
770  Get the last system error code.
771
772
773
774
775
776
777
778 <h3>Return value:</h3>
779 Error code
780
781
782
783 </dd>
784
785
786
787
788 <dt><a name="nixio.exec"></a><strong>exec</strong>&nbsp;(executable, ...)</dt>
789 <dd>
790
791  Execute a file to replace the current process.
792
793
794 <h3>Parameters</h3>
795 <ul>
796         
797         <li>
798           executable: Executable
799         </li>
800         
801         <li>
802           ...: Parameters
803         </li>
804         
805 </ul>
806
807
808
809
810 <h3>Usage</h3>
811 <ul>
812         
813         <li>The name of the executable is automatically passed as argv[0]
814         
815         <li>This function does not return on success.
816         
817 </ul>
818
819
820
821
822
823 </dd>
824
825
826
827
828 <dt><a name="nixio.exece"></a><strong>exece</strong>&nbsp;(executable, arguments, environment)</dt>
829 <dd>
830
831  Execute a file with a custom environment to replace the current process.
832
833
834 <h3>Parameters</h3>
835 <ul>
836         
837         <li>
838           executable: Executable
839         </li>
840         
841         <li>
842           arguments: Argument Table
843         </li>
844         
845         <li>
846           environment: Environment Table (optional)
847         </li>
848         
849 </ul>
850
851
852
853
854 <h3>Usage</h3>
855 <ul>
856         
857         <li>The name of the executable is automatically passed as argv[0]
858         
859         <li>This function does not return on success.
860         
861 </ul>
862
863
864
865
866
867 </dd>
868
869
870
871
872 <dt><a name="nixio.execp"></a><strong>execp</strong>&nbsp;(executable, ...)</dt>
873 <dd>
874
875  Invoke the shell and execute a file to replace the current process.
876
877
878 <h3>Parameters</h3>
879 <ul>
880         
881         <li>
882           executable: Executable
883         </li>
884         
885         <li>
886           ...: Parameters
887         </li>
888         
889 </ul>
890
891
892
893
894 <h3>Usage</h3>
895 <ul>
896         
897         <li>The name of the executable is automatically passed as argv[0]
898         
899         <li>This function does not return on success.
900         
901 </ul>
902
903
904
905
906
907 </dd>
908
909
910
911
912 <dt><a name="nixio.fork"></a><strong>fork</strong>&nbsp;()</dt>
913 <dd>
914
915  (POSIX) Clone the current process.
916
917
918
919
920
921
922
923 <h3>Return value:</h3>
924 the child process id for the parent process, 0 for the child process
925
926
927
928 </dd>
929
930
931
932
933 <dt><a name="nixio.getaddrinfo"></a><strong>getaddrinfo</strong>&nbsp;(host, family, service)</dt>
934 <dd>
935
936  Look up a hostname and service via DNS.
937
938
939 <h3>Parameters</h3>
940 <ul>
941         
942         <li>
943           host: hostname to lookup      (optional)
944         </li>
945         
946         <li>
947           family: address family [<strong>"any"</strong>, "inet", "inet6"]  
948         </li>
949         
950         <li>
951           service: service name or port (optional)
952         </li>
953         
954 </ul>
955
956
957
958
959
960
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> 
967  </ul>
968
969
970
971 </dd>
972
973
974
975
976 <dt><a name="nixio.getcwd"></a><strong>getcwd</strong>&nbsp;()</dt>
977 <dd>
978
979  Get the current working directory.
980
981
982
983
984
985
986
987 <h3>Return value:</h3>
988 workign directory
989
990
991
992 </dd>
993
994
995
996
997 <dt><a name="nixio.getenv"></a><strong>getenv</strong>&nbsp;(variable)</dt>
998 <dd>
999
1000  Get the current environment table or a specific environment variable.
1001
1002
1003 <h3>Parameters</h3>
1004 <ul>
1005         
1006         <li>
1007           variable: Variable (optional)
1008         </li>
1009         
1010 </ul>
1011
1012
1013
1014
1015
1016
1017 <h3>Return value:</h3>
1018 environment table or single environment variable
1019
1020
1021
1022 </dd>
1023
1024
1025
1026
1027 <dt><a name="nixio.getgid"></a><strong>getgid</strong>&nbsp;()</dt>
1028 <dd>
1029
1030  (POSIX) Get the group id of the current process.
1031
1032
1033
1034
1035
1036
1037
1038 <h3>Return value:</h3>
1039 process group id
1040
1041
1042
1043 </dd>
1044
1045
1046
1047
1048 <dt><a name="nixio.getgr"></a><strong>getgr</strong>&nbsp;(group)</dt>
1049 <dd>
1050
1051  (POSIX) Get all or a specific user group.
1052
1053
1054 <h3>Parameters</h3>
1055 <ul>
1056         
1057         <li>
1058           group: Group ID or groupname (optional)
1059         </li>
1060         
1061 </ul>
1062
1063
1064
1065
1066
1067
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> 
1074  </ul>
1075
1076
1077
1078 </dd>
1079
1080
1081
1082
1083 <dt><a name="nixio.getifaddrs"></a><strong>getifaddrs</strong>&nbsp;()</dt>
1084 <dd>
1085
1086  (Linux, BSD) Get a list of available network interfaces and their addresses.
1087
1088
1089
1090
1091
1092
1093
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> 
1107  </ul>
1108
1109
1110
1111 </dd>
1112
1113
1114
1115
1116 <dt><a name="nixio.getnameinfo"></a><strong>getnameinfo</strong>&nbsp;(ipaddr)</dt>
1117 <dd>
1118
1119  Reverse look up an IP-Address via DNS.
1120
1121
1122 <h3>Parameters</h3>
1123 <ul>
1124         
1125         <li>
1126           ipaddr: IPv4 or IPv6-Address
1127         </li>
1128         
1129 </ul>
1130
1131
1132
1133
1134
1135
1136 <h3>Return value:</h3>
1137 FQDN
1138
1139
1140
1141 </dd>
1142
1143
1144
1145
1146 <dt><a name="nixio.getpid"></a><strong>getpid</strong>&nbsp;()</dt>
1147 <dd>
1148
1149  Get the ID of the current process.
1150
1151
1152
1153
1154
1155
1156
1157 <h3>Return value:</h3>
1158 process id
1159
1160
1161
1162 </dd>
1163
1164
1165
1166
1167 <dt><a name="nixio.getppid"></a><strong>getppid</strong>&nbsp;()</dt>
1168 <dd>
1169
1170  (POSIX) Get the parent process id of the current process.
1171
1172
1173
1174
1175
1176
1177
1178 <h3>Return value:</h3>
1179 parent process id
1180
1181
1182
1183 </dd>
1184
1185
1186
1187
1188 <dt><a name="nixio.getproto"></a><strong>getproto</strong>&nbsp;(proto)</dt>
1189 <dd>
1190
1191  Get all or a specifc proto entry.
1192
1193
1194 <h3>Parameters</h3>
1195 <ul>
1196         
1197         <li>
1198           proto: protocol number or name to lookup (optional)
1199         </li>
1200         
1201 </ul>
1202
1203
1204
1205
1206
1207
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> 
1214  </ul>
1215
1216
1217
1218 </dd>
1219
1220
1221
1222
1223 <dt><a name="nixio.getprotobyname"></a><strong>getprotobyname</strong>&nbsp;(name)</dt>
1224 <dd>
1225
1226  Get protocol entry by name.
1227
1228
1229 <h3>Parameters</h3>
1230 <ul>
1231         
1232         <li>
1233           name: protocol name to lookup
1234         </li>
1235         
1236 </ul>
1237
1238
1239
1240
1241 <h3>Usage:</h3>
1242 This function returns nil if the given protocol is unknown.
1243
1244
1245
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> 
1251  </ul>
1252
1253
1254
1255 </dd>
1256
1257
1258
1259
1260 <dt><a name="nixio.getprotobynumber"></a><strong>getprotobynumber</strong>&nbsp;(proto)</dt>
1261 <dd>
1262
1263  Get protocol entry by number.
1264
1265
1266 <h3>Parameters</h3>
1267 <ul>
1268         
1269         <li>
1270           proto: protocol number to lookup
1271         </li>
1272         
1273 </ul>
1274
1275
1276
1277
1278 <h3>Usage:</h3>
1279 This function returns nil if the given protocol is unknown.
1280
1281
1282
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> 
1288  </ul>
1289
1290
1291
1292 </dd>
1293
1294
1295
1296
1297 <dt><a name="nixio.getpw"></a><strong>getpw</strong>&nbsp;(user)</dt>
1298 <dd>
1299
1300  (POSIX) Get all or a specific user account.
1301
1302
1303 <h3>Parameters</h3>
1304 <ul>
1305         
1306         <li>
1307           user: User ID or username (optional)
1308         </li>
1309         
1310 </ul>
1311
1312
1313
1314
1315
1316
1317 <h3>Return value:</h3>
1318 Table containing: <ul> 
1319  <li>name = Name</li> 
1320  <li>uid = ID</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> 
1326  </ul>
1327
1328
1329
1330 </dd>
1331
1332
1333
1334
1335 <dt><a name="nixio.getsp"></a><strong>getsp</strong>&nbsp;(user)</dt>
1336 <dd>
1337
1338  (Linux, Solaris) Get all or a specific shadow password entry.
1339
1340
1341 <h3>Parameters</h3>
1342 <ul>
1343         
1344         <li>
1345           user: username (optional)
1346         </li>
1347         
1348 </ul>
1349
1350
1351
1352
1353
1354
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> 
1366  </ul>
1367
1368
1369
1370 </dd>
1371
1372
1373
1374
1375 <dt><a name="nixio.getuid"></a><strong>getuid</strong>&nbsp;()</dt>
1376 <dd>
1377
1378  (POSIX) Get the user id of the current process.
1379
1380
1381
1382
1383
1384
1385
1386 <h3>Return value:</h3>
1387 process user id
1388
1389
1390
1391 </dd>
1392
1393
1394
1395
1396 <dt><a name="nixio.kill"></a><strong>kill</strong>&nbsp;(target, signal)</dt>
1397 <dd>
1398
1399  (POSIX) Send a signal to one or more processes.
1400
1401
1402 <h3>Parameters</h3>
1403 <ul>
1404         
1405         <li>
1406           target: Target process of process group.
1407         </li>
1408         
1409         <li>
1410           signal: Signal to send
1411         </li>
1412         
1413 </ul>
1414
1415
1416
1417
1418
1419
1420 <h3>Return value:</h3>
1421 true
1422
1423
1424
1425 </dd>
1426
1427
1428
1429
1430 <dt><a name="nixio.nanosleep"></a><strong>nanosleep</strong>&nbsp;(seconds, nanoseconds)</dt>
1431 <dd>
1432
1433  Sleep for a specified amount of time.
1434
1435
1436 <h3>Parameters</h3>
1437 <ul>
1438         
1439         <li>
1440           seconds: Seconds to wait (optional)
1441         </li>
1442         
1443         <li>
1444           nanoseconds: Nanoseconds to wait (optional)
1445         </li>
1446         
1447 </ul>
1448
1449
1450
1451
1452 <h3>Usage</h3>
1453 <ul>
1454         
1455         <li>Not all systems support nanosecond precision but you can expect 
1456  to have at least maillisecond precision.
1457         
1458         <li>This function is not signal-protected and may fail with EINTR.
1459         
1460 </ul>
1461
1462
1463
1464 <h3>Return value:</h3>
1465 true
1466
1467
1468
1469 </dd>
1470
1471
1472
1473
1474 <dt><a name="nixio.nice"></a><strong>nice</strong>&nbsp;(nice)</dt>
1475 <dd>
1476
1477  (POSIX) Change priority of current process.
1478
1479
1480 <h3>Parameters</h3>
1481 <ul>
1482         
1483         <li>
1484           nice: Nice Value
1485         </li>
1486         
1487 </ul>
1488
1489
1490
1491
1492
1493
1494 <h3>Return value:</h3>
1495 true
1496
1497
1498
1499 </dd>
1500
1501
1502
1503
1504 <dt><a name="nixio.open"></a><strong>open</strong>&nbsp;(path, flags, mode)</dt>
1505 <dd>
1506
1507  Open a file.
1508
1509
1510 <h3>Parameters</h3>
1511 <ul>
1512         
1513         <li>
1514           path: Filesystem path to open
1515         </li>
1516         
1517         <li>
1518           flags: Flag string or number (see open_flags). 
1519  [<strong>"r"</strong>, "r+", "w", "w+", "a", "a+"]
1520         </li>
1521         
1522         <li>
1523           mode: File mode for newly created files (see chmod, umask).
1524         </li>
1525         
1526 </ul>
1527
1528
1529
1530
1531 <h3>Usage:</h3>
1532 Although this function also supports the traditional fopen()  
1533  file flags it does not create a file stream but uses the open() syscall.
1534
1535
1536
1537 <h3>Return value:</h3>
1538 File Object
1539
1540
1541
1542 <h3>See also:</h3>
1543 <ul>
1544         
1545         <li><a href="#nixio.umask">
1546                 umask
1547         </a>
1548         
1549         <li><a href="#nixio.open_flags">
1550                 open_flags
1551         </a>
1552         
1553 </ul>
1554
1555 </dd>
1556
1557
1558
1559
1560 <dt><a name="nixio.open_flags"></a><strong>open_flags</strong>&nbsp;(flag1, ...)</dt>
1561 <dd>
1562
1563  Generate flags for a call to open().
1564
1565
1566 <h3>Parameters</h3>
1567 <ul>
1568         
1569         <li>
1570           flag1: First Flag ["append", "creat", "excl", "nonblock", "ndelay", 
1571  "sync", "trunc", "rdonly", "wronly", "rdwr"]
1572         </li>
1573         
1574         <li>
1575           ...: More Flags [-"-]
1576         </li>
1577         
1578 </ul>
1579
1580
1581
1582
1583 <h3>Usage</h3>
1584 <ul>
1585         
1586         <li>This function cannot fail and will never return nil.
1587         
1588         <li>The "nonblock" and "ndelay" flags are aliases.
1589         
1590         <li>The "nonblock", "ndelay" and "sync" flags are no-ops on Windows.
1591         
1592 </ul>
1593
1594
1595
1596 <h3>Return value:</h3>
1597 flag to be used as second parameter to open
1598
1599
1600
1601 </dd>
1602
1603
1604
1605
1606 <dt><a name="nixio.openlog"></a><strong>openlog</strong>&nbsp;(ident, flag1, ...)</dt>
1607 <dd>
1608
1609  (POSIX) Open a connection to the system logger.
1610
1611
1612 <h3>Parameters</h3>
1613 <ul>
1614         
1615         <li>
1616           ident: Identifier
1617         </li>
1618         
1619         <li>
1620           flag1: Flag 1 ["cons", "nowait", "pid", "perror", "ndelay", "odelay"]
1621         </li>
1622         
1623         <li>
1624           ...: More flags [-"-]
1625         </li>
1626         
1627 </ul>
1628
1629
1630
1631
1632
1633
1634
1635
1636 </dd>
1637
1638
1639
1640
1641 <dt><a name="nixio.pipe"></a><strong>pipe</strong>&nbsp;()</dt>
1642 <dd>
1643
1644  Create a pipe.
1645
1646
1647
1648
1649
1650
1651
1652 <h3>Return values:</h3>
1653 <ol>
1654         
1655         <li>File Object of the read end
1656         
1657         <li>File Object of the write end
1658         
1659 </ol>
1660
1661
1662
1663 </dd>
1664
1665
1666
1667
1668 <dt><a name="nixio.poll"></a><strong>poll</strong>&nbsp;(fds, timeout)</dt>
1669 <dd>
1670
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.
1674
1675
1676 <h3>Parameters</h3>
1677 <ul>
1678         
1679         <li>
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> 
1683  </ul>
1684         </li>
1685         
1686         <li>
1687           timeout: Timeout in milliseconds
1688         </li>
1689         
1690 </ul>
1691
1692
1693
1694
1695 <h3>Usage</h3>
1696 <ul>
1697         
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.
1700         
1701         <li>All metamethods on the tables provided as fds are ignored.
1702         
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.
1705         
1706         <li>If you want to wait on a TLS-Socket you have to use the underlying 
1707  socket instead.
1708         
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.
1711         
1712         <li>This function is not signal-protected and may fail with EINTR.
1713         
1714 </ul>
1715
1716
1717
1718 <h3>Return values:</h3>
1719 <ol>
1720         
1721         <li>number of ready IO descriptors
1722         
1723         <li>the fds-table with revents-fields set
1724         
1725 </ol>
1726
1727
1728
1729 <h3>See also:</h3>
1730 <ul>
1731         
1732         <li><a href="#nixio.poll_flags">
1733                 poll_flags
1734         </a>
1735         
1736 </ul>
1737
1738 </dd>
1739
1740
1741
1742
1743 <dt><a name="nixio.poll_flags"></a><strong>poll_flags</strong>&nbsp;(mode1, ...)</dt>
1744 <dd>
1745
1746  Generate events-bitfield or parse revents-bitfield for poll.
1747
1748
1749 <h3>Parameters</h3>
1750 <ul>
1751         
1752         <li>
1753           mode1: revents-Flag bitfield returned from poll to parse OR  
1754  ["in", "out", "err", "pri" (POSIX), "hup" (POSIX), "nval" (POSIX)]
1755         </li>
1756         
1757         <li>
1758           ...: More mode strings for generating the flag [-"-]
1759         </li>
1760         
1761 </ul>
1762
1763
1764
1765
1766
1767
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
1771
1772
1773
1774 <h3>See also:</h3>
1775 <ul>
1776         
1777         <li><a href="#nixio.poll">
1778                 poll
1779         </a>
1780         
1781 </ul>
1782
1783 </dd>
1784
1785
1786
1787
1788 <dt><a name="nixio.sendfile"></a><strong>sendfile</strong>&nbsp;(socket, file, length)</dt>
1789 <dd>
1790
1791  (POSIX) Send data from a file to a socket in kernel-space.
1792
1793
1794 <h3>Parameters</h3>
1795 <ul>
1796         
1797         <li>
1798           socket: Socket Object
1799         </li>
1800         
1801         <li>
1802           file: File Object
1803         </li>
1804         
1805         <li>
1806           length: Amount of data to send (in Bytes).
1807         </li>
1808         
1809 </ul>
1810
1811
1812
1813
1814
1815
1816 <h3>Return value:</h3>
1817 bytes sent
1818
1819
1820
1821 </dd>
1822
1823
1824
1825
1826 <dt><a name="nixio.setenv"></a><strong>setenv</strong>&nbsp;(variable, value)</dt>
1827 <dd>
1828
1829  Set or unset a environment variable.
1830
1831
1832 <h3>Parameters</h3>
1833 <ul>
1834         
1835         <li>
1836           variable: Variable
1837         </li>
1838         
1839         <li>
1840           value: Value (optional)
1841         </li>
1842         
1843 </ul>
1844
1845
1846
1847
1848 <h3>Usage:</h3>
1849 The environment variable will be unset if value is omitted.
1850
1851
1852
1853 <h3>Return value:</h3>
1854 true
1855
1856
1857
1858 </dd>
1859
1860
1861
1862
1863 <dt><a name="nixio.setgid"></a><strong>setgid</strong>&nbsp;(gid)</dt>
1864 <dd>
1865
1866  (POSIX) Set the group id of the current process.
1867
1868
1869 <h3>Parameters</h3>
1870 <ul>
1871         
1872         <li>
1873           gid: New Group ID
1874         </li>
1875         
1876 </ul>
1877
1878
1879
1880
1881
1882
1883 <h3>Return value:</h3>
1884 true
1885
1886
1887
1888 </dd>
1889
1890
1891
1892
1893 <dt><a name="nixio.setlogmask"></a><strong>setlogmask</strong>&nbsp;(priority)</dt>
1894 <dd>
1895
1896  (POSIX) Set the logmask of the system logger for current process.
1897
1898
1899 <h3>Parameters</h3>
1900 <ul>
1901         
1902         <li>
1903           priority: Priority ["emerg", "alert", "crit", "err", "warning", 
1904  "notice", "info", "debug"]
1905         </li>
1906         
1907 </ul>
1908
1909
1910
1911
1912
1913
1914
1915
1916 </dd>
1917
1918
1919
1920
1921 <dt><a name="nixio.setsid"></a><strong>setsid</strong>&nbsp;()</dt>
1922 <dd>
1923
1924  (POSIX) Create a new session and set the process group ID.
1925
1926
1927
1928
1929
1930
1931
1932 <h3>Return value:</h3>
1933 session id
1934
1935
1936
1937 </dd>
1938
1939
1940
1941
1942 <dt><a name="nixio.setuid"></a><strong>setuid</strong>&nbsp;(gid)</dt>
1943 <dd>
1944
1945  (POSIX) Set the user id of the current process.
1946
1947
1948 <h3>Parameters</h3>
1949 <ul>
1950         
1951         <li>
1952           gid: New User ID
1953         </li>
1954         
1955 </ul>
1956
1957
1958
1959
1960
1961
1962 <h3>Return value:</h3>
1963 true
1964
1965
1966
1967 </dd>
1968
1969
1970
1971
1972 <dt><a name="nixio.signal"></a><strong>signal</strong>&nbsp;(signal, handler)</dt>
1973 <dd>
1974
1975  Ignore or use set the default handler for a signal.
1976
1977
1978 <h3>Parameters</h3>
1979 <ul>
1980         
1981         <li>
1982           signal: Signal
1983         </li>
1984         
1985         <li>
1986           handler: ["ign", "dfl"]
1987         </li>
1988         
1989 </ul>
1990
1991
1992
1993
1994
1995
1996 <h3>Return value:</h3>
1997 true
1998
1999
2000
2001 </dd>
2002
2003
2004
2005
2006 <dt><a name="nixio.socket"></a><strong>socket</strong>&nbsp;(domain, type)</dt>
2007 <dd>
2008
2009  Create a new socket.
2010
2011
2012 <h3>Parameters</h3>
2013 <ul>
2014         
2015         <li>
2016           domain: Domain ["inet", "inet6", "unix"]
2017         </li>
2018         
2019         <li>
2020           type: Type   ["stream", "dgram", "raw"]
2021         </li>
2022         
2023 </ul>
2024
2025
2026
2027
2028
2029
2030 <h3>Return value:</h3>
2031 Socket Object
2032
2033
2034
2035 </dd>
2036
2037
2038
2039
2040 <dt><a name="nixio.splice"></a><strong>splice</strong>&nbsp;(fdin, fdout, length, flags)</dt>
2041 <dd>
2042
2043  (Linux) Send data from / to a pipe in kernel-space.
2044
2045
2046 <h3>Parameters</h3>
2047 <ul>
2048         
2049         <li>
2050           fdin: Input I/O descriptor 
2051         </li>
2052         
2053         <li>
2054           fdout: Output I/O descriptor
2055         </li>
2056         
2057         <li>
2058           length: Amount of data to send (in Bytes).
2059         </li>
2060         
2061         <li>
2062           flags: (optional, bitfield generated by splice_flags)
2063         </li>
2064         
2065 </ul>
2066
2067
2068
2069
2070
2071
2072 <h3>Return value:</h3>
2073 bytes sent
2074
2075
2076
2077 <h3>See also:</h3>
2078 <ul>
2079         
2080         <li><a href="#nixio.splice_flags">
2081                 splice_flags
2082         </a>
2083         
2084 </ul>
2085
2086 </dd>
2087
2088
2089
2090
2091 <dt><a name="nixio.splice_flags"></a><strong>splice_flags</strong>&nbsp;(flag1, ...)</dt>
2092 <dd>
2093
2094  (Linux) Generate a flag bitfield for a call to splice.
2095
2096
2097 <h3>Parameters</h3>
2098 <ul>
2099         
2100         <li>
2101           flag1: First Flag     ["move", "nonblock", "more"]
2102         </li>
2103         
2104         <li>
2105           ...: More flags       [-"-]
2106         </li>
2107         
2108 </ul>
2109
2110
2111
2112
2113
2114
2115 <h3>Return value:</h3>
2116 Flag bitfield
2117
2118
2119
2120 <h3>See also:</h3>
2121 <ul>
2122         
2123         <li><a href="#nixio.splice">
2124                 splice
2125         </a>
2126         
2127 </ul>
2128
2129 </dd>
2130
2131
2132
2133
2134 <dt><a name="nixio.strerror"></a><strong>strerror</strong>&nbsp;(errno)</dt>
2135 <dd>
2136
2137  Get the error message for the corresponding error code.
2138
2139
2140 <h3>Parameters</h3>
2141 <ul>
2142         
2143         <li>
2144           errno: System error code
2145         </li>
2146         
2147 </ul>
2148
2149
2150
2151
2152
2153
2154 <h3>Return value:</h3>
2155 Error message
2156
2157
2158
2159 </dd>
2160
2161
2162
2163
2164 <dt><a name="nixio.sysinfo"></a><strong>sysinfo</strong>&nbsp;()</dt>
2165 <dd>
2166
2167  (Linux) Get overall system statistics.
2168
2169
2170
2171
2172
2173
2174
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> 
2186  </ul>
2187
2188
2189
2190 </dd>
2191
2192
2193
2194
2195 <dt><a name="nixio.syslog"></a><strong>syslog</strong>&nbsp;(priority)</dt>
2196 <dd>
2197
2198  (POSIX) Write a message to the system logger.
2199
2200
2201 <h3>Parameters</h3>
2202 <ul>
2203         
2204         <li>
2205           priority: Priority ["emerg", "alert", "crit", "err", "warning", 
2206  "notice", "info", "debug"]
2207         </li>
2208         
2209 </ul>
2210
2211
2212
2213
2214
2215
2216
2217
2218 </dd>
2219
2220
2221
2222
2223 <dt><a name="nixio.times"></a><strong>times</strong>&nbsp;()</dt>
2224 <dd>
2225
2226  (POSIX) Get process times.
2227
2228
2229
2230
2231
2232
2233
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> 
2240  </ul>
2241
2242
2243
2244 </dd>
2245
2246
2247
2248
2249 <dt><a name="nixio.tls"></a><strong>tls</strong>&nbsp;(mode)</dt>
2250 <dd>
2251
2252  Create a new TLS context.
2253
2254
2255 <h3>Parameters</h3>
2256 <ul>
2257         
2258         <li>
2259           mode: TLS-Mode ["client", "server"]
2260         </li>
2261         
2262 </ul>
2263
2264
2265
2266
2267
2268
2269 <h3>Return value:</h3>
2270 TLSContext Object
2271
2272
2273
2274 </dd>
2275
2276
2277
2278
2279 <dt><a name="nixio.umask"></a><strong>umask</strong>&nbsp;(mask)</dt>
2280 <dd>
2281
2282  Sets the file mode creation mask.
2283
2284
2285 <h3>Parameters</h3>
2286 <ul>
2287         
2288         <li>
2289           mask: New creation mask (see chmod for format specifications)
2290         </li>
2291         
2292 </ul>
2293
2294
2295
2296
2297
2298
2299 <h3>Return values:</h3>
2300 <ol>
2301         
2302         <li>the old umask as decimal mode number
2303         
2304         <li>the old umask as mode string
2305         
2306 </ol>
2307
2308
2309
2310 </dd>
2311
2312
2313
2314
2315 <dt><a name="nixio.uname"></a><strong>uname</strong>&nbsp;()</dt>
2316 <dd>
2317
2318  (POSIX) Get information about current system and kernel.
2319
2320
2321
2322
2323
2324
2325
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> 
2333  </ul>
2334
2335
2336
2337 </dd>
2338
2339
2340
2341
2342 <dt><a name="nixio.waitpid"></a><strong>waitpid</strong>&nbsp;(pid, flag1, ...)</dt>
2343 <dd>
2344
2345  (POSIX) Wait for a process to change state.
2346
2347
2348 <h3>Parameters</h3>
2349 <ul>
2350         
2351         <li>
2352           pid: Process ID       (optional, default: any childprocess)
2353         </li>
2354         
2355         <li>
2356           flag1: Flag   (optional) ["nohang", "untraced", "continued"]
2357         </li>
2358         
2359         <li>
2360           ...: More Flags [-"-]
2361         </li>
2362         
2363 </ul>
2364
2365
2366
2367
2368 <h3>Usage:</h3>
2369 If the "nohang" is given this function becomes non-blocking.
2370
2371
2372
2373 <h3>Return values:</h3>
2374 <ol>
2375         
2376         <li>process id of child or 0 if no child has changed state
2377         
2378         <li>["exited", "signaled", "stopped"]
2379         
2380         <li>[exit code, terminate signal, stop signal]
2381         
2382 </ol>
2383
2384
2385
2386 </dd>
2387
2388
2389 </dl>
2390
2391
2392
2393
2394
2395 </div> <!-- id="content" -->
2396
2397 </div> <!-- id="main" -->
2398
2399 <div id="about">
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" -->
2402
2403 </div> <!-- id="container" -->
2404 </body>
2405 </html>