9abad2a86f864ee2a6c740c7f9558a23e32e7c13
[p5sagit/p5-mst-13.2.git] / ext / POSIX / POSIX.pod
1 =head1 NAME
2
3 POSIX - Perl interface to IEEE Std 1003.1
4
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
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
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()>.  It exits the program
69 immediately which means among other things buffered I/O is B<not> flushed.
70
71 =item abort
72
73 This is identical to the C function C<abort()>.  It terminates the
74 process with a C<SIGABRT> signal unless caught by a signal handler or
75 if the handler does not return normally (it e.g.  does a C<longjmp>).
76
77 =item abs
78
79 This is identical to Perl's builtin C<abs()> function, returning
80 the absolute value of its numerical argument.
81
82 =item access
83
84 Determines the accessibility of a file.
85
86         if( POSIX::access( "/", &POSIX::R_OK ) ){
87                 print "have read permission\n";
88         }
89
90 Returns C<undef> on failure.  Note: do not use C<access()> for
91 security purposes.  Between the C<access()> call and the operation
92 you are preparing for the permissions might change: a classic
93 I<race condition>.
94
95 =item acos
96
97 This is identical to the C function C<acos()>, returning
98 the arcus cosine of its numerical argument.
99
100 =item alarm
101
102 This is identical to Perl's builtin C<alarm()> function,
103 either for arming or disarming the C<SIGARLM> timer.
104
105 =item asctime
106
107 This is identical to the C function C<asctime()>.  It returns
108 a string of the form
109
110         "Fri Jun  2 18:22:13 2000\n\0"
111
112 and it is called thusly
113
114         $asctime = asctime($sec, $min, $hour, $mday, $mon, $year,
115                            $wday, $yday, $isdst);
116
117 The C<$mon> is zero-based: January equals C<0>.  The C<$year> is
118 1900-based: 2001 equals C<101>.  The C<$wday>, C<$yday>, and C<$isdst>
119 default to zero (and the first two are usually ignored anyway).
120
121 =item asin
122
123 This is identical to the C function C<asin()>, returning
124 the arcus sine of its numerical argument.
125
126 =item assert
127
128 Unimplemented, but you can use L<perlfunc/die> and the L<Carp> module
129 to achieve similar things.
130
131 =item atan
132
133 This is identical to the C function C<atan()>, returning the
134 arcus tangent of its numerical argument.
135
136 =item atan2
137
138 This is identical to Perl's builtin C<atan2()> function, returning
139 the arcus tangent defined by its two numerical arguments, the I<y>
140 coordinate and the I<x> coordinate.
141
142 =item atexit
143
144 atexit() is C-specific: use C<END {}> instead, see L<perlsub>.
145
146 =item atof
147
148 atof() is C-specific.  Perl converts strings to numbers transparently.
149 If you need to force a scalar to a number, add a zero to it.
150
151 =item atoi
152
153 atoi() is C-specific.  Perl converts strings to numbers transparently.
154 If you need to force a scalar to a number, add a zero to it.
155 If you need to have just the integer part, see L<perlfunc/int>.
156
157 =item atol
158
159 atol() is C-specific.  Perl converts strings to numbers transparently.
160 If you need to force a scalar to a number, add a zero to it.
161 If you need to have just the integer part, see L<perlfunc/int>.
162
163 =item bsearch
164
165 bsearch() not supplied.  For doing binary search on wordlists,
166 see L<Search::Dict>.
167
168 =item calloc
169
170 calloc() is C-specific.  Perl does memory management transparently.
171
172 =item ceil
173
174 This is identical to the C function C<ceil()>, returning the smallest
175 integer value greater than or equal to the given numerical argument.
176
177 =item chdir
178
179 This is identical to Perl's builtin C<chdir()> function, allowing
180 one to change the working (default) directory, see L<perlfunc/chdir>.
181
182 =item chmod
183
184 This is identical to Perl's builtin C<chmod()> function, allowing
185 one to change file and directory permissions, see L<perlfunc/chmod>.
186
187 =item chown
188
189 This is identical to Perl's builtin C<chown()> function, allowing one
190 to change file and directory owners and groups, see L<perlfunc/chown>.
191
192 =item clearerr
193
194 Use the method L<IO::Handle::clearerr()> instead, to reset the error
195 state (if any) and EOF state (if any) of the given stream.
196
197 =item clock
198
199 This is identical to the C function C<clock()>, returning the
200 amount of spent processor time in microseconds.
201
202 =item close
203
204 Close the file.  This uses file descriptors such as those obtained by calling
205 C<POSIX::open>.
206
207         $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
208         POSIX::close( $fd );
209
210 Returns C<undef> on failure.
211
212 See also L<perlfunc/close>.
213
214 =item closedir
215
216 This is identical to Perl's builtin C<closedir()> function for closing
217 a directory handle, see L<perlfunc/closedir>.
218
219 =item cos
220
221 This is identical to Perl's builtin C<cos()> function, for returning
222 the cosine of its numerical argument, see L<perlfunc/cos>.
223
224 =item cosh
225
226 This is identical to the C function C<cosh()>, for returning
227 the hyperbolic cosine of its numeric argument.
228
229 =item creat
230
231 Create a new file.  This returns a file descriptor like the ones returned by
232 C<POSIX::open>.  Use C<POSIX::close> to close the file.
233
234         $fd = POSIX::creat( "foo", 0611 );
235         POSIX::close( $fd );
236
237 See also L<perlfunc/sysopen> and its C<O_CREAT> flag.
238
239 =item ctermid
240
241 Generates the path name for the controlling terminal.
242
243         $path = POSIX::ctermid();
244
245 =item ctime
246
247 This is identical to the C function C<ctime()> and equivalent
248 to C<asctime(localtime(...))>, see L</asctime> and L</localtime>.
249
250 =item cuserid
251
252 Get the login name of the owner of the current process.
253
254         $name = POSIX::cuserid();
255
256 =item difftime
257
258 This is identical to the C function C<difftime()>, for returning
259 the time difference (in seconds) between two times (as returned
260 by C<time()>), see L</time>.
261
262 =item div
263
264 div() is C-specific, use L<perlfunc/int> on the usual C</> division and
265 the modulus C<%>.
266
267 =item dup
268
269 This is similar to the C function C<dup()>, for duplicating a file
270 descriptor.
271
272 This uses file descriptors such as those obtained by calling
273 C<POSIX::open>.
274
275 Returns C<undef> on failure.
276
277 =item dup2
278
279 This is similar to the C function C<dup2()>, for duplicating a file
280 descriptor to an another known file descriptor.
281
282 This uses file descriptors such as those obtained by calling
283 C<POSIX::open>.
284
285 Returns C<undef> on failure.
286
287 =item errno
288
289 Returns the value of errno.
290
291         $errno = POSIX::errno();
292
293 This identical to the numerical values of the C<$!>, see L<perlvar/$ERRNO>.
294
295 =item execl
296
297 execl() is C-specific, see L<perlfunc/exec>.
298
299 =item execle
300
301 execle() is C-specific, see L<perlfunc/exec>.
302
303 =item execlp
304
305 execlp() is C-specific, see L<perlfunc/exec>.
306
307 =item execv
308
309 execv() is C-specific, see L<perlfunc/exec>.
310
311 =item execve
312
313 execve() is C-specific, see L<perlfunc/exec>.
314
315 =item execvp
316
317 execvp() is C-specific, see L<perlfunc/exec>.
318
319 =item exit
320
321 This is identical to Perl's builtin C<exit()> function for exiting the
322 program, see L<perlfunc/exit>.
323
324 =item exp
325
326 This is identical to Perl's builtin C<exp()> function for
327 returning the exponent (I<e>-based) of the numerical argument,
328 see L<perlfunc/exp>.
329
330 =item fabs
331
332 This is identical to Perl's builtin C<abs()> function for returning
333 the absolute value of the numerical argument, see L<perlfunc/abs>.
334
335 =item fclose
336
337 Use method C<IO::Handle::close()> instead.
338
339 =item fcntl
340
341 This is identical to Perl's builtin C<fcntl()> function,
342 see L<perlfunc/fcntl>.
343
344 =item fdopen
345
346 Use method C<IO::Handle::new_from_fd()> instead.
347
348 =item feof
349
350 Use method C<IO::Handle::eof()> instead.
351
352 =item ferror
353
354 Use method C<IO::Handle::error()> instead.
355
356 =item fflush
357
358 Use method C<IO::Handle::flush()> instead.
359
360 =item fgetc
361
362 Use method C<IO::Handle::getc()> instead.
363
364 =item fgetpos
365
366 Use method C<IO::Seekable::getpos()> instead.
367
368 =item fgets
369
370 Use method C<IO::Handle::gets()> instead.  Similar to E<lt>E<gt>, also known
371 as L<perlfunc/readline>.
372
373 =item fileno
374
375 Use method C<IO::Handle::fileno()> instead.
376
377 =item floor
378
379 This is identical to the C function C<floor()>, returning the largest
380 integer value less than or equal to the numerical argument.
381
382 =item fmod
383
384 This is identical to the C function C<fmod()>.
385
386         $r = modf($x, $y);
387
388 It returns the remainder C<$r = $x - $n*$y>, where C<$n = trunc($x/$y)>.
389 The C<$r> has the same sign as C<$x> and magnitude (absolute value)
390 less than the magnitude of C<$y>.
391
392 =item fopen
393
394 Use method C<IO::File::open()> instead.
395
396 =item fork
397
398 This is identical to Perl's builtin C<fork()> function.
399
400 =item fpathconf
401
402 Retrieves the value of a configurable limit on a file or directory.  This
403 uses file descriptors such as those obtained by calling C<POSIX::open>.
404
405 The following will determine the maximum length of the longest allowable
406 pathname on the filesystem which holds C</tmp/foo>.
407
408         $fd = POSIX::open( "/tmp/foo", &POSIX::O_RDONLY );
409         $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX );
410
411 Returns C<undef> on failure.
412
413 =item fprintf
414
415 fprintf() is C-specific, see L<perlfunc/printf> instead.
416
417 =item fputc
418
419 fputc() is C-specific, see L<perlfunc/print> instead.
420
421 =item fputs
422
423 fputs() is C-specific, see L<perlfunc/print> instead.
424
425 =item fread
426
427 fread() is C-specific, see L<perlfunc/read> instead.
428
429 =item free
430
431 free() is C-specific.  Perl does memory management transparently.
432
433 =item freopen
434
435 freopen() is C-specific, see L<perlfunc/open> instead.
436
437 =item frexp
438
439 Return the mantissa and exponent of a floating-point number.
440
441         ($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
442
443 =item fscanf
444
445 fscanf() is C-specific, use E<lt>E<gt> and regular expressions instead.
446
447 =item fseek
448
449 Use method C<IO::Seekable::seek()> instead.
450
451 =item fsetpos
452
453 Use method C<IO::Seekable::setpos()> instead.
454
455 =item fstat
456
457 Get file status.  This uses file descriptors such as those obtained by
458 calling C<POSIX::open>.  The data returned is identical to the data from
459 Perl's builtin C<stat> function.
460
461         $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
462         @stats = POSIX::fstat( $fd );
463
464 =item ftell
465
466 Use method C<IO::Seekable::tell()> instead.
467
468 =item fwrite
469
470 fwrite() is C-specific, see L<perlfunc/print> instead.
471
472 =item getc
473
474 This is identical to Perl's builtin C<getc()> function,
475 see L<perlfunc/getc>.
476
477 =item getchar
478
479 Returns one character from STDIN.  Identical to Perl's C<getc()>,
480 see L<perlfunc/getc>.
481
482 =item getcwd
483
484 Returns the name of the current working directory.
485 See also L<Cwd>.
486
487 =item getegid
488
489 Returns the effective group identifier.  Similar to Perl' s builtin
490 variable C<$(>, see L<perlvar/$EGID>.
491
492 =item getenv
493
494 Returns the value of the specified enironment variable.
495 The same information is available through the C<%ENV> array.
496
497 =item geteuid
498
499 Returns the effective user identifier.  Identical to Perl's builtin C<$E<gt>>
500 variable, see L<perlvar/$EUID>.
501
502 =item getgid
503
504 Returns the user's real group identifier.  Similar to Perl's builtin
505 variable C<$)>, see L<perlvar/$GID>.
506
507 =item getgrgid
508
509 This is identical to Perl's builtin C<getgrgid()> function for
510 returning group entries by group identifiers, see
511 L<perlfunc/getgrgid>.
512
513 =item getgrnam
514
515 This is identical to Perl's builtin C<getgrnam()> function for
516 returning group entries by group names, see L<perlfunc/getgrnam>.
517
518 =item getgroups
519
520 Returns the ids of the user's supplementary groups.  Similar to Perl's
521 builtin variable C<$)>, see L<perlvar/$GID>.
522
523 =item getlogin
524
525 This is identical to Perl's builtin C<getlogin()> function for
526 returning the user name associated with the current session, see
527 L<perlfunc/getlogin>.
528
529 =item getpgrp
530
531 This is identical to Perl's builtin C<getpgrp()> function for
532 returning the prcess group identifier of the current process, see
533 L<perlfunc/getpgrp>.
534
535 =item getpid
536
537 Returns the process identifier.  Identical to Perl's builtin
538 variable C<$$>, see L<perlvar/$PID>.
539
540 =item getppid
541
542 This is identical to Perl's builtin C<getppid()> function for
543 returning the process identifier of the parent process of the current
544 process , see L<perlfunc/getppid>.
545
546 =item getpwnam
547
548 This is identical to Perl's builtin C<getpwnam()> function for
549 returning user entries by user names, see L<perlfunc/getpwnam>.
550
551 =item getpwuid
552
553 This is identical to Perl's builtin C<getpwuid()> function for
554 returning user entries by user identifiers, see L<perlfunc/getpwuid>.
555
556 =item gets
557
558 Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known
559 as the C<readline()> function, see L<perlfunc/readline>.
560
561 B<NOTE>: if you have C programs that still use C<gets()>, be very
562 afraid.  The C<gets()> function is a source of endless grief because
563 it has no buffer overrun checks.  It should B<never> be used.  The
564 C<fgets()> function should be preferred instead.
565
566 =item getuid
567
568 Returns the user's identifier.  Identical to Perl's builtin C<$E<lt>> variable,
569 see L<perlvar/$UID>.
570
571 =item gmtime
572
573 This is identical to Perl's builtin C<gmtime()> function for
574 converting seconds since the epoch to a date in Greenwich Mean Time,
575 see L<perlfunc/gmtime>.
576
577 =item isalnum
578
579 This is identical to the C function, except that it can apply to a single
580 character or to a whole string.  Consider using regular expressions and the
581 C</[[:isalnum:]]/> construct instead, or possibly the C</\w/> construct.
582
583 =item isalpha
584
585 This is identical to the C function, except that it can apply to a single
586 character or to a whole string.  Consider using regular expressions and the
587 C</[[:isalpha:]]/> construct instead.
588
589 =item isatty
590
591 Returns a boolean indicating whether the specified filehandle is connected
592 to a tty.  Similar to the C<-t> operator, see L<perlfunc/-X>.
593
594 =item iscntrl
595
596 This is identical to the C function, except that it can apply to a single
597 character or to a whole string.  Consider using regular expressions and the
598 C</[[:iscntrl:]]/> construct instead.
599
600 =item isdigit
601
602 This is identical to the C function, except that it can apply to a single
603 character or to a whole string.  Consider using regular expressions and the
604 C</[[:isdigit:]]/> construct instead, or the C</\d/> construct.
605
606 =item isgraph
607
608 This is identical to the C function, except that it can apply to a single
609 character or to a whole string.  Consider using regular expressions and the
610 C</[[:isgraph:]]/> construct instead.
611
612 =item islower
613
614 This is identical to the C function, except that it can apply to a single
615 character or to a whole string.  Consider using regular expressions and the
616 C</[[:islower:]]/> construct instead.  Do B<not> use C</a-z/>.
617
618 =item isprint
619
620 This is identical to the C function, except that it can apply to a single
621 character or to a whole string.  Consider using regular expressions and the
622 C</[[:isprint:]]/> construct instead.
623
624 =item ispunct
625
626 This is identical to the C function, except that it can apply to a single
627 character or to a whole string.  Consider using regular expressions and the
628 C</[[:ispunct:]]/> construct instead.
629
630 =item isspace
631
632 This is identical to the C function, except that it can apply to a single
633 character or to a whole string.  Consider using regular expressions and the
634 C</[[:isspace:]]/> construct instead, or the C</\s/> construct.
635
636 =item isupper
637
638 This is identical to the C function, except that it can apply to a single
639 character or to a whole string.  Consider using regular expressions and the
640 C</[[:isupper:]]/> construct instead.  Do B<not> use C</A-Z/>.
641
642 =item isxdigit
643
644 This is identical to the C function, except that it can apply to a single
645 character or to a whole string.  Consider using regular expressions and the
646 C</[[:isxdigit:]]/> construct instead, or simply C</[0-9a-f]/i>.
647
648 =item kill
649
650 This is identical to Perl's builtin C<kill()> function for sending
651 signals to processes (oftern to terminate them), see L<perlfunc/kill>.
652
653 =item labs
654
655 (For returning absolute values of long integers.)
656 labs() is C-specific, see L<perlfunc/abs> instead.
657
658 =item ldexp
659
660 This is identical to the C function C<ldexp()>
661 for multiplying floating point numbers with powers of two.
662
663         $x_quadrupled = POSIX::ldexp($x, 2);
664
665 =item ldiv
666
667 (For computing dividends of long integers.)
668 ldiv() is C-specific, use C</> and C<int()> instead.
669
670 =item link
671
672 This is identical to Perl's builtin C<link()> function
673 for creating hard links into files, see L<perlfunc/link>.
674
675 =item localeconv
676
677 Get numeric formatting information.  Returns a reference to a hash
678 containing the current locale formatting values.
679
680 Here is how to query the database for the B<de> (Deutsch or German) locale.
681
682         $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
683         print "Locale = $loc\n";
684         $lconv = POSIX::localeconv();
685         print "decimal_point    = ", $lconv->{decimal_point},   "\n";
686         print "thousands_sep    = ", $lconv->{thousands_sep},   "\n";
687         print "grouping = ", $lconv->{grouping},        "\n";
688         print "int_curr_symbol  = ", $lconv->{int_curr_symbol}, "\n";
689         print "currency_symbol  = ", $lconv->{currency_symbol}, "\n";
690         print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
691         print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
692         print "mon_grouping     = ", $lconv->{mon_grouping},    "\n";
693         print "positive_sign    = ", $lconv->{positive_sign},   "\n";
694         print "negative_sign    = ", $lconv->{negative_sign},   "\n";
695         print "int_frac_digits  = ", $lconv->{int_frac_digits}, "\n";
696         print "frac_digits      = ", $lconv->{frac_digits},     "\n";
697         print "p_cs_precedes    = ", $lconv->{p_cs_precedes},   "\n";
698         print "p_sep_by_space   = ", $lconv->{p_sep_by_space},  "\n";
699         print "n_cs_precedes    = ", $lconv->{n_cs_precedes},   "\n";
700         print "n_sep_by_space   = ", $lconv->{n_sep_by_space},  "\n";
701         print "p_sign_posn      = ", $lconv->{p_sign_posn},     "\n";
702         print "n_sign_posn      = ", $lconv->{n_sign_posn},     "\n";
703
704 =item localtime
705
706 This is identical to Perl's builtin C<localtime()> function for
707 converting seconds since the epoch to a date see L<perlfunc/localtime>.
708
709 =item log
710
711 This is identical to Perl's builtin C<log()> function,
712 returning the natural (I<e>-based) logarithm of the numerical argument,
713 see L<perlfunc/log>.
714
715 =item log10
716
717 This is identical to the C function C<log10()>,
718 returning the 10-base logarithm of the numerical argument.
719 You can also use
720
721     sub log10 { log($_[0]) / log(10) }
722
723 or
724
725     sub log10 { log($_[0]) / 2.30258509299405 }  
726
727 or
728
729     sub log10 { log($_[0]) * 0.434294481903252 }
730
731 =item longjmp
732
733 longjmp() is C-specific: use L<perlfunc/die> instead.
734
735 =item lseek
736
737 Move the file's read/write position.  This uses file descriptors such as
738 those obtained by calling C<POSIX::open>.
739
740         $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
741         $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
742
743 Returns C<undef> on failure.
744
745 =item malloc
746
747 malloc() is C-specific.  Perl does memory management transparently.
748
749 =item mblen
750
751 This is identical to the C function C<mblen()>.
752 Perl does not have any support for the wide and multibyte
753 characters of the C standards, so this might be a rather 
754 useless function.
755
756 =item mbstowcs
757
758 This is identical to the C function C<mbstowcs()>.
759 Perl does not have any support for the wide and multibyte
760 characters of the C standards, so this might be a rather 
761 useless function.
762
763 =item mbtowc
764
765 This is identical to the C function C<mbtowc()>.
766 Perl does not have any support for the wide and multibyte
767 characters of the C standards, so this might be a rather 
768 useless function.
769
770 =item memchr
771
772 memchr() is C-specific, see L<perlfunc/index> instead.
773
774 =item memcmp
775
776 memcmp() is C-specific, use C<eq> instead, see L<perlop>.
777
778 =item memcpy
779
780 memcpy() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.
781
782 =item memmove
783
784 memmove() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.
785
786 =item memset
787
788 memset() is C-specific, use C<x> instead, see L<perlop>.
789
790 =item mkdir
791
792 This is identical to Perl's builtin C<mkdir()> function
793 for creating directories, see L<perlfunc/mkdir>.
794
795 =item mkfifo
796
797 This is similar to the C function C<mkfifo()> for creating
798 FIFO special files.
799
800         if (mkfifo($path, $mode)) { ....
801
802 Returns C<undef> on failure.  The C<$mode> is similar to the
803 mode of C<mkdir()>, see L<perlfunc/mkdir>.
804
805 =item mktime
806
807 Convert date/time info to a calendar time.
808
809 Synopsis:
810
811         mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
812
813 The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
814 I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1.  The
815 year (C<year>) is given in years since 1900.  I.e. The year 1995 is 95; the
816 year 2001 is 101.  Consult your system's C<mktime()> manpage for details
817 about these and the other arguments.
818
819 Calendar time for December 12, 1995, at 10:30 am.
820
821         $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
822         print "Date = ", POSIX::ctime($time_t);
823
824 Returns C<undef> on failure.
825
826 =item modf
827
828 Return the integral and fractional parts of a floating-point number.
829
830         ($fractional, $integral) = POSIX::modf( 3.14 );
831
832 =item nice
833
834 This is similar to the C function C<nice()>, for changing
835 the scheduling preference of the current process.  Positive
836 arguments mean more polite process, negative values more
837 needy process.  Normal user processes can only be more polite.
838
839 Returns C<undef> on failure.
840
841 =item offsetof
842
843 offsetof() is C-specific, you probably want to see L<perlfunc/pack> instead.
844
845 =item open
846
847 Open a file for reading for writing.  This returns file descriptors, not
848 Perl filehandles.  Use C<POSIX::close> to close the file.
849
850 Open a file read-only with mode 0666.
851
852         $fd = POSIX::open( "foo" );
853
854 Open a file for read and write.
855
856         $fd = POSIX::open( "foo", &POSIX::O_RDWR );
857
858 Open a file for write, with truncation.
859
860         $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
861
862 Create a new file with mode 0640.  Set up the file for writing.
863
864         $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
865
866 Returns C<undef> on failure.
867
868 See also L<perlfunc/sysopen>.
869
870 =item opendir
871
872 Open a directory for reading.
873
874         $dir = POSIX::opendir( "/tmp" );
875         @files = POSIX::readdir( $dir );
876         POSIX::closedir( $dir );
877
878 Returns C<undef> on failure.
879
880 =item pathconf
881
882 Retrieves the value of a configurable limit on a file or directory.
883
884 The following will determine the maximum length of the longest allowable
885 pathname on the filesystem which holds C</tmp>.
886
887         $path_max = POSIX::pathconf( "/tmp", &POSIX::_PC_PATH_MAX );
888
889 Returns C<undef> on failure.
890
891 =item pause
892
893 This is similar to the C function C<pause()>, which suspends
894 the execution of the current process until a signal is received.
895
896 Returns C<undef> on failure.
897
898 =item perror
899
900 This is identical to the C function C<perror()>, which outputs to the
901 standard error stream the specified message followed by ": " and the
902 current error string.  Use the C<warn()> function and the C<$!>
903 variable instead, see L<perlfunc/warn> and L<perlvar/$ERRNO>.
904
905 =item pipe
906
907 Create an interprocess channel.  This returns file descriptors like those
908 returned by C<POSIX::open>.
909
910         ($fd0, $fd1) = POSIX::pipe();
911         POSIX::write( $fd0, "hello", 5 );
912         POSIX::read( $fd1, $buf, 5 );
913
914 See also L<perlfunc/pipe>.
915
916 =item pow
917
918 Computes C<$x> raised to the power C<$exponent>.
919
920         $ret = POSIX::pow( $x, $exponent );
921
922 You can also use the C<**> operator, see L<perlop>.
923
924 =item printf
925
926 Formats and prints the specified arguments to STDOUT.
927 See also L<perlfunc/printf>.
928
929 =item putc
930
931 putc() is C-specific, see L<perlfunc/print> instead.
932
933 =item putchar
934
935 putchar() is C-specific, see L<perlfunc/print> instead.
936
937 =item puts
938
939 puts() is C-specific, see L<perlfunc/print> instead.
940
941 =item qsort
942
943 qsort() is C-specific, see L<perlfunc/sort> instead.
944
945 =item raise
946
947 Sends the specified signal to the current process.
948 See also L<perlfunc/kill> and the C<$$> in L<perlvar/$PID>.
949
950 =item rand
951
952 C<rand()> is non-portable, see L<perlfunc/rand> instead.
953
954 =item read
955
956 Read from a file.  This uses file descriptors such as those obtained by
957 calling C<POSIX::open>.  If the buffer C<$buf> is not large enough for the
958 read then Perl will extend it to make room for the request.
959
960         $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
961         $bytes = POSIX::read( $fd, $buf, 3 );
962
963 Returns C<undef> on failure.
964
965 See also L<perlfunc/sysread>.
966
967 =item readdir
968
969 This is identical to Perl's builtin C<readdir()> function
970 for reading directory entries, see L<perlfunc/readdir>.
971
972 =item realloc
973
974 realloc() is C-specific.  Perl does memory management transparently.
975
976 =item remove
977
978 This is identical to Perl's builtin C<unlink()> function
979 for removing files, see L<perlfunc/unlink>.
980
981 =item rename
982
983 This is identical to Perl's builtin C<rename()> function
984 for renaming files, see L<perlfunc/rename>.
985
986 =item rewind
987
988 Seeks to the beginning of the file.
989
990 =item rewinddir
991
992 This is identical to Perl's builtin C<rewinddir()> function for
993 rewinding directory entry streams, see L<perlfunc/rewinddir>.
994
995 =item rmdir
996
997 This is identical to Perl's builtin C<rmdir()> function
998 for removing (empty) directories, see L<perlfunc/rmdir>.
999
1000 =item scanf
1001
1002 scanf() is C-specific, use E<lt>E<gt> and regular expressions instead,
1003 see L<perlre>.
1004
1005 =item setgid
1006
1007 Sets the real group identifier for this process.
1008 Identical to assigning a value to the Perl's builtin C<$)> variable,
1009 see L<perlvar/$UID>.
1010
1011 =item setjmp
1012
1013 C<setjmp()> is C-specific: use C<eval {}> instead,
1014 see L<perlfunc/eval>.
1015
1016 =item setlocale
1017
1018 Modifies and queries program's locale.  The following examples assume
1019
1020         use POSIX qw(setlocale LC_ALL LC_CTYPE);
1021
1022 has been issued.
1023
1024 The following will set the traditional UNIX system locale behavior
1025 (the second argument C<"C">).
1026
1027         $loc = setlocale( LC_ALL, "C" );
1028
1029 The following will query the current LC_CTYPE category.  (No second
1030 argument means 'query'.)
1031
1032         $loc = setlocale( LC_CTYPE );
1033
1034 The following will set the LC_CTYPE behaviour according to the locale
1035 environment variables (the second argument C<"">).
1036 Please see your systems L<setlocale(3)> documentation for the locale
1037 environment variables' meaning or consult L<perllocale>.
1038
1039         $loc = setlocale( LC_CTYPE, "" );
1040
1041 The following will set the LC_COLLATE behaviour to Argentinian
1042 Spanish. B<NOTE>: The naming and availability of locales depends on
1043 your operating system. Please consult L<perllocale> for how to find
1044 out which locales are available in your system.
1045
1046         $loc = setlocale( LC_ALL, "es_AR.ISO8859-1" );
1047
1048 =item setpgid
1049
1050 This is similar to the C function C<setpgid()> for
1051 setting the process group identifier of the current process.
1052
1053 Returns C<undef> on failure.
1054
1055 =item setsid
1056
1057 This is identical to the C function C<setsid()> for
1058 setting the session identifier of the current process.
1059
1060 =item setuid
1061
1062 Sets the real user identifier for this process.
1063 Identical to assigning a value to the Perl's builtin C<$E<lt>> variable,
1064 see L<perlvar/$UID>.
1065
1066 =item sigaction
1067
1068 Detailed signal management.  This uses C<POSIX::SigAction> objects for the
1069 C<action> and C<oldaction> arguments.  Consult your system's C<sigaction>
1070 manpage for details.
1071
1072 Synopsis:
1073
1074         sigaction(sig, action, oldaction = 0)
1075
1076 Returns C<undef> on failure.
1077
1078 =item siglongjmp
1079
1080 siglongjmp() is C-specific: use L<perlfunc/die> instead.
1081
1082 =item sigpending
1083
1084 Examine signals that are blocked and pending.  This uses C<POSIX::SigSet>
1085 objects for the C<sigset> argument.  Consult your system's C<sigpending>
1086 manpage for details.
1087
1088 Synopsis:
1089
1090         sigpending(sigset)
1091
1092 Returns C<undef> on failure.
1093
1094 =item sigprocmask
1095
1096 Change and/or examine calling process's signal mask.  This uses
1097 C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments.
1098 Consult your system's C<sigprocmask> manpage for details.
1099
1100 Synopsis:
1101
1102         sigprocmask(how, sigset, oldsigset = 0)
1103
1104 Returns C<undef> on failure.
1105
1106 =item sigsetjmp
1107
1108 C<sigsetjmp()> is C-specific: use C<eval {}> instead,
1109 see L<perlfunc/eval>.
1110
1111 =item sigsuspend
1112
1113 Install a signal mask and suspend process until signal arrives.  This uses
1114 C<POSIX::SigSet> objects for the C<signal_mask> argument.  Consult your
1115 system's C<sigsuspend> manpage for details.
1116
1117 Synopsis:
1118
1119         sigsuspend(signal_mask)
1120
1121 Returns C<undef> on failure.
1122
1123 =item sin
1124
1125 This is identical to Perl's builtin C<sin()> function
1126 for returning the sine of the numerical argument,
1127 see L<perlfunc/sin>.
1128
1129 =item sinh
1130
1131 This is identical to the C function C<sinh()>
1132 for returning the hyperbolic sine of the numerical argument.
1133
1134 =item sleep
1135
1136 This is identical to Perl's builtin C<sleep()> function
1137 for suspending the execution of the current for process
1138 for certain number of seconds, see L<perlfunc/sleep>.
1139
1140 =item sprintf
1141
1142 This is similar to Perl's builtin C<sprintf()> function
1143 for returning a string that has the arguments formatted as requested,
1144 see L<perlfunc/sprintf>.
1145
1146 =item sqrt
1147
1148 This is identical to Perl's builtin C<sqrt()> function.
1149 for returning the square root of the numerical argument,
1150 see L<perlfunc/sqrt>.
1151
1152 =item srand
1153
1154 Give a seed the pseudorandom number generator, see L<perlfunc/srand>.
1155
1156 =item sscanf
1157
1158 sscanf() is C-specific, use regular expressions instead,
1159 see L<perlre>.
1160
1161 =item stat
1162
1163 This is identical to Perl's builtin C<stat()> function
1164 for retutning information about files and directories.
1165
1166 =item strcat
1167
1168 strcat() is C-specific, use C<.=> instead, see L<perlop>.
1169
1170 =item strchr
1171
1172 strchr() is C-specific, see L<perlfunc/index> instead.
1173
1174 =item strcmp
1175
1176 strcmp() is C-specific, use C<eq> or C<cmp> instead, see L<perlop>.
1177
1178 =item strcoll
1179
1180 This is identical to the C function C<strcoll()>
1181 for collating (comparing) strings transformed using
1182 the C<strxfrm()> function.  Not really needed since
1183 Perl can do this transparently, see L<perllocale>.
1184
1185 =item strcpy
1186
1187 strcpy() is C-specific, use C<=> instead, see L<perlop>.
1188
1189 =item strcspn
1190
1191 strcspn() is C-specific, use regular expressions instead,
1192 see L<perlre>.
1193
1194 =item strerror
1195
1196 Returns the error string for the specified errno.
1197 Identical to the string form of the C<$!>, see L<perlvar/$ERRNO>.
1198
1199 =item strftime
1200
1201 Convert date and time information to string.  Returns the string.
1202
1203 Synopsis:
1204
1205         strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
1206
1207 The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
1208 I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1.  The
1209 year (C<year>) is given in years since 1900.  I.e., the year 1995 is 95; the
1210 year 2001 is 101.  Consult your system's C<strftime()> manpage for details
1211 about these and the other arguments.
1212 If you want your code to be portable, your format (C<fmt>) argument
1213 should use only the conversion specifiers defined by the ANSI C
1214 standard.  These are C<aAbBcdHIjmMpSUwWxXyYZ%>.
1215 The given arguments are made consistent
1216 as though by calling C<mktime()> before calling your system's
1217 C<strftime()> function, except that the C<isdst> value is not affected.
1218
1219 The string for Tuesday, December 12, 1995.
1220
1221         $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 );
1222         print "$str\n";
1223
1224 =item strlen
1225
1226 strlen() is C-specific, use C<length()> instead, see L<perlfunc/length>.
1227
1228 =item strncat
1229
1230 strncat() is C-specific, use C<.=> instead, see L<perlop>.
1231
1232 =item strncmp
1233
1234 strncmp() is C-specific, use C<eq> instead, see L<perlop>.
1235
1236 =item strncpy
1237
1238 strncpy() is C-specific, use C<=> instead, see L<perlop>.
1239
1240 =item strpbrk
1241
1242 strpbrk() is C-specific, use regular expressions instead,
1243 see L<perlre>.
1244
1245 =item strrchr
1246
1247 strrchr() is C-specific, see L<perlfunc/rindex> instead.
1248
1249 =item strspn
1250
1251 strspn() is C-specific, use regular expressions instead,
1252 see L<perlre>.
1253
1254 =item strstr
1255
1256 This is identical to Perl's builtin C<index()> function,
1257 see L<perlfunc/index>.
1258
1259 =item strtod
1260
1261 String to double translation. Returns the parsed number and the number
1262 of characters in the unparsed portion of the string.  Truly
1263 POSIX-compliant systems set $! ($ERRNO) to indicate a translation
1264 error, so clear $! before calling strtod.  However, non-POSIX systems
1265 may not check for overflow, and therefore will never set $!.
1266
1267 strtod should respect any POSIX I<setlocale()> settings.
1268
1269 To parse a string $str as a floating point number use
1270
1271     $! = 0;
1272     ($num, $n_unparsed) = POSIX::strtod($str);
1273
1274 The second returned item and $! can be used to check for valid input:
1275
1276     if (($str eq '') || ($n_unparsed != 0) || !$!) {
1277         die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
1278     }
1279
1280 When called in a scalar context strtod returns the parsed number.
1281
1282 =item strtok
1283
1284 strtok() is C-specific, use regular expressions instead, see
1285 L<perlre>, or L<perlfunc/split>.
1286
1287 =item strtol
1288
1289 String to (long) integer translation.  Returns the parsed number and
1290 the number of characters in the unparsed portion of the string.  Truly
1291 POSIX-compliant systems set $! ($ERRNO) to indicate a translation
1292 error, so clear $! before calling strtol.  However, non-POSIX systems
1293 may not check for overflow, and therefore will never set $!.
1294
1295 strtol should respect any POSIX I<setlocale()> settings.
1296
1297 To parse a string $str as a number in some base $base use
1298
1299     $! = 0;
1300     ($num, $n_unparsed) = POSIX::strtol($str, $base);
1301
1302 The base should be zero or between 2 and 36, inclusive.  When the base
1303 is zero or omitted strtol will use the string itself to determine the
1304 base: a leading "0x" or "0X" means hexadecimal; a leading "0" means
1305 octal; any other leading characters mean decimal.  Thus, "1234" is
1306 parsed as a decimal number, "01234" as an octal number, and "0x1234"
1307 as a hexadecimal number.
1308
1309 The second returned item and $! can be used to check for valid input:
1310
1311     if (($str eq '') || ($n_unparsed != 0) || !$!) {
1312         die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
1313     }
1314
1315 When called in a scalar context strtol returns the parsed number.
1316
1317 =item strtoul
1318
1319 String to unsigned (long) integer translation.  strtoul() is identical
1320 to strtol() except that strtoul() only parses unsigned integers.  See
1321 L</strtol> for details.
1322
1323 Note: Some vendors supply strtod() and strtol() but not strtoul().
1324 Other vendors that do supply strtoul() parse "-1" as a valid value.
1325
1326 =item strxfrm
1327
1328 String transformation.  Returns the transformed string.
1329
1330         $dst = POSIX::strxfrm( $src );
1331
1332 Used in conjunction with the C<strcoll()> function, see L</strcoll>.
1333
1334 Not really needed since Perl can do this transparently, see
1335 L<perllocale>.
1336
1337 =item sysconf
1338
1339 Retrieves values of system configurable variables.
1340
1341 The following will get the machine's clock speed.
1342
1343         $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
1344
1345 Returns C<undef> on failure.
1346
1347 =item system
1348
1349 This is identical to Perl's builtin C<system()> function, see
1350 L<perlfunc/system>.
1351
1352 =item tan
1353
1354 This is identical to the C function C<tan()>, returning the
1355 tangent of the numerical argument.
1356
1357 =item tanh
1358
1359 This is identical to the C function C<tanh()>, returning the
1360 hyperbolic tangent of the numerical argument.
1361
1362 =item tcdrain
1363
1364 This is similar to the C function C<tcdrain()> for draining
1365 the output queue of its argument stream.
1366
1367 Returns C<undef> on failure.
1368
1369 =item tcflow
1370
1371 This is similar to the C function C<tcflow()> for controlling
1372 the flow of its argument stream.
1373
1374 Returns C<undef> on failure.
1375
1376 =item tcflush
1377
1378 This is similar to the C function C<tcflush()> for flushing
1379 the I/O buffers of its argumeny stream.
1380
1381 Returns C<undef> on failure.
1382
1383 =item tcgetpgrp
1384
1385 This is identical to the C function C<tcgetpgrp()> for returning the
1386 process group identifier of the foreground process group of the controlling
1387 terminal.
1388
1389 =item tcsendbreak
1390
1391 This is similar to the C function C<tcsendbreak()> for sending
1392 a break on its argument stream.
1393
1394 Returns C<undef> on failure.
1395
1396 =item tcsetpgrp
1397
1398 This is similar to the C function C<tcsetpgrp()> for setting the
1399 process group identifier of the foreground process group of the controlling
1400 terminal.
1401
1402 Returns C<undef> on failure.
1403
1404 =item time
1405
1406 This is identical to Perl's builtin C<time()> function
1407 for returning the number of seconds since the epoch
1408 (whatever it is for the system), see L<perlfunc/time>.
1409
1410 =item times
1411
1412 The times() function returns elapsed realtime since some point in the past
1413 (such as system startup), user and system times for this process, and user
1414 and system times used by child processes.  All times are returned in clock
1415 ticks.
1416
1417     ($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
1418
1419 Note: Perl's builtin C<times()> function returns four values, measured in
1420 seconds.
1421
1422 =item tmpfile
1423
1424 Use method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>.
1425
1426 =item tmpnam
1427
1428 Returns a name for a temporary file.
1429
1430         $tmpfile = POSIX::tmpnam();
1431
1432 See also L<File::Temp>.
1433
1434 =item tolower
1435
1436 This is identical to the C function, except that it can apply to a single
1437 character or to a whole string.  Consider using the C<lc()> function,
1438 see L<perlfunc/lc>, or the equivalent C<\L> operator inside doublequotish
1439 strings.
1440
1441 =item toupper
1442
1443 This is identical to the C function, except that it can apply to a single
1444 character or to a whole string.  Consider using the C<uc()> function,
1445 see L<perlfunc/uc>, or the equivalent C<\U> operator inside doublequotish
1446 strings.
1447
1448 =item ttyname
1449
1450 This is identical to the C function C<ttyname()> for returning the
1451 name of the current terminal.
1452
1453 =item tzname
1454
1455 Retrieves the time conversion information from the C<tzname> variable.
1456
1457         POSIX::tzset();
1458         ($std, $dst) = POSIX::tzname();
1459
1460 =item tzset
1461
1462 This is identical to the C function C<tzset()> for setting
1463 the current timezone based on the environment variable C<TZ>,
1464 to be used by C<ctime()>, C<localtime()>, C<mktime()>, and C<strftime()>
1465 functions.
1466
1467 =item umask
1468
1469 This is identical to Perl's builtin C<umask()> function
1470 for setting (and querying) the file creation permission mask,
1471 see L<perlfunc/umask>.
1472
1473 =item uname
1474
1475 Get name of current operating system.
1476
1477         ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
1478
1479 Note that the actual meanings of the various fields are not
1480 that well standardized, do not expect any great portability.
1481 The C<$sysname> might be the name of the operating system,
1482 the C<$nodename> might be the name of the host, the C<$release>
1483 might be the (major) release number of the operating system,
1484 the C<$version> might be the (minor) release number of the
1485 operating system, and the C<$machine> might be a hardware identifier.
1486 Maybe.
1487
1488 =item ungetc
1489
1490 Use method C<IO::Handle::ungetc()> instead.
1491
1492 =item unlink
1493
1494 This is identical to Perl's builtin C<unlink()> function
1495 for removing files, see L<perlfunc/unlink>.
1496
1497 =item utime
1498
1499 This is identical to Perl's builtin C<utime()> function
1500 for changing the time stamps of files and directories,
1501 see L<perlfunc/utime>.
1502
1503 =item vfprintf
1504
1505 vfprintf() is C-specific, see L<perlfunc/printf> instead.
1506
1507 =item vprintf
1508
1509 vprintf() is C-specific, see L<perlfunc/printf> instead.
1510
1511 =item vsprintf
1512
1513 vsprintf() is C-specific, see L<perlfunc/sprintf> instead.
1514
1515 =item wait
1516
1517 This is identical to Perl's builtin C<wait()> function,
1518 see L<perlfunc/wait>.
1519
1520 =item waitpid
1521
1522 Wait for a child process to change state.  This is identical to Perl's
1523 builtin C<waitpid()> function, see L<perlfunc/waitpid>.
1524
1525         $pid = POSIX::waitpid( -1, &POSIX::WNOHANG );
1526         print "status = ", ($? / 256), "\n";
1527
1528 =item wcstombs
1529
1530 This is identical to the C function C<wcstombs()>.
1531 Perl does not have any support for the wide and multibyte
1532 characters of the C standards, so this might be a rather 
1533 useless function.
1534
1535 =item wctomb
1536
1537 This is identical to the C function C<wctomb()>.
1538 Perl does not have any support for the wide and multibyte
1539 characters of the C standards, so this might be a rather 
1540 useless function.
1541
1542 =item write
1543
1544 Write to a file.  This uses file descriptors such as those obtained by
1545 calling C<POSIX::open>.
1546
1547         $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
1548         $buf = "hello";
1549         $bytes = POSIX::write( $b, $buf, 5 );
1550
1551 Returns C<undef> on failure.
1552
1553 See also L<perlfunc/syswrite>.
1554
1555 =back
1556
1557 =head1 CLASSES
1558
1559 =head2 POSIX::SigAction
1560
1561 =over 8
1562
1563 =item new
1564
1565 Creates a new C<POSIX::SigAction> object which corresponds to the C
1566 C<struct sigaction>.  This object will be destroyed automatically when it is
1567 no longer needed.  The first parameter is the fully-qualified name of a sub
1568 which is a signal-handler.  The second parameter is a C<POSIX::SigSet>
1569 object, it defaults to the empty set.  The third parameter contains the
1570 C<sa_flags>, it defaults to 0.
1571
1572         $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
1573         $sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP );
1574
1575 This C<POSIX::SigAction> object should be used with the C<POSIX::sigaction()>
1576 function.
1577
1578 =back
1579
1580 =head2 POSIX::SigSet
1581
1582 =over 8
1583
1584 =item new
1585
1586 Create a new SigSet object.  This object will be destroyed automatically
1587 when it is no longer needed.  Arguments may be supplied to initialize the
1588 set.
1589
1590 Create an empty set.
1591
1592         $sigset = POSIX::SigSet->new;
1593
1594 Create a set with SIGUSR1.
1595
1596         $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
1597
1598 =item addset
1599
1600 Add a signal to a SigSet object.
1601
1602         $sigset->addset( &POSIX::SIGUSR2 );
1603
1604 Returns C<undef> on failure.
1605
1606 =item delset
1607
1608 Remove a signal from the SigSet object.
1609
1610         $sigset->delset( &POSIX::SIGUSR2 );
1611
1612 Returns C<undef> on failure.
1613
1614 =item emptyset
1615
1616 Initialize the SigSet object to be empty.
1617
1618         $sigset->emptyset();
1619
1620 Returns C<undef> on failure.
1621
1622 =item fillset
1623
1624 Initialize the SigSet object to include all signals.
1625
1626         $sigset->fillset();
1627
1628 Returns C<undef> on failure.
1629
1630 =item ismember
1631
1632 Tests the SigSet object to see if it contains a specific signal.
1633
1634         if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
1635                 print "contains SIGUSR1\n";
1636         }
1637
1638 =back
1639
1640 =head2 POSIX::Termios
1641
1642 =over 8
1643
1644 =item new
1645
1646 Create a new Termios object.  This object will be destroyed automatically
1647 when it is no longer needed.  A Termios object corresponds to the termios
1648 C struct.  new() mallocs a new one, getattr() fills it from a file descriptor,
1649 and setattr() sets a file descriptor's parameters to match Termios' contents.
1650
1651         $termios = POSIX::Termios->new;
1652
1653 =item getattr
1654
1655 Get terminal control attributes.
1656
1657 Obtain the attributes for stdin.
1658
1659         $termios->getattr()
1660
1661 Obtain the attributes for stdout.
1662
1663         $termios->getattr( 1 )
1664
1665 Returns C<undef> on failure.
1666
1667 =item getcc
1668
1669 Retrieve a value from the c_cc field of a termios object.  The c_cc field is
1670 an array so an index must be specified.
1671
1672         $c_cc[1] = $termios->getcc(1);
1673
1674 =item getcflag
1675
1676 Retrieve the c_cflag field of a termios object.
1677
1678         $c_cflag = $termios->getcflag;
1679
1680 =item getiflag
1681
1682 Retrieve the c_iflag field of a termios object.
1683
1684         $c_iflag = $termios->getiflag;
1685
1686 =item getispeed
1687
1688 Retrieve the input baud rate.
1689
1690         $ispeed = $termios->getispeed;
1691
1692 =item getlflag
1693
1694 Retrieve the c_lflag field of a termios object.
1695
1696         $c_lflag = $termios->getlflag;
1697
1698 =item getoflag
1699
1700 Retrieve the c_oflag field of a termios object.
1701
1702         $c_oflag = $termios->getoflag;
1703
1704 =item getospeed
1705
1706 Retrieve the output baud rate.
1707
1708         $ospeed = $termios->getospeed;
1709
1710 =item setattr
1711
1712 Set terminal control attributes.
1713
1714 Set attributes immediately for stdout.
1715
1716         $termios->setattr( 1, &POSIX::TCSANOW );
1717
1718 Returns C<undef> on failure.
1719
1720 =item setcc
1721
1722 Set a value in the c_cc field of a termios object.  The c_cc field is an
1723 array so an index must be specified.
1724
1725         $termios->setcc( &POSIX::VEOF, 1 );
1726
1727 =item setcflag
1728
1729 Set the c_cflag field of a termios object.
1730
1731         $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
1732
1733 =item setiflag
1734
1735 Set the c_iflag field of a termios object.
1736
1737         $termios->setiflag( $c_iflag | &POSIX::BRKINT );
1738
1739 =item setispeed
1740
1741 Set the input baud rate.
1742
1743         $termios->setispeed( &POSIX::B9600 );
1744
1745 Returns C<undef> on failure.
1746
1747 =item setlflag
1748
1749 Set the c_lflag field of a termios object.
1750
1751         $termios->setlflag( $c_lflag | &POSIX::ECHO );
1752
1753 =item setoflag
1754
1755 Set the c_oflag field of a termios object.
1756
1757         $termios->setoflag( $c_oflag | &POSIX::OPOST );
1758
1759 =item setospeed
1760
1761 Set the output baud rate.
1762
1763         $termios->setospeed( &POSIX::B9600 );
1764
1765 Returns C<undef> on failure.
1766
1767 =item Baud rate values
1768
1769 B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110
1770
1771 =item Terminal interface values
1772
1773 TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH TCSAFLUSH TCIOFF TCOOFF
1774
1775 =item c_cc field values
1776
1777 VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS
1778
1779 =item c_cflag field values
1780
1781 CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
1782
1783 =item c_iflag field values
1784
1785 BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK
1786
1787 =item c_lflag field values
1788
1789 ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
1790
1791 =item c_oflag field values
1792
1793 OPOST
1794
1795 =back
1796
1797 =head1 PATHNAME CONSTANTS
1798
1799 =over 8
1800
1801 =item Constants
1802
1803 _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
1804
1805 =back
1806
1807 =head1 POSIX CONSTANTS
1808
1809 =over 8
1810
1811 =item Constants
1812
1813 _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
1814
1815 =back
1816
1817 =head1 SYSTEM CONFIGURATION
1818
1819 =over 8
1820
1821 =item Constants
1822
1823 _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
1824
1825 =back
1826
1827 =head1 ERRNO
1828
1829 =over 8
1830
1831 =item Constants
1832
1833 E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF
1834 EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ
1835 EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR
1836 EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG
1837 ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
1838 ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR
1839 ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE
1840 EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART EROFS
1841 ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
1842 ETXTBSY EUSERS EWOULDBLOCK EXDEV
1843
1844 =back
1845
1846 =head1 FCNTL
1847
1848 =over 8
1849
1850 =item Constants
1851
1852 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
1853
1854 =back
1855
1856 =head1 FLOAT
1857
1858 =over 8
1859
1860 =item Constants
1861
1862 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
1863
1864 =back
1865
1866 =head1 LIMITS
1867
1868 =over 8
1869
1870 =item Constants
1871
1872 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
1873
1874 =back
1875
1876 =head1 LOCALE
1877
1878 =over 8
1879
1880 =item Constants
1881
1882 LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
1883
1884 =back
1885
1886 =head1 MATH
1887
1888 =over 8
1889
1890 =item Constants
1891
1892 HUGE_VAL
1893
1894 =back
1895
1896 =head1 SIGNAL
1897
1898 =over 8
1899
1900 =item Constants
1901
1902 SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART
1903 SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT
1904 SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU
1905 SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK
1906 SIG_UNBLOCK
1907
1908 =back
1909
1910 =head1 STAT
1911
1912 =over 8
1913
1914 =item Constants
1915
1916 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
1917
1918 =item Macros
1919
1920 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
1921
1922 =back
1923
1924 =head1 STDLIB
1925
1926 =over 8
1927
1928 =item Constants
1929
1930 EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
1931
1932 =back
1933
1934 =head1 STDIO
1935
1936 =over 8
1937
1938 =item Constants
1939
1940 BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
1941
1942 =back
1943
1944 =head1 TIME
1945
1946 =over 8
1947
1948 =item Constants
1949
1950 CLK_TCK CLOCKS_PER_SEC
1951
1952 =back
1953
1954 =head1 UNISTD
1955
1956 =over 8
1957
1958 =item Constants
1959
1960 R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO STDERR_FILENO W_OK X_OK
1961
1962 =back
1963
1964 =head1 WAIT
1965
1966 =over 8
1967
1968 =item Constants
1969
1970 WNOHANG WUNTRACED
1971
1972 =item Macros
1973
1974 WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
1975
1976 =back
1977