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