Commit | Line | Data |
37120919 |
1 | =head1 NAME |
2 | |
3 | POSIX - Perl interface to IEEE Std 1003.1 |
4 | |
cb1a09d0 |
5 | =head1 SYNOPSIS |
6 | |
7 | use POSIX; |
8 | use POSIX qw(setsid); |
9 | use POSIX qw(:errno_h :fcntl_h); |
10 | |
11 | printf "EINTR is %d\n", EINTR; |
12 | |
13 | $sess_id = POSIX::setsid(); |
14 | |
15 | $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); |
16 | # note: that's a filedescriptor, *NOT* a filehandle |
17 | |
37120919 |
18 | =head1 DESCRIPTION |
19 | |
20 | The POSIX module permits you to access all (or nearly all) the standard |
21 | POSIX 1003.1 identifiers. Many of these identifiers have been given Perl-ish |
22 | interfaces. Things which are C<#defines> in C, like EINTR or O_NDELAY, are |
23 | automatically exported into your namespace. All functions are only exported |
24 | if you ask for them explicitly. Most likely people will prefer to use the |
25 | fully-qualified function names. |
26 | |
27 | This document gives a condensed list of the features available in the POSIX |
28 | module. Consult your operating system's manpages for general information on |
29 | most features. Consult L<perlfunc> for functions which are noted as being |
30 | identical to Perl's builtin functions. |
31 | |
32 | The first section describes POSIX functions from the 1003.1 specification. |
33 | The second section describes some classes for signal objects, TTY objects, |
34 | and other miscellaneous objects. The remaining sections list various |
35 | constants and macros in an organization which roughly follows IEEE Std |
36 | 1003.1b-1993. |
37 | |
37120919 |
38 | =head1 NOTE |
39 | |
40 | The POSIX module is probably the most complex Perl module supplied with |
41 | the standard distribution. It incorporates autoloading, namespace games, |
42 | and dynamic loading of code that's in Perl, C, or both. It's a great |
43 | source of wisdom. |
44 | |
45 | =head1 CAVEATS |
46 | |
47 | A few functions are not implemented because they are C specific. If you |
48 | attempt to call these, they will print a message telling you that they |
49 | aren't implemented, and suggest using the Perl equivalent should one |
50 | exist. For example, trying to access the setjmp() call will elicit the |
51 | message "setjmp() is C-specific: use eval {} instead". |
52 | |
53 | Furthermore, some evil vendors will claim 1003.1 compliance, but in fact |
54 | are not so: they will not pass the PCTS (POSIX Compliance Test Suites). |
55 | For example, one vendor may not define EDEADLK, or the semantics of the |
56 | errno values set by open(2) might not be quite right. Perl does not |
57 | attempt to verify POSIX compliance. That means you can currently |
58 | successfully say "use POSIX", and then later in your program you find |
59 | that your vendor has been lax and there's no usable ICANON macro after |
60 | all. This could be construed to be a bug. |
61 | |
62 | =head1 FUNCTIONS |
63 | |
64 | =over 8 |
65 | |
66 | =item _exit |
67 | |
68 | This is identical to the C function C<_exit()>. |
69 | |
70 | =item abort |
71 | |
72 | This is identical to the C function C<abort()>. |
73 | |
74 | =item abs |
75 | |
76 | This is identical to Perl's builtin C<abs()> function. |
77 | |
78 | =item access |
79 | |
80 | Determines the accessibility of a file. |
81 | |
82 | if( POSIX::access( "/", &POSIX::R_OK ) ){ |
83 | print "have read permission\n"; |
84 | } |
85 | |
86 | Returns C<undef> on failure. |
87 | |
88 | =item acos |
89 | |
90 | This is identical to the C function C<acos()>. |
91 | |
92 | =item alarm |
93 | |
94 | This is identical to Perl's builtin C<alarm()> function. |
95 | |
96 | =item asctime |
97 | |
98 | This is identical to the C function C<asctime()>. |
99 | |
100 | =item asin |
101 | |
102 | This is identical to the C function C<asin()>. |
103 | |
104 | =item assert |
105 | |
cb1a09d0 |
106 | Unimplemented. |
37120919 |
107 | |
108 | =item atan |
109 | |
110 | This is identical to the C function C<atan()>. |
111 | |
112 | =item atan2 |
113 | |
114 | This is identical to Perl's builtin C<atan2()> function. |
115 | |
116 | =item atexit |
117 | |
118 | atexit() is C-specific: use END {} instead. |
119 | |
120 | =item atof |
121 | |
122 | atof() is C-specific. |
123 | |
124 | =item atoi |
125 | |
126 | atoi() is C-specific. |
127 | |
128 | =item atol |
129 | |
130 | atol() is C-specific. |
131 | |
132 | =item bsearch |
133 | |
134 | bsearch() not supplied. |
135 | |
136 | =item calloc |
137 | |
138 | calloc() is C-specific. |
139 | |
140 | =item ceil |
141 | |
142 | This is identical to the C function C<ceil()>. |
143 | |
144 | =item chdir |
145 | |
146 | This is identical to Perl's builtin C<chdir()> function. |
147 | |
148 | =item chmod |
149 | |
150 | This is identical to Perl's builtin C<chmod()> function. |
151 | |
152 | =item chown |
153 | |
154 | This is identical to Perl's builtin C<chown()> function. |
155 | |
156 | =item clearerr |
157 | |
28757baa |
158 | Use method C<IO::Handle::clearerr()> instead. |
37120919 |
159 | |
160 | =item clock |
161 | |
162 | This is identical to the C function C<clock()>. |
163 | |
164 | =item close |
165 | |
cb1a09d0 |
166 | Close the file. This uses file descriptors such as those obtained by calling |
167 | C<POSIX::open>. |
168 | |
169 | $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); |
170 | POSIX::close( $fd ); |
37120919 |
171 | |
172 | Returns C<undef> on failure. |
173 | |
174 | =item closedir |
175 | |
176 | This is identical to Perl's builtin C<closedir()> function. |
177 | |
178 | =item cos |
179 | |
180 | This is identical to Perl's builtin C<cos()> function. |
181 | |
182 | =item cosh |
183 | |
184 | This is identical to the C function C<cosh()>. |
185 | |
186 | =item creat |
187 | |
cb1a09d0 |
188 | Create a new file. This returns a file descriptor like the ones returned by |
189 | C<POSIX::open>. Use C<POSIX::close> to close the file. |
190 | |
191 | $fd = POSIX::creat( "foo", 0611 ); |
192 | POSIX::close( $fd ); |
37120919 |
193 | |
194 | =item ctermid |
195 | |
cb1a09d0 |
196 | Generates the path name for the controlling terminal. |
37120919 |
197 | |
198 | $path = POSIX::ctermid(); |
199 | |
200 | =item ctime |
201 | |
202 | This is identical to the C function C<ctime()>. |
203 | |
204 | =item cuserid |
205 | |
206 | Get the character login name of the user. |
207 | |
208 | $name = POSIX::cuserid(); |
209 | |
210 | =item difftime |
211 | |
212 | This is identical to the C function C<difftime()>. |
213 | |
214 | =item div |
215 | |
216 | div() is C-specific. |
217 | |
218 | =item dup |
219 | |
cb1a09d0 |
220 | This is similar to the C function C<dup()>. |
221 | |
222 | This uses file descriptors such as those obtained by calling |
223 | C<POSIX::open>. |
37120919 |
224 | |
225 | Returns C<undef> on failure. |
226 | |
227 | =item dup2 |
228 | |
cb1a09d0 |
229 | This is similar to the C function C<dup2()>. |
230 | |
231 | This uses file descriptors such as those obtained by calling |
232 | C<POSIX::open>. |
37120919 |
233 | |
234 | Returns C<undef> on failure. |
235 | |
236 | =item errno |
237 | |
238 | Returns the value of errno. |
239 | |
240 | $errno = POSIX::errno(); |
241 | |
242 | =item execl |
243 | |
244 | execl() is C-specific. |
245 | |
246 | =item execle |
247 | |
248 | execle() is C-specific. |
249 | |
250 | =item execlp |
251 | |
252 | execlp() is C-specific. |
253 | |
254 | =item execv |
255 | |
256 | execv() is C-specific. |
257 | |
258 | =item execve |
259 | |
260 | execve() is C-specific. |
261 | |
262 | =item execvp |
263 | |
264 | execvp() is C-specific. |
265 | |
266 | =item exit |
267 | |
268 | This is identical to Perl's builtin C<exit()> function. |
269 | |
270 | =item exp |
271 | |
272 | This is identical to Perl's builtin C<exp()> function. |
273 | |
274 | =item fabs |
275 | |
276 | This is identical to Perl's builtin C<abs()> function. |
277 | |
278 | =item fclose |
279 | |
28757baa |
280 | Use method C<IO::Handle::close()> instead. |
37120919 |
281 | |
282 | =item fcntl |
283 | |
284 | This is identical to Perl's builtin C<fcntl()> function. |
285 | |
286 | =item fdopen |
287 | |
28757baa |
288 | Use method C<IO::Handle::new_from_fd()> instead. |
37120919 |
289 | |
290 | =item feof |
291 | |
28757baa |
292 | Use method C<IO::Handle::eof()> instead. |
37120919 |
293 | |
294 | =item ferror |
295 | |
28757baa |
296 | Use method C<IO::Handle::error()> instead. |
37120919 |
297 | |
298 | =item fflush |
299 | |
28757baa |
300 | Use method C<IO::Handle::flush()> instead. |
37120919 |
301 | |
302 | =item fgetc |
303 | |
28757baa |
304 | Use method C<IO::Handle::getc()> instead. |
37120919 |
305 | |
306 | =item fgetpos |
307 | |
28757baa |
308 | Use method C<IO::Seekable::getpos()> instead. |
37120919 |
309 | |
310 | =item fgets |
311 | |
28757baa |
312 | Use method C<IO::Handle::gets()> instead. |
37120919 |
313 | |
314 | =item fileno |
315 | |
28757baa |
316 | Use method C<IO::Handle::fileno()> instead. |
37120919 |
317 | |
318 | =item floor |
319 | |
320 | This is identical to the C function C<floor()>. |
321 | |
322 | =item fmod |
323 | |
324 | This is identical to the C function C<fmod()>. |
325 | |
326 | =item fopen |
327 | |
28757baa |
328 | Use method C<IO::File::open()> instead. |
37120919 |
329 | |
330 | =item fork |
331 | |
332 | This is identical to Perl's builtin C<fork()> function. |
333 | |
334 | =item fpathconf |
335 | |
cb1a09d0 |
336 | Retrieves the value of a configurable limit on a file or directory. This |
337 | uses file descriptors such as those obtained by calling C<POSIX::open>. |
338 | |
339 | The following will determine the maximum length of the longest allowable |
340 | pathname on the filesystem which holds C</tmp/foo>. |
341 | |
342 | $fd = POSIX::open( "/tmp/foo", &POSIX::O_RDONLY ); |
343 | $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX ); |
37120919 |
344 | |
345 | Returns C<undef> on failure. |
346 | |
347 | =item fprintf |
348 | |
349 | fprintf() is C-specific--use printf instead. |
350 | |
351 | =item fputc |
352 | |
353 | fputc() is C-specific--use print instead. |
354 | |
355 | =item fputs |
356 | |
357 | fputs() is C-specific--use print instead. |
358 | |
359 | =item fread |
360 | |
361 | fread() is C-specific--use read instead. |
362 | |
363 | =item free |
364 | |
365 | free() is C-specific. |
366 | |
367 | =item freopen |
368 | |
369 | freopen() is C-specific--use open instead. |
370 | |
371 | =item frexp |
372 | |
cb1a09d0 |
373 | Return the mantissa and exponent of a floating-point number. |
374 | |
375 | ($mantissa, $exponent) = POSIX::frexp( 3.14 ); |
37120919 |
376 | |
377 | =item fscanf |
378 | |
379 | fscanf() is C-specific--use <> and regular expressions instead. |
380 | |
381 | =item fseek |
382 | |
28757baa |
383 | Use method C<IO::Seekable::seek()> instead. |
37120919 |
384 | |
385 | =item fsetpos |
386 | |
28757baa |
387 | Use method C<IO::Seekable::setpos()> instead. |
37120919 |
388 | |
389 | =item fstat |
390 | |
cb1a09d0 |
391 | Get file status. This uses file descriptors such as those obtained by |
392 | calling C<POSIX::open>. The data returned is identical to the data from |
393 | Perl's builtin C<stat> function. |
394 | |
395 | $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); |
396 | @stats = POSIX::fstat( $fd ); |
37120919 |
397 | |
398 | =item ftell |
399 | |
28757baa |
400 | Use method C<IO::Seekable::tell()> instead. |
37120919 |
401 | |
402 | =item fwrite |
403 | |
404 | fwrite() is C-specific--use print instead. |
405 | |
406 | =item getc |
407 | |
408 | This is identical to Perl's builtin C<getc()> function. |
409 | |
410 | =item getchar |
411 | |
412 | Returns one character from STDIN. |
413 | |
414 | =item getcwd |
415 | |
416 | Returns the name of the current working directory. |
417 | |
418 | =item getegid |
419 | |
420 | Returns the effective group id. |
421 | |
422 | =item getenv |
423 | |
424 | Returns the value of the specified enironment variable. |
425 | |
426 | =item geteuid |
427 | |
428 | Returns the effective user id. |
429 | |
430 | =item getgid |
431 | |
432 | Returns the user's real group id. |
433 | |
434 | =item getgrgid |
435 | |
436 | This is identical to Perl's builtin C<getgrgid()> function. |
437 | |
438 | =item getgrnam |
439 | |
440 | This is identical to Perl's builtin C<getgrnam()> function. |
441 | |
442 | =item getgroups |
443 | |
444 | Returns the ids of the user's supplementary groups. |
445 | |
446 | =item getlogin |
447 | |
448 | This is identical to Perl's builtin C<getlogin()> function. |
449 | |
450 | =item getpgrp |
451 | |
452 | This is identical to Perl's builtin C<getpgrp()> function. |
453 | |
454 | =item getpid |
455 | |
456 | Returns the process's id. |
457 | |
458 | =item getppid |
459 | |
460 | This is identical to Perl's builtin C<getppid()> function. |
461 | |
462 | =item getpwnam |
463 | |
464 | This is identical to Perl's builtin C<getpwnam()> function. |
465 | |
466 | =item getpwuid |
467 | |
468 | This is identical to Perl's builtin C<getpwuid()> function. |
469 | |
470 | =item gets |
471 | |
472 | Returns one line from STDIN. |
473 | |
474 | =item getuid |
475 | |
476 | Returns the user's id. |
477 | |
478 | =item gmtime |
479 | |
480 | This is identical to Perl's builtin C<gmtime()> function. |
481 | |
482 | =item isalnum |
483 | |
cb1a09d0 |
484 | This is identical to the C function, except that it can apply to a single |
485 | character or to a whole string. |
37120919 |
486 | |
487 | =item isalpha |
488 | |
cb1a09d0 |
489 | This is identical to the C function, except that it can apply to a single |
490 | character or to a whole string. |
37120919 |
491 | |
492 | =item isatty |
493 | |
494 | Returns a boolean indicating whether the specified filehandle is connected |
495 | to a tty. |
496 | |
497 | =item iscntrl |
498 | |
cb1a09d0 |
499 | This is identical to the C function, except that it can apply to a single |
500 | character or to a whole string. |
37120919 |
501 | |
502 | =item isdigit |
503 | |
cb1a09d0 |
504 | This is identical to the C function, except that it can apply to a single |
505 | character or to a whole string. |
37120919 |
506 | |
507 | =item isgraph |
508 | |
cb1a09d0 |
509 | This is identical to the C function, except that it can apply to a single |
510 | character or to a whole string. |
37120919 |
511 | |
512 | =item islower |
513 | |
cb1a09d0 |
514 | This is identical to the C function, except that it can apply to a single |
515 | character or to a whole string. |
37120919 |
516 | |
517 | =item isprint |
518 | |
cb1a09d0 |
519 | This is identical to the C function, except that it can apply to a single |
520 | character or to a whole string. |
37120919 |
521 | |
522 | =item ispunct |
523 | |
cb1a09d0 |
524 | This is identical to the C function, except that it can apply to a single |
525 | character or to a whole string. |
37120919 |
526 | |
527 | =item isspace |
528 | |
cb1a09d0 |
529 | This is identical to the C function, except that it can apply to a single |
530 | character or to a whole string. |
37120919 |
531 | |
532 | =item isupper |
533 | |
cb1a09d0 |
534 | This is identical to the C function, except that it can apply to a single |
535 | character or to a whole string. |
37120919 |
536 | |
537 | =item isxdigit |
538 | |
cb1a09d0 |
539 | This is identical to the C function, except that it can apply to a single |
540 | character or to a whole string. |
37120919 |
541 | |
542 | =item kill |
543 | |
544 | This is identical to Perl's builtin C<kill()> function. |
545 | |
546 | =item labs |
547 | |
548 | labs() is C-specific, use abs instead. |
549 | |
550 | =item ldexp |
551 | |
552 | This is identical to the C function C<ldexp()>. |
553 | |
554 | =item ldiv |
555 | |
556 | ldiv() is C-specific, use / and int instead. |
557 | |
558 | =item link |
559 | |
560 | This is identical to Perl's builtin C<link()> function. |
561 | |
562 | =item localeconv |
563 | |
cb1a09d0 |
564 | Get numeric formatting information. Returns a reference to a hash |
565 | containing the current locale formatting values. |
566 | |
567 | The database for the B<de> (Deutsch or German) locale. |
568 | |
569 | $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); |
570 | print "Locale = $loc\n"; |
571 | $lconv = POSIX::localeconv(); |
572 | print "decimal_point = ", $lconv->{decimal_point}, "\n"; |
573 | print "thousands_sep = ", $lconv->{thousands_sep}, "\n"; |
574 | print "grouping = ", $lconv->{grouping}, "\n"; |
575 | print "int_curr_symbol = ", $lconv->{int_curr_symbol}, "\n"; |
576 | print "currency_symbol = ", $lconv->{currency_symbol}, "\n"; |
577 | print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n"; |
578 | print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n"; |
579 | print "mon_grouping = ", $lconv->{mon_grouping}, "\n"; |
580 | print "positive_sign = ", $lconv->{positive_sign}, "\n"; |
581 | print "negative_sign = ", $lconv->{negative_sign}, "\n"; |
582 | print "int_frac_digits = ", $lconv->{int_frac_digits}, "\n"; |
583 | print "frac_digits = ", $lconv->{frac_digits}, "\n"; |
584 | print "p_cs_precedes = ", $lconv->{p_cs_precedes}, "\n"; |
585 | print "p_sep_by_space = ", $lconv->{p_sep_by_space}, "\n"; |
586 | print "n_cs_precedes = ", $lconv->{n_cs_precedes}, "\n"; |
587 | print "n_sep_by_space = ", $lconv->{n_sep_by_space}, "\n"; |
588 | print "p_sign_posn = ", $lconv->{p_sign_posn}, "\n"; |
589 | print "n_sign_posn = ", $lconv->{n_sign_posn}, "\n"; |
37120919 |
590 | |
591 | =item localtime |
592 | |
593 | This is identical to Perl's builtin C<localtime()> function. |
594 | |
595 | =item log |
596 | |
597 | This is identical to Perl's builtin C<log()> function. |
598 | |
599 | =item log10 |
600 | |
601 | This is identical to the C function C<log10()>. |
602 | |
603 | =item longjmp |
604 | |
605 | longjmp() is C-specific: use die instead. |
606 | |
607 | =item lseek |
608 | |
8903cb82 |
609 | Move the file's read/write position. This uses file descriptors such as |
cb1a09d0 |
610 | those obtained by calling C<POSIX::open>. |
611 | |
612 | $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); |
613 | $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET ); |
37120919 |
614 | |
615 | Returns C<undef> on failure. |
616 | |
617 | =item malloc |
618 | |
619 | malloc() is C-specific. |
620 | |
621 | =item mblen |
622 | |
cb1a09d0 |
623 | This is identical to the C function C<mblen()>. |
37120919 |
624 | |
625 | =item mbstowcs |
626 | |
cb1a09d0 |
627 | This is identical to the C function C<mbstowcs()>. |
37120919 |
628 | |
629 | =item mbtowc |
630 | |
cb1a09d0 |
631 | This is identical to the C function C<mbtowc()>. |
37120919 |
632 | |
633 | =item memchr |
634 | |
635 | memchr() is C-specific, use index() instead. |
636 | |
637 | =item memcmp |
638 | |
639 | memcmp() is C-specific, use eq instead. |
640 | |
641 | =item memcpy |
642 | |
643 | memcpy() is C-specific, use = instead. |
644 | |
645 | =item memmove |
646 | |
647 | memmove() is C-specific, use = instead. |
648 | |
649 | =item memset |
650 | |
651 | memset() is C-specific, use x instead. |
652 | |
653 | =item mkdir |
654 | |
655 | This is identical to Perl's builtin C<mkdir()> function. |
656 | |
657 | =item mkfifo |
658 | |
cb1a09d0 |
659 | This is similar to the C function C<mkfifo()>. |
37120919 |
660 | |
661 | Returns C<undef> on failure. |
662 | |
663 | =item mktime |
664 | |
cb1a09d0 |
665 | Convert date/time info to a calendar time. |
666 | |
667 | Synopsis: |
668 | |
669 | mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) |
670 | |
671 | The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. |
672 | I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The |
673 | year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the |
674 | year 2001 is 101. Consult your system's C<mktime()> manpage for details |
675 | about these and the other arguments. |
676 | |
677 | Calendar time for December 12, 1995, at 10:30 am. |
678 | |
679 | $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); |
680 | print "Date = ", POSIX::ctime($time_t); |
37120919 |
681 | |
682 | Returns C<undef> on failure. |
683 | |
684 | =item modf |
685 | |
cb1a09d0 |
686 | Return the integral and fractional parts of a floating-point number. |
687 | |
688 | ($fractional, $integral) = POSIX::modf( 3.14 ); |
37120919 |
689 | |
690 | =item nice |
691 | |
cb1a09d0 |
692 | This is similar to the C function C<nice()>. |
37120919 |
693 | |
694 | Returns C<undef> on failure. |
695 | |
696 | =item offsetof |
697 | |
698 | offsetof() is C-specific. |
699 | |
700 | =item open |
701 | |
cb1a09d0 |
702 | Open a file for reading for writing. This returns file descriptors, not |
703 | Perl filehandles. Use C<POSIX::close> to close the file. |
704 | |
705 | Open a file read-only with mode 0666. |
706 | |
707 | $fd = POSIX::open( "foo" ); |
708 | |
709 | Open a file for read and write. |
710 | |
711 | $fd = POSIX::open( "foo", &POSIX::O_RDWR ); |
712 | |
713 | Open a file for write, with truncation. |
714 | |
715 | $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC ); |
716 | |
717 | Create a new file with mode 0640. Set up the file for writing. |
718 | |
719 | $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 ); |
37120919 |
720 | |
721 | Returns C<undef> on failure. |
722 | |
723 | =item opendir |
724 | |
cb1a09d0 |
725 | Open a directory for reading. |
726 | |
727 | $dir = POSIX::opendir( "/tmp" ); |
728 | @files = POSIX::readdir( $dir ); |
729 | POSIX::closedir( $dir ); |
730 | |
731 | Returns C<undef> on failure. |
37120919 |
732 | |
733 | =item pathconf |
734 | |
735 | Retrieves the value of a configurable limit on a file or directory. |
736 | |
737 | The following will determine the maximum length of the longest allowable |
738 | pathname on the filesystem which holds C</tmp>. |
739 | |
740 | $path_max = POSIX::pathconf( "/tmp", &POSIX::_PC_PATH_MAX ); |
741 | |
742 | Returns C<undef> on failure. |
743 | |
744 | =item pause |
745 | |
746 | This is similar to the C function C<pause()>. |
747 | |
748 | Returns C<undef> on failure. |
749 | |
750 | =item perror |
751 | |
752 | This is identical to the C function C<perror()>. |
753 | |
754 | =item pipe |
755 | |
cb1a09d0 |
756 | Create an interprocess channel. This returns file descriptors like those |
757 | returned by C<POSIX::open>. |
758 | |
759 | ($fd0, $fd1) = POSIX::pipe(); |
760 | POSIX::write( $fd0, "hello", 5 ); |
761 | POSIX::read( $fd1, $buf, 5 ); |
37120919 |
762 | |
763 | =item pow |
764 | |
765 | Computes $x raised to the power $exponent. |
766 | |
767 | $ret = POSIX::pow( $x, $exponent ); |
768 | |
769 | =item printf |
770 | |
771 | Prints the specified arguments to STDOUT. |
772 | |
773 | =item putc |
774 | |
775 | putc() is C-specific--use print instead. |
776 | |
777 | =item putchar |
778 | |
779 | putchar() is C-specific--use print instead. |
780 | |
781 | =item puts |
782 | |
783 | puts() is C-specific--use print instead. |
784 | |
785 | =item qsort |
786 | |
787 | qsort() is C-specific, use sort instead. |
788 | |
789 | =item raise |
790 | |
791 | Sends the specified signal to the current process. |
792 | |
793 | =item rand |
794 | |
795 | rand() is non-portable, use Perl's rand instead. |
796 | |
797 | =item read |
798 | |
cb1a09d0 |
799 | Read from a file. This uses file descriptors such as those obtained by |
800 | calling C<POSIX::open>. If the buffer C<$buf> is not large enough for the |
801 | read then Perl will extend it to make room for the request. |
802 | |
803 | $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); |
804 | $bytes = POSIX::read( $fd, $buf, 3 ); |
37120919 |
805 | |
806 | Returns C<undef> on failure. |
807 | |
808 | =item readdir |
809 | |
810 | This is identical to Perl's builtin C<readdir()> function. |
811 | |
812 | =item realloc |
813 | |
814 | realloc() is C-specific. |
815 | |
816 | =item remove |
817 | |
818 | This is identical to Perl's builtin C<unlink()> function. |
819 | |
820 | =item rename |
821 | |
822 | This is identical to Perl's builtin C<rename()> function. |
823 | |
824 | =item rewind |
825 | |
826 | Seeks to the beginning of the file. |
827 | |
828 | =item rewinddir |
829 | |
830 | This is identical to Perl's builtin C<rewinddir()> function. |
831 | |
832 | =item rmdir |
833 | |
834 | This is identical to Perl's builtin C<rmdir()> function. |
835 | |
836 | =item scanf |
837 | |
838 | scanf() is C-specific--use <> and regular expressions instead. |
839 | |
840 | =item setgid |
841 | |
842 | Sets the real group id for this process. |
843 | |
844 | =item setjmp |
845 | |
846 | setjmp() is C-specific: use eval {} instead. |
847 | |
848 | =item setlocale |
849 | |
850 | Modifies and queries program's locale. |
851 | |
8966fa01 |
852 | The following will set the traditional UNIX system locale behavior |
853 | (the second argument C<"C">). |
37120919 |
854 | |
855 | $loc = POSIX::setlocale( &POSIX::LC_ALL, "C" ); |
856 | |
8966fa01 |
857 | The following will query (the missing second argument) the current |
858 | LC_CTYPE category. |
859 | |
860 | $loc = POSIX::setlocale( &POSIX::LC_CTYPE); |
861 | |
862 | The following will set the LC_CTYPE behaviour according to the locale |
863 | environment variables (the second argument C<"">). |
864 | Please see your systems L<setlocale(3)> documentation for the locale |
71be2cbc |
865 | environment variables' meaning or consult L<perllocale>. |
8966fa01 |
866 | |
867 | $loc = POSIX::setlocale( &POSIX::LC_CTYPE, ""); |
868 | |
869 | The following will set the LC_COLLATE behaviour to Argentinian |
870 | Spanish. B<NOTE>: The naming and availability of locales depends on |
71be2cbc |
871 | your operating system. Please consult L<perllocale> for how to find |
8966fa01 |
872 | out which locales are available in your system. |
873 | |
874 | $loc = POSIX::setlocale( &POSIX::LC_ALL, "es_AR.ISO8859-1" ); |
875 | |
37120919 |
876 | =item setpgid |
877 | |
cb1a09d0 |
878 | This is similar to the C function C<setpgid()>. |
37120919 |
879 | |
880 | Returns C<undef> on failure. |
881 | |
882 | =item setsid |
883 | |
884 | This is identical to the C function C<setsid()>. |
885 | |
886 | =item setuid |
887 | |
888 | Sets the real user id for this process. |
889 | |
890 | =item sigaction |
891 | |
cb1a09d0 |
892 | Detailed signal management. This uses C<POSIX::SigAction> objects for the |
893 | C<action> and C<oldaction> arguments. Consult your system's C<sigaction> |
894 | manpage for details. |
895 | |
896 | Synopsis: |
897 | |
898 | sigaction(sig, action, oldaction = 0) |
37120919 |
899 | |
900 | Returns C<undef> on failure. |
901 | |
902 | =item siglongjmp |
903 | |
904 | siglongjmp() is C-specific: use die instead. |
905 | |
906 | =item sigpending |
907 | |
cb1a09d0 |
908 | Examine signals that are blocked and pending. This uses C<POSIX::SigSet> |
909 | objects for the C<sigset> argument. Consult your system's C<sigpending> |
910 | manpage for details. |
911 | |
912 | Synopsis: |
913 | |
914 | sigpending(sigset) |
37120919 |
915 | |
916 | Returns C<undef> on failure. |
917 | |
918 | =item sigprocmask |
919 | |
cb1a09d0 |
920 | Change and/or examine calling process's signal mask. This uses |
921 | C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments. |
922 | Consult your system's C<sigprocmask> manpage for details. |
923 | |
924 | Synopsis: |
925 | |
926 | sigprocmask(how, sigset, oldsigset = 0) |
37120919 |
927 | |
928 | Returns C<undef> on failure. |
929 | |
930 | =item sigsetjmp |
931 | |
932 | sigsetjmp() is C-specific: use eval {} instead. |
933 | |
934 | =item sigsuspend |
935 | |
cb1a09d0 |
936 | Install a signal mask and suspend process until signal arrives. This uses |
937 | C<POSIX::SigSet> objects for the C<signal_mask> argument. Consult your |
938 | system's C<sigsuspend> manpage for details. |
939 | |
940 | Synopsis: |
941 | |
942 | sigsuspend(signal_mask) |
37120919 |
943 | |
944 | Returns C<undef> on failure. |
945 | |
946 | =item sin |
947 | |
948 | This is identical to Perl's builtin C<sin()> function. |
949 | |
950 | =item sinh |
951 | |
952 | This is identical to the C function C<sinh()>. |
953 | |
954 | =item sleep |
955 | |
956 | This is identical to Perl's builtin C<sleep()> function. |
957 | |
958 | =item sprintf |
959 | |
cb1a09d0 |
960 | This is identical to Perl's builtin C<sprintf()> function. |
37120919 |
961 | |
962 | =item sqrt |
963 | |
964 | This is identical to Perl's builtin C<sqrt()> function. |
965 | |
966 | =item srand |
967 | |
968 | srand(). |
969 | |
970 | =item sscanf |
971 | |
972 | sscanf() is C-specific--use regular expressions instead. |
973 | |
974 | =item stat |
975 | |
976 | This is identical to Perl's builtin C<stat()> function. |
977 | |
978 | =item strcat |
979 | |
980 | strcat() is C-specific, use .= instead. |
981 | |
982 | =item strchr |
983 | |
984 | strchr() is C-specific, use index() instead. |
985 | |
986 | =item strcmp |
987 | |
988 | strcmp() is C-specific, use eq instead. |
989 | |
990 | =item strcoll |
991 | |
992 | This is identical to the C function C<strcoll()>. |
993 | |
994 | =item strcpy |
995 | |
996 | strcpy() is C-specific, use = instead. |
997 | |
998 | =item strcspn |
999 | |
1000 | strcspn() is C-specific, use regular expressions instead. |
1001 | |
1002 | =item strerror |
1003 | |
1004 | Returns the error string for the specified errno. |
1005 | |
1006 | =item strftime |
1007 | |
cb1a09d0 |
1008 | Convert date and time information to string. Returns the string. |
1009 | |
1010 | Synopsis: |
1011 | |
1012 | strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) |
1013 | |
1014 | The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. |
1015 | I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The |
1016 | year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the |
1017 | year 2001 is 101. Consult your system's C<strftime()> manpage for details |
1018 | about these and the other arguments. |
1019 | |
1020 | The string for Tuesday, December 12, 1995. |
1021 | |
1022 | $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 ); |
1023 | print "$str\n"; |
37120919 |
1024 | |
1025 | =item strlen |
1026 | |
1027 | strlen() is C-specific, use length instead. |
1028 | |
1029 | =item strncat |
1030 | |
1031 | strncat() is C-specific, use .= instead. |
1032 | |
1033 | =item strncmp |
1034 | |
1035 | strncmp() is C-specific, use eq instead. |
1036 | |
1037 | =item strncpy |
1038 | |
1039 | strncpy() is C-specific, use = instead. |
1040 | |
1041 | =item stroul |
1042 | |
1043 | stroul() is C-specific. |
1044 | |
1045 | =item strpbrk |
1046 | |
1047 | strpbrk() is C-specific. |
1048 | |
1049 | =item strrchr |
1050 | |
1051 | strrchr() is C-specific, use rindex() instead. |
1052 | |
1053 | =item strspn |
1054 | |
1055 | strspn() is C-specific. |
1056 | |
1057 | =item strstr |
1058 | |
1059 | This is identical to Perl's builtin C<index()> function. |
1060 | |
1061 | =item strtod |
1062 | |
a89d8a78 |
1063 | String to double translation. Returns the parsed number and the number |
1064 | of characters in the unparsed portion of the string. Truly |
1065 | POSIX-compliant systems set $! ($ERRNO) to indicate a translation |
1066 | error, so clear $! before calling strtod. However, non-POSIX systems |
1067 | may not check for overflow, and therefore will never set $!. |
1068 | |
1069 | strtod should respect any POSIX I<setlocale()> settings. |
1070 | |
1071 | To parse a string $str as a floating point number use |
1072 | |
1073 | $! = 0; |
1074 | ($num, $n_unparsed) = POSIX::strtod($str); |
1075 | |
1076 | The second returned item and $! can be used to check for valid input: |
1077 | |
1078 | if (($str eq '') || ($n_unparsed != 0) || !$!) { |
1079 | die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; |
1080 | } |
1081 | |
1082 | When called in a scalar context strtod returns the parsed number. |
37120919 |
1083 | |
1084 | =item strtok |
1085 | |
1086 | strtok() is C-specific. |
1087 | |
1088 | =item strtol |
1089 | |
a89d8a78 |
1090 | String to (long) integer translation. Returns the parsed number and |
1091 | the number of characters in the unparsed portion of the string. Truly |
1092 | POSIX-compliant systems set $! ($ERRNO) to indicate a translation |
1093 | error, so clear $! before calling strtol. However, non-POSIX systems |
1094 | may not check for overflow, and therefore will never set $!. |
1095 | |
1096 | strtol should respect any POSIX I<setlocale()> settings. |
1097 | |
1098 | To parse a string $str as a number in some base $base use |
1099 | |
1100 | $! = 0; |
1101 | ($num, $n_unparsed) = POSIX::strtol($str, $base); |
1102 | |
1103 | The base should be zero or between 2 and 36, inclusive. When the base |
1104 | is zero or omitted strtol will use the string itself to determine the |
1105 | base: a leading "0x" or "0X" means hexadecimal; a leading "0" means |
1106 | octal; any other leading characters mean decimal. Thus, "1234" is |
1107 | parsed as a decimal number, "01234" as an octal number, and "0x1234" |
1108 | as a hexadecimal number. |
1109 | |
1110 | The second returned item and $! can be used to check for valid input: |
1111 | |
1112 | if (($str eq '') || ($n_unparsed != 0) || !$!) { |
1113 | die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; |
1114 | } |
1115 | |
1116 | When called in a scalar context strtol returns the parsed number. |
1117 | |
1118 | =item strtoul |
1119 | |
1120 | String to unsigned (long) integer translation. strtoul is identical |
1121 | to strtol except that strtoul only parses unsigned integers. See |
1122 | I<strtol> for details. |
1123 | |
1124 | Note: Some vendors supply strtod and strtol but not strtoul. |
1125 | Other vendors that do suply strtoul parse "-1" as a valid value. |
37120919 |
1126 | |
1127 | =item strxfrm |
1128 | |
cb1a09d0 |
1129 | String transformation. Returns the transformed string. |
1130 | |
1131 | $dst = POSIX::strxfrm( $src ); |
37120919 |
1132 | |
1133 | =item sysconf |
1134 | |
1135 | Retrieves values of system configurable variables. |
1136 | |
1137 | The following will get the machine's clock speed. |
1138 | |
1139 | $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK ); |
1140 | |
1141 | Returns C<undef> on failure. |
1142 | |
1143 | =item system |
1144 | |
1145 | This is identical to Perl's builtin C<system()> function. |
1146 | |
1147 | =item tan |
1148 | |
1149 | This is identical to the C function C<tan()>. |
1150 | |
1151 | =item tanh |
1152 | |
1153 | This is identical to the C function C<tanh()>. |
1154 | |
1155 | =item tcdrain |
1156 | |
cb1a09d0 |
1157 | This is similar to the C function C<tcdrain()>. |
37120919 |
1158 | |
1159 | Returns C<undef> on failure. |
1160 | |
1161 | =item tcflow |
1162 | |
cb1a09d0 |
1163 | This is similar to the C function C<tcflow()>. |
37120919 |
1164 | |
1165 | Returns C<undef> on failure. |
1166 | |
1167 | =item tcflush |
1168 | |
cb1a09d0 |
1169 | This is similar to the C function C<tcflush()>. |
37120919 |
1170 | |
1171 | Returns C<undef> on failure. |
1172 | |
1173 | =item tcgetpgrp |
1174 | |
1175 | This is identical to the C function C<tcgetpgrp()>. |
1176 | |
1177 | =item tcsendbreak |
1178 | |
cb1a09d0 |
1179 | This is similar to the C function C<tcsendbreak()>. |
37120919 |
1180 | |
1181 | Returns C<undef> on failure. |
1182 | |
1183 | =item tcsetpgrp |
1184 | |
cb1a09d0 |
1185 | This is similar to the C function C<tcsetpgrp()>. |
37120919 |
1186 | |
1187 | Returns C<undef> on failure. |
1188 | |
1189 | =item time |
1190 | |
1191 | This is identical to Perl's builtin C<time()> function. |
1192 | |
1193 | =item times |
1194 | |
1195 | The times() function returns elapsed realtime since some point in the past |
1196 | (such as system startup), user and system times for this process, and user |
1197 | and system times used by child processes. All times are returned in clock |
1198 | ticks. |
1199 | |
1200 | ($realtime, $user, $system, $cuser, $csystem) = POSIX::times(); |
1201 | |
1202 | Note: Perl's builtin C<times()> function returns four values, measured in |
1203 | seconds. |
1204 | |
1205 | =item tmpfile |
1206 | |
28757baa |
1207 | Use method C<IO::File::new_tmpfile()> instead. |
37120919 |
1208 | |
1209 | =item tmpnam |
1210 | |
1211 | Returns a name for a temporary file. |
1212 | |
1213 | $tmpfile = POSIX::tmpnam(); |
1214 | |
1215 | =item tolower |
1216 | |
1217 | This is identical to Perl's builtin C<lc()> function. |
1218 | |
1219 | =item toupper |
1220 | |
1221 | This is identical to Perl's builtin C<uc()> function. |
1222 | |
1223 | =item ttyname |
1224 | |
cb1a09d0 |
1225 | This is identical to the C function C<ttyname()>. |
37120919 |
1226 | |
1227 | =item tzname |
1228 | |
cb1a09d0 |
1229 | Retrieves the time conversion information from the C<tzname> variable. |
1230 | |
1231 | POSIX::tzset(); |
1232 | ($std, $dst) = POSIX::tzname(); |
37120919 |
1233 | |
1234 | =item tzset |
1235 | |
1236 | This is identical to the C function C<tzset()>. |
1237 | |
1238 | =item umask |
1239 | |
1240 | This is identical to Perl's builtin C<umask()> function. |
1241 | |
1242 | =item uname |
1243 | |
cb1a09d0 |
1244 | Get name of current operating system. |
1245 | |
1246 | ($sysname, $nodename, $release, $version, $machine ) = POSIX::uname(); |
37120919 |
1247 | |
1248 | =item ungetc |
1249 | |
28757baa |
1250 | Use method C<IO::Handle::ungetc()> instead. |
37120919 |
1251 | |
1252 | =item unlink |
1253 | |
1254 | This is identical to Perl's builtin C<unlink()> function. |
1255 | |
1256 | =item utime |
1257 | |
1258 | This is identical to Perl's builtin C<utime()> function. |
1259 | |
1260 | =item vfprintf |
1261 | |
1262 | vfprintf() is C-specific. |
1263 | |
1264 | =item vprintf |
1265 | |
1266 | vprintf() is C-specific. |
1267 | |
1268 | =item vsprintf |
1269 | |
1270 | vsprintf() is C-specific. |
1271 | |
1272 | =item wait |
1273 | |
cb1a09d0 |
1274 | This is identical to Perl's builtin C<wait()> function. |
37120919 |
1275 | |
1276 | =item waitpid |
1277 | |
cb1a09d0 |
1278 | Wait for a child process to change state. This is identical to Perl's |
1279 | builtin C<waitpid()> function. |
1280 | |
1281 | $pid = POSIX::waitpid( -1, &POSIX::WNOHANG ); |
1282 | print "status = ", ($? / 256), "\n"; |
37120919 |
1283 | |
1284 | =item wcstombs |
1285 | |
cb1a09d0 |
1286 | This is identical to the C function C<wcstombs()>. |
37120919 |
1287 | |
1288 | =item wctomb |
1289 | |
cb1a09d0 |
1290 | This is identical to the C function C<wctomb()>. |
37120919 |
1291 | |
1292 | =item write |
1293 | |
cb1a09d0 |
1294 | Write to a file. This uses file descriptors such as those obtained by |
1295 | calling C<POSIX::open>. |
1296 | |
1297 | $fd = POSIX::open( "foo", &POSIX::O_WRONLY ); |
1298 | $buf = "hello"; |
1299 | $bytes = POSIX::write( $b, $buf, 5 ); |
37120919 |
1300 | |
1301 | Returns C<undef> on failure. |
1302 | |
1303 | =back |
1304 | |
1305 | =head1 CLASSES |
1306 | |
37120919 |
1307 | =head2 POSIX::SigAction |
1308 | |
1309 | =over 8 |
1310 | |
1311 | =item new |
1312 | |
cb1a09d0 |
1313 | Creates a new C<POSIX::SigAction> object which corresponds to the C |
1314 | C<struct sigaction>. This object will be destroyed automatically when it is |
1315 | no longer needed. The first parameter is the fully-qualified name of a sub |
1316 | which is a signal-handler. The second parameter is a C<POSIX::SigSet> |
28757baa |
1317 | object, it defaults to the empty set. The third parameter contains the |
1318 | C<sa_flags>, it defaults to 0. |
cb1a09d0 |
1319 | |
28757baa |
1320 | $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); |
cb1a09d0 |
1321 | $sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP ); |
1322 | |
1323 | This C<POSIX::SigAction> object should be used with the C<POSIX::sigaction()> |
1324 | function. |
37120919 |
1325 | |
1326 | =back |
1327 | |
1328 | =head2 POSIX::SigSet |
1329 | |
1330 | =over 8 |
1331 | |
1332 | =item new |
1333 | |
1334 | Create a new SigSet object. This object will be destroyed automatically |
1335 | when it is no longer needed. Arguments may be supplied to initialize the |
1336 | set. |
1337 | |
1338 | Create an empty set. |
1339 | |
1340 | $sigset = POSIX::SigSet->new; |
1341 | |
1342 | Create a set with SIGUSR1. |
1343 | |
1344 | $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 ); |
1345 | |
1346 | =item addset |
1347 | |
1348 | Add a signal to a SigSet object. |
1349 | |
1350 | $sigset->addset( &POSIX::SIGUSR2 ); |
1351 | |
1352 | Returns C<undef> on failure. |
1353 | |
1354 | =item delset |
1355 | |
1356 | Remove a signal from the SigSet object. |
1357 | |
1358 | $sigset->delset( &POSIX::SIGUSR2 ); |
1359 | |
1360 | Returns C<undef> on failure. |
1361 | |
1362 | =item emptyset |
1363 | |
1364 | Initialize the SigSet object to be empty. |
1365 | |
1366 | $sigset->emptyset(); |
1367 | |
1368 | Returns C<undef> on failure. |
1369 | |
1370 | =item fillset |
1371 | |
1372 | Initialize the SigSet object to include all signals. |
1373 | |
1374 | $sigset->fillset(); |
1375 | |
1376 | Returns C<undef> on failure. |
1377 | |
1378 | =item ismember |
1379 | |
1380 | Tests the SigSet object to see if it contains a specific signal. |
1381 | |
1382 | if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ |
1383 | print "contains SIGUSR1\n"; |
1384 | } |
1385 | |
1386 | =back |
1387 | |
1388 | =head2 POSIX::Termios |
1389 | |
1390 | =over 8 |
1391 | |
1392 | =item new |
1393 | |
1394 | Create a new Termios object. This object will be destroyed automatically |
1395 | when it is no longer needed. |
1396 | |
1397 | $termios = POSIX::Termios->new; |
1398 | |
1399 | =item getattr |
1400 | |
cb1a09d0 |
1401 | Get terminal control attributes. |
1402 | |
1403 | Obtain the attributes for stdin. |
1404 | |
1405 | $termios->getattr() |
1406 | |
1407 | Obtain the attributes for stdout. |
1408 | |
1409 | $termios->getattr( 1 ) |
37120919 |
1410 | |
1411 | Returns C<undef> on failure. |
1412 | |
1413 | =item getcc |
1414 | |
1415 | Retrieve a value from the c_cc field of a termios object. The c_cc field is |
1416 | an array so an index must be specified. |
1417 | |
1418 | $c_cc[1] = $termios->getcc(1); |
1419 | |
1420 | =item getcflag |
1421 | |
1422 | Retrieve the c_cflag field of a termios object. |
1423 | |
1424 | $c_cflag = $termios->getcflag; |
1425 | |
1426 | =item getiflag |
1427 | |
1428 | Retrieve the c_iflag field of a termios object. |
1429 | |
1430 | $c_iflag = $termios->getiflag; |
1431 | |
1432 | =item getispeed |
1433 | |
1434 | Retrieve the input baud rate. |
1435 | |
1436 | $ispeed = $termios->getispeed; |
1437 | |
1438 | =item getlflag |
1439 | |
1440 | Retrieve the c_lflag field of a termios object. |
1441 | |
1442 | $c_lflag = $termios->getlflag; |
1443 | |
1444 | =item getoflag |
1445 | |
1446 | Retrieve the c_oflag field of a termios object. |
1447 | |
1448 | $c_oflag = $termios->getoflag; |
1449 | |
1450 | =item getospeed |
1451 | |
1452 | Retrieve the output baud rate. |
1453 | |
1454 | $ospeed = $termios->getospeed; |
1455 | |
1456 | =item setattr |
1457 | |
cb1a09d0 |
1458 | Set terminal control attributes. |
1459 | |
1460 | Set attributes immediately for stdout. |
1461 | |
1462 | $termios->setattr( 1, &POSIX::TCSANOW ); |
37120919 |
1463 | |
1464 | Returns C<undef> on failure. |
1465 | |
1466 | =item setcc |
1467 | |
1468 | Set a value in the c_cc field of a termios object. The c_cc field is an |
1469 | array so an index must be specified. |
1470 | |
6b7a6f50 |
1471 | $termios->setcc( &POSIX::VEOF, 1 ); |
37120919 |
1472 | |
1473 | =item setcflag |
1474 | |
1475 | Set the c_cflag field of a termios object. |
1476 | |
1477 | $termios->setcflag( &POSIX::CLOCAL ); |
1478 | |
1479 | =item setiflag |
1480 | |
1481 | Set the c_iflag field of a termios object. |
1482 | |
1483 | $termios->setiflag( &POSIX::BRKINT ); |
1484 | |
1485 | =item setispeed |
1486 | |
1487 | Set the input baud rate. |
1488 | |
1489 | $termios->setispeed( &POSIX::B9600 ); |
1490 | |
1491 | Returns C<undef> on failure. |
1492 | |
1493 | =item setlflag |
1494 | |
1495 | Set the c_lflag field of a termios object. |
1496 | |
1497 | $termios->setlflag( &POSIX::ECHO ); |
1498 | |
1499 | =item setoflag |
1500 | |
1501 | Set the c_oflag field of a termios object. |
1502 | |
1503 | $termios->setoflag( &POSIX::OPOST ); |
1504 | |
1505 | =item setospeed |
1506 | |
1507 | Set the output baud rate. |
1508 | |
1509 | $termios->setospeed( &POSIX::B9600 ); |
1510 | |
1511 | Returns C<undef> on failure. |
1512 | |
1513 | =item Baud rate values |
1514 | |
1515 | B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110 |
1516 | |
1517 | =item Terminal interface values |
1518 | |
1519 | TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH TCSAFLUSH TCIOFF TCOOFF |
1520 | |
1521 | =item c_cc field values |
1522 | |
1523 | VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS |
1524 | |
1525 | =item c_cflag field values |
1526 | |
1527 | CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD |
1528 | |
1529 | =item c_iflag field values |
1530 | |
1531 | BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK |
1532 | |
1533 | =item c_lflag field values |
1534 | |
1535 | ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP |
1536 | |
1537 | =item c_oflag field values |
1538 | |
1539 | OPOST |
1540 | |
1541 | =back |
1542 | |
1543 | =head1 PATHNAME CONSTANTS |
1544 | |
1545 | =over 8 |
1546 | |
1547 | =item Constants |
1548 | |
1549 | _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF _PC_VDISABLE |
1550 | |
1551 | =back |
1552 | |
1553 | =head1 POSIX CONSTANTS |
1554 | |
1555 | =over 8 |
1556 | |
1557 | =item Constants |
1558 | |
1559 | _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION |
1560 | |
1561 | =back |
1562 | |
1563 | =head1 SYSTEM CONFIGURATION |
1564 | |
1565 | =over 8 |
1566 | |
1567 | =item Constants |
1568 | |
1569 | _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION |
1570 | |
1571 | =back |
1572 | |
1573 | =head1 ERRNO |
1574 | |
1575 | =over 8 |
1576 | |
1577 | =item Constants |
1578 | |
774d564b |
1579 | E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF |
1580 | EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ |
1581 | EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR |
1582 | EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG |
1583 | ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC |
1584 | ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR |
1585 | ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE |
1586 | EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART EROFS |
1587 | ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS |
1588 | ETXTBSY EUSERS EWOULDBLOCK EXDEV |
37120919 |
1589 | |
1590 | =back |
1591 | |
1592 | =head1 FCNTL |
1593 | |
1594 | =over 8 |
1595 | |
1596 | =item Constants |
1597 | |
1598 | FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC O_WRONLY |
1599 | |
1600 | =back |
1601 | |
1602 | =head1 FLOAT |
1603 | |
1604 | =over 8 |
1605 | |
1606 | =item Constants |
1607 | |
1608 | DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP |
1609 | |
1610 | =back |
1611 | |
1612 | =head1 LIMITS |
1613 | |
1614 | =over 8 |
1615 | |
1616 | =item Constants |
1617 | |
1618 | ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX |
1619 | |
1620 | =back |
1621 | |
1622 | =head1 LOCALE |
1623 | |
1624 | =over 8 |
1625 | |
1626 | =item Constants |
1627 | |
1628 | LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME |
1629 | |
1630 | =back |
1631 | |
1632 | =head1 MATH |
1633 | |
1634 | =over 8 |
1635 | |
1636 | =item Constants |
1637 | |
1638 | HUGE_VAL |
1639 | |
1640 | =back |
1641 | |
1642 | =head1 SIGNAL |
1643 | |
1644 | =over 8 |
1645 | |
1646 | =item Constants |
1647 | |
774d564b |
1648 | SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART |
1649 | SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT |
1650 | SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU |
1651 | SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK |
1652 | SIG_UNBLOCK |
37120919 |
1653 | |
1654 | =back |
1655 | |
1656 | =head1 STAT |
1657 | |
1658 | =over 8 |
1659 | |
1660 | =item Constants |
1661 | |
1662 | S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR |
1663 | |
1664 | =item Macros |
1665 | |
1666 | S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG |
1667 | |
1668 | =back |
1669 | |
1670 | =head1 STDLIB |
1671 | |
1672 | =over 8 |
1673 | |
1674 | =item Constants |
1675 | |
1676 | EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX |
1677 | |
1678 | =back |
1679 | |
1680 | =head1 STDIO |
1681 | |
1682 | =over 8 |
1683 | |
1684 | =item Constants |
1685 | |
c07a80fd |
1686 | BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX |
37120919 |
1687 | |
1688 | =back |
1689 | |
1690 | =head1 TIME |
1691 | |
1692 | =over 8 |
1693 | |
1694 | =item Constants |
1695 | |
1696 | CLK_TCK CLOCKS_PER_SEC |
1697 | |
1698 | =back |
1699 | |
1700 | =head1 UNISTD |
1701 | |
1702 | =over 8 |
1703 | |
1704 | =item Constants |
1705 | |
1706 | R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO STRERR_FILENO W_OK X_OK |
1707 | |
1708 | =back |
1709 | |
1710 | =head1 WAIT |
1711 | |
1712 | =over 8 |
1713 | |
1714 | =item Constants |
1715 | |
1716 | WNOHANG WUNTRACED |
1717 | |
1718 | =item Macros |
1719 | |
1720 | WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG |
1721 | |
1722 | =back |
1723 | |
1724 | =head1 CREATION |
1725 | |
c07a80fd |
1726 | This document generated by ./mkposixman.PL version 19960129. |
37120919 |
1727 | |