1POSIX(3pm)             Perl Programmers Reference Guide             POSIX(3pm)
2
3
4

NAME

6       POSIX - Perl interface to IEEE Std 1003.1
7

SYNOPSIS

9           use POSIX;
10           use POSIX qw(setsid);
11           use POSIX qw(:errno_h :fcntl_h);
12
13           printf "EINTR is %d\n", EINTR;
14
15           $sess_id = POSIX::setsid();
16
17           $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
18               # note: that's a filedescriptor, *NOT* a filehandle
19

DESCRIPTION

21       The POSIX module permits you to access all (or nearly all) the standard
22       POSIX 1003.1 identifiers.  Many of these identifiers have been given
23       Perl-ish interfaces.
24
25       Everything is exported by default with the exception of any POSIX
26       functions with the same name as a built-in Perl function, such as
27       "abs", "alarm", "rmdir", "write", etc.., which will be exported only if
28       you ask for them explicitly.  This is an unfortunate backwards
29       compatibility feature.  You can stop the exporting by saying "use POSIX
30       ()" and then use the fully qualified names (ie. "POSIX::SEEK_END").
31
32       This document gives a condensed list of the features available in the
33       POSIX module.  Consult your operating system's manpages for general
34       information on most features.  Consult perlfunc for functions which are
35       noted as being identical to Perl's builtin functions.
36
37       The first section describes POSIX functions from the 1003.1
38       specification.  The second section describes some classes for signal
39       objects, TTY objects, and other miscellaneous objects.  The remaining
40       sections list various constants and macros in an organization which
41       roughly follows IEEE Std 1003.1b-1993.
42

NOTE

44       The POSIX module is probably the most complex Perl module supplied with
45       the standard distribution.  It incorporates autoloading, namespace
46       games, and dynamic loading of code that's in Perl, C, or both.  It's a
47       great source of wisdom.
48

CAVEATS

50       A few functions are not implemented because they are C specific.  If
51       you attempt to call these, they will print a message telling you that
52       they aren't implemented, and suggest using the Perl equivalent should
53       one exist.  For example, trying to access the setjmp() call will elicit
54       the message "setjmp() is C-specific: use eval {} instead".
55
56       Furthermore, some evil vendors will claim 1003.1 compliance, but in
57       fact are not so: they will not pass the PCTS (POSIX Compliance Test
58       Suites).  For example, one vendor may not define EDEADLK, or the
59       semantics of the errno values set by open(2) might not be quite right.
60       Perl does not attempt to verify POSIX compliance.  That means you can
61       currently successfully say "use POSIX",  and then later in your program
62       you find that your vendor has been lax and there's no usable ICANON
63       macro after all.  This could be construed to be a bug.
64

FUNCTIONS

66       _exit   This is identical to the C function "_exit()".  It exits the
67               program immediately which means among other things buffered I/O
68               is not flushed.
69
70               Note that when using threads and in Linux this is not a good
71               way to exit a thread because in Linux processes and threads are
72               kind of the same thing (Note: while this is the situation in
73               early 2003 there are projects under way to have threads with
74               more POSIXly semantics in Linux).  If you want not to return
75               from a thread, detach the thread.
76
77       abort   This is identical to the C function "abort()".  It terminates
78               the process with a "SIGABRT" signal unless caught by a signal
79               handler or if the handler does not return normally (it e.g.
80               does a "longjmp").
81
82       abs     This is identical to Perl's builtin "abs()" function, returning
83               the absolute value of its numerical argument.
84
85       access  Determines the accessibility of a file.
86
87                       if( POSIX::access( "/", &POSIX::R_OK ) ){
88                               print "have read permission\n";
89                       }
90
91               Returns "undef" on failure.  Note: do not use "access()" for
92               security purposes.  Between the "access()" call and the
93               operation you are preparing for the permissions might change: a
94               classic race condition.
95
96       acos    This is identical to the C function "acos()", returning the
97               arcus cosine of its numerical argument.  See also Math::Trig.
98
99       alarm   This is identical to Perl's builtin "alarm()" function, either
100               for arming or disarming the "SIGARLM" timer.
101
102       asctime This is identical to the C function "asctime()".  It returns a
103               string of the form
104
105                       "Fri Jun  2 18:22:13 2000\n\0"
106
107               and it is called thusly
108
109                       $asctime = asctime($sec, $min, $hour, $mday, $mon, $year,
110                                          $wday, $yday, $isdst);
111
112               The $mon is zero-based: January equals 0.  The $year is
113               1900-based: 2001 equals 101.  $wday and $yday default to zero
114               (and are usually ignored anyway), and $isdst defaults to -1.
115
116       asin    This is identical to the C function "asin()", returning the
117               arcus sine of its numerical argument.  See also Math::Trig.
118
119       assert  Unimplemented, but you can use "die" in perlfunc and the Carp
120               module to achieve similar things.
121
122       atan    This is identical to the C function "atan()", returning the
123               arcus tangent of its numerical argument.  See also Math::Trig.
124
125       atan2   This is identical to Perl's builtin "atan2()" function,
126               returning the arcus tangent defined by its two numerical
127               arguments, the y coordinate and the x coordinate.  See also
128               Math::Trig.
129
130       atexit  atexit() is C-specific: use "END {}" instead, see perlsub.
131
132       atof    atof() is C-specific.  Perl converts strings to numbers
133               transparently.  If you need to force a scalar to a number, add
134               a zero to it.
135
136       atoi    atoi() is C-specific.  Perl converts strings to numbers
137               transparently.  If you need to force a scalar to a number, add
138               a zero to it.  If you need to have just the integer part, see
139               "int" in perlfunc.
140
141       atol    atol() is C-specific.  Perl converts strings to numbers
142               transparently.  If you need to force a scalar to a number, add
143               a zero to it.  If you need to have just the integer part, see
144               "int" in perlfunc.
145
146       bsearch bsearch() not supplied.  For doing binary search on wordlists,
147               see Search::Dict.
148
149       calloc  calloc() is C-specific.  Perl does memory management
150               transparently.
151
152       ceil    This is identical to the C function "ceil()", returning the
153               smallest integer value greater than or equal to the given
154               numerical argument.
155
156       chdir   This is identical to Perl's builtin "chdir()" function,
157               allowing one to change the working (default) directory, see
158               "chdir" in perlfunc.
159
160       chmod   This is identical to Perl's builtin "chmod()" function,
161               allowing one to change file and directory permissions, see
162               "chmod" in perlfunc.
163
164       chown   This is identical to Perl's builtin "chown()" function,
165               allowing one to change file and directory owners and groups,
166               see "chown" in perlfunc.
167
168       clearerr
169               Use the method "IO::Handle::clearerr()" instead, to reset the
170               error state (if any) and EOF state (if any) of the given
171               stream.
172
173       clock   This is identical to the C function "clock()", returning the
174               amount of spent processor time in microseconds.
175
176       close   Close the file.  This uses file descriptors such as those
177               obtained by calling "POSIX::open".
178
179                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
180                       POSIX::close( $fd );
181
182               Returns "undef" on failure.
183
184               See also "close" in perlfunc.
185
186       closedir
187               This is identical to Perl's builtin "closedir()" function for
188               closing a directory handle, see "closedir" in perlfunc.
189
190       cos     This is identical to Perl's builtin "cos()" function, for
191               returning the cosine of its numerical argument, see "cos" in
192               perlfunc.  See also Math::Trig.
193
194       cosh    This is identical to the C function "cosh()", for returning the
195               hyperbolic cosine of its numeric argument.  See also
196               Math::Trig.
197
198       creat   Create a new file.  This returns a file descriptor like the
199               ones returned by "POSIX::open".  Use "POSIX::close" to close
200               the file.
201
202                       $fd = POSIX::creat( "foo", 0611 );
203                       POSIX::close( $fd );
204
205               See also "sysopen" in perlfunc and its "O_CREAT" flag.
206
207       ctermid Generates the path name for the controlling terminal.
208
209                       $path = POSIX::ctermid();
210
211       ctime   This is identical to the C function "ctime()" and equivalent to
212               "asctime(localtime(...))", see "asctime" and "localtime".
213
214       cuserid Get the login name of the owner of the current process.
215
216                       $name = POSIX::cuserid();
217
218       difftime
219               This is identical to the C function "difftime()", for returning
220               the time difference (in seconds) between two times (as returned
221               by "time()"), see "time".
222
223       div     div() is C-specific, use "int" in perlfunc on the usual "/"
224               division and the modulus "%".
225
226       dup     This is similar to the C function "dup()", for duplicating a
227               file descriptor.
228
229               This uses file descriptors such as those obtained by calling
230               "POSIX::open".
231
232               Returns "undef" on failure.
233
234       dup2    This is similar to the C function "dup2()", for duplicating a
235               file descriptor to an another known file descriptor.
236
237               This uses file descriptors such as those obtained by calling
238               "POSIX::open".
239
240               Returns "undef" on failure.
241
242       errno   Returns the value of errno.
243
244                       $errno = POSIX::errno();
245
246               This identical to the numerical values of the $!, see "$ERRNO"
247               in perlvar.
248
249       execl   execl() is C-specific, see "exec" in perlfunc.
250
251       execle  execle() is C-specific, see "exec" in perlfunc.
252
253       execlp  execlp() is C-specific, see "exec" in perlfunc.
254
255       execv   execv() is C-specific, see "exec" in perlfunc.
256
257       execve  execve() is C-specific, see "exec" in perlfunc.
258
259       execvp  execvp() is C-specific, see "exec" in perlfunc.
260
261       exit    This is identical to Perl's builtin "exit()" function for
262               exiting the program, see "exit" in perlfunc.
263
264       exp     This is identical to Perl's builtin "exp()" function for
265               returning the exponent (e-based) of the numerical argument, see
266               "exp" in perlfunc.
267
268       fabs    This is identical to Perl's builtin "abs()" function for
269               returning the absolute value of the numerical argument, see
270               "abs" in perlfunc.
271
272       fclose  Use method "IO::Handle::close()" instead, or see "close" in
273               perlfunc.
274
275       fcntl   This is identical to Perl's builtin "fcntl()" function, see
276               "fcntl" in perlfunc.
277
278       fdopen  Use method "IO::Handle::new_from_fd()" instead, or see "open"
279               in perlfunc.
280
281       feof    Use method "IO::Handle::eof()" instead, or see "eof" in
282               perlfunc.
283
284       ferror  Use method "IO::Handle::error()" instead.
285
286       fflush  Use method "IO::Handle::flush()" instead.  See also
287               "$OUTPUT_AUTOFLUSH" in perlvar.
288
289       fgetc   Use method "IO::Handle::getc()" instead, or see "read" in
290               perlfunc.
291
292       fgetpos Use method "IO::Seekable::getpos()" instead, or see "seek" in
293               L.
294
295       fgets   Use method "IO::Handle::gets()" instead.  Similar to <>, also
296               known as "readline" in perlfunc.
297
298       fileno  Use method "IO::Handle::fileno()" instead, or see "fileno" in
299               perlfunc.
300
301       floor   This is identical to the C function "floor()", returning the
302               largest integer value less than or equal to the numerical
303               argument.
304
305       fmod    This is identical to the C function "fmod()".
306
307                       $r = fmod($x, $y);
308
309               It returns the remainder "$r = $x - $n*$y", where "$n =
310               trunc($x/$y)".  The $r has the same sign as $x and magnitude
311               (absolute value) less than the magnitude of $y.
312
313       fopen   Use method "IO::File::open()" instead, or see "open" in
314               perlfunc.
315
316       fork    This is identical to Perl's builtin "fork()" function for
317               duplicating the current process, see "fork" in perlfunc and
318               perlfork if you are in Windows.
319
320       fpathconf
321               Retrieves the value of a configurable limit on a file or
322               directory.  This uses file descriptors such as those obtained
323               by calling "POSIX::open".
324
325               The following will determine the maximum length of the longest
326               allowable pathname on the filesystem which holds "/var/foo".
327
328                       $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY );
329                       $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX );
330
331               Returns "undef" on failure.
332
333       fprintf fprintf() is C-specific, see "printf" in perlfunc instead.
334
335       fputc   fputc() is C-specific, see "print" in perlfunc instead.
336
337       fputs   fputs() is C-specific, see "print" in perlfunc instead.
338
339       fread   fread() is C-specific, see "read" in perlfunc instead.
340
341       free    free() is C-specific.  Perl does memory management
342               transparently.
343
344       freopen freopen() is C-specific, see "open" in perlfunc instead.
345
346       frexp   Return the mantissa and exponent of a floating-point number.
347
348                       ($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
349
350       fscanf  fscanf() is C-specific, use <> and regular expressions instead.
351
352       fseek   Use method "IO::Seekable::seek()" instead, or see "seek" in
353               perlfunc.
354
355       fsetpos Use method "IO::Seekable::setpos()" instead, or seek "seek" in
356               perlfunc.
357
358       fstat   Get file status.  This uses file descriptors such as those
359               obtained by calling "POSIX::open".  The data returned is
360               identical to the data from Perl's builtin "stat" function.
361
362                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
363                       @stats = POSIX::fstat( $fd );
364
365       fsync   Use method "IO::Handle::sync()" instead.
366
367       ftell   Use method "IO::Seekable::tell()" instead, or see "tell" in
368               perlfunc.
369
370       fwrite  fwrite() is C-specific, see "print" in perlfunc instead.
371
372       getc    This is identical to Perl's builtin "getc()" function, see
373               "getc" in perlfunc.
374
375       getchar Returns one character from STDIN.  Identical to Perl's
376               "getc()", see "getc" in perlfunc.
377
378       getcwd  Returns the name of the current working directory.  See also
379               Cwd.
380
381       getegid Returns the effective group identifier.  Similar to Perl' s
382               builtin variable $(, see "$EGID" in perlvar.
383
384       getenv  Returns the value of the specified environment variable.  The
385               same information is available through the %ENV array.
386
387       geteuid Returns the effective user identifier.  Identical to Perl's
388               builtin $> variable, see "$EUID" in perlvar.
389
390       getgid  Returns the user's real group identifier.  Similar to Perl's
391               builtin variable $), see "$GID" in perlvar.
392
393       getgrgid
394               This is identical to Perl's builtin "getgrgid()" function for
395               returning group entries by group identifiers, see "getgrgid" in
396               perlfunc.
397
398       getgrnam
399               This is identical to Perl's builtin "getgrnam()" function for
400               returning group entries by group names, see "getgrnam" in
401               perlfunc.
402
403       getgroups
404               Returns the ids of the user's supplementary groups.  Similar to
405               Perl's builtin variable $), see "$GID" in perlvar.
406
407       getlogin
408               This is identical to Perl's builtin "getlogin()" function for
409               returning the user name associated with the current session,
410               see "getlogin" in perlfunc.
411
412       getpgrp This is identical to Perl's builtin "getpgrp()" function for
413               returning the process group identifier of the current process,
414               see "getpgrp" in perlfunc.
415
416       getpid  Returns the process identifier.  Identical to Perl's builtin
417               variable $$, see "$PID" in perlvar.
418
419       getppid This is identical to Perl's builtin "getppid()" function for
420               returning the process identifier of the parent process of the
421               current process , see "getppid" in perlfunc.
422
423       getpwnam
424               This is identical to Perl's builtin "getpwnam()" function for
425               returning user entries by user names, see "getpwnam" in
426               perlfunc.
427
428       getpwuid
429               This is identical to Perl's builtin "getpwuid()" function for
430               returning user entries by user identifiers, see "getpwuid" in
431               perlfunc.
432
433       gets    Returns one line from "STDIN", similar to <>, also known as the
434               "readline()" function, see "readline" in perlfunc.
435
436               NOTE: if you have C programs that still use "gets()", be very
437               afraid.  The "gets()" function is a source of endless grief
438               because it has no buffer overrun checks.  It should never be
439               used.  The "fgets()" function should be preferred instead.
440
441       getuid  Returns the user's identifier.  Identical to Perl's builtin $<
442               variable, see "$UID" in perlvar.
443
444       gmtime  This is identical to Perl's builtin "gmtime()" function for
445               converting seconds since the epoch to a date in Greenwich Mean
446               Time, see "gmtime" in perlfunc.
447
448       isalnum This is identical to the C function, except that it can apply
449               to a single character or to a whole string.  Note that locale
450               settings may affect what characters are considered "isalnum".
451               Does not work on Unicode characters code point 256 or higher.
452               Consider using regular expressions and the "/[[:alnum:]]/"
453               construct instead, or possibly the "/\w/" construct.
454
455       isalpha This is identical to the C function, except that it can apply
456               to a single character or to a whole string.  Note that locale
457               settings may affect what characters are considered "isalpha".
458               Does not work on Unicode characters code point 256 or higher.
459               Consider using regular expressions and the "/[[:alpha:]]/"
460               construct instead.
461
462       isatty  Returns a boolean indicating whether the specified filehandle
463               is connected to a tty.  Similar to the "-t" operator, see "-X"
464               in perlfunc.
465
466       iscntrl This is identical to the C function, except that it can apply
467               to a single character or to a whole string.  Note that locale
468               settings may affect what characters are considered "iscntrl".
469               Does not work on Unicode characters code point 256 or higher.
470               Consider using regular expressions and the "/[[:cntrl:]]/"
471               construct instead.
472
473       isdigit This is identical to the C function, except that it can apply
474               to a single character or to a whole string.  Note that locale
475               settings may affect what characters are considered "isdigit"
476               (unlikely, but still possible). Does not work on Unicode
477               characters code point 256 or higher.  Consider using regular
478               expressions and the "/[[:digit:]]/" construct instead, or the
479               "/\d/" construct.
480
481       isgraph This is identical to the C function, except that it can apply
482               to a single character or to a whole string.  Note that locale
483               settings may affect what characters are considered "isgraph".
484               Does not work on Unicode characters code point 256 or higher.
485               Consider using regular expressions and the "/[[:graph:]]/"
486               construct instead.
487
488       islower This is identical to the C function, except that it can apply
489               to a single character or to a whole string.  Note that locale
490               settings may affect what characters are considered "islower".
491               Does not work on Unicode characters code point 256 or higher.
492               Consider using regular expressions and the "/[[:lower:]]/"
493               construct instead.  Do not use "/[a-z]/".
494
495       isprint This is identical to the C function, except that it can apply
496               to a single character or to a whole string.  Note that locale
497               settings may affect what characters are considered "isprint".
498               Does not work on Unicode characters code point 256 or higher.
499               Consider using regular expressions and the "/[[:print:]]/"
500               construct instead.
501
502       ispunct This is identical to the C function, except that it can apply
503               to a single character or to a whole string.  Note that locale
504               settings may affect what characters are considered "ispunct".
505               Does not work on Unicode characters code point 256 or higher.
506               Consider using regular expressions and the "/[[:punct:]]/"
507               construct instead.
508
509       isspace This is identical to the C function, except that it can apply
510               to a single character or to a whole string.  Note that locale
511               settings may affect what characters are considered "isspace".
512               Does not work on Unicode characters code point 256 or higher.
513               Consider using regular expressions and the "/[[:space:]]/"
514               construct instead, or the "/\s/" construct.  (Note that "/\s/"
515               and "/[[:space:]]/" are slightly different in that
516               "/[[:space:]]/" can normally match a vertical tab, while "/\s/"
517               does not.)
518
519       isupper This is identical to the C function, except that it can apply
520               to a single character or to a whole string.  Note that locale
521               settings may affect what characters are considered "isupper".
522               Does not work on Unicode characters code point 256 or higher.
523               Consider using regular expressions and the "/[[:upper:]]/"
524               construct instead.  Do not use "/[A-Z]/".
525
526       isxdigit
527               This is identical to the C function, except that it can apply
528               to a single character or to a whole string.  Note that locale
529               settings may affect what characters are considered "isxdigit"
530               (unlikely, but still possible).  Does not work on Unicode
531               characters code point 256 or higher.  Consider using regular
532               expressions and the "/[[:xdigit:]]/" construct instead, or
533               simply "/[0-9a-f]/i".
534
535       kill    This is identical to Perl's builtin "kill()" function for
536               sending signals to processes (often to terminate them), see
537               "kill" in perlfunc.
538
539       labs    (For returning absolute values of long integers.)  labs() is
540               C-specific, see "abs" in perlfunc instead.
541
542       ldexp   This is identical to the C function "ldexp()" for multiplying
543               floating point numbers with powers of two.
544
545                       $x_quadrupled = POSIX::ldexp($x, 2);
546
547       ldiv    (For computing dividends of long integers.)  ldiv() is
548               C-specific, use "/" and "int()" instead.
549
550       link    This is identical to Perl's builtin "link()" function for
551               creating hard links into files, see "link" in perlfunc.
552
553       localeconv
554               Get numeric formatting information.  Returns a reference to a
555               hash containing the current locale formatting values.
556
557               Here is how to query the database for the de (Deutsch or
558               German) locale.
559
560                       $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
561                       print "Locale = $loc\n";
562                       $lconv = POSIX::localeconv();
563                       print "decimal_point    = ", $lconv->{decimal_point},   "\n";
564                       print "thousands_sep    = ", $lconv->{thousands_sep},   "\n";
565                       print "grouping = ", $lconv->{grouping},        "\n";
566                       print "int_curr_symbol  = ", $lconv->{int_curr_symbol}, "\n";
567                       print "currency_symbol  = ", $lconv->{currency_symbol}, "\n";
568                       print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
569                       print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
570                       print "mon_grouping     = ", $lconv->{mon_grouping},    "\n";
571                       print "positive_sign    = ", $lconv->{positive_sign},   "\n";
572                       print "negative_sign    = ", $lconv->{negative_sign},   "\n";
573                       print "int_frac_digits  = ", $lconv->{int_frac_digits}, "\n";
574                       print "frac_digits      = ", $lconv->{frac_digits},     "\n";
575                       print "p_cs_precedes    = ", $lconv->{p_cs_precedes},   "\n";
576                       print "p_sep_by_space   = ", $lconv->{p_sep_by_space},  "\n";
577                       print "n_cs_precedes    = ", $lconv->{n_cs_precedes},   "\n";
578                       print "n_sep_by_space   = ", $lconv->{n_sep_by_space},  "\n";
579                       print "p_sign_posn      = ", $lconv->{p_sign_posn},     "\n";
580                       print "n_sign_posn      = ", $lconv->{n_sign_posn},     "\n";
581
582       localtime
583               This is identical to Perl's builtin "localtime()" function for
584               converting seconds since the epoch to a date see "localtime" in
585               perlfunc.
586
587       log     This is identical to Perl's builtin "log()" function, returning
588               the natural (e-based) logarithm of the numerical argument, see
589               "log" in perlfunc.
590
591       log10   This is identical to the C function "log10()", returning the
592               10-base logarithm of the numerical argument.  You can also use
593
594                   sub log10 { log($_[0]) / log(10) }
595
596               or
597
598                   sub log10 { log($_[0]) / 2.30258509299405 }
599
600               or
601
602                   sub log10 { log($_[0]) * 0.434294481903252 }
603
604       longjmp longjmp() is C-specific: use "die" in perlfunc instead.
605
606       lseek   Move the file's read/write position.  This uses file
607               descriptors such as those obtained by calling "POSIX::open".
608
609                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
610                       $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
611
612               Returns "undef" on failure.
613
614       malloc  malloc() is C-specific.  Perl does memory management
615               transparently.
616
617       mblen   This is identical to the C function "mblen()".  Perl does not
618               have any support for the wide and multibyte characters of the C
619               standards, so this might be a rather useless function.
620
621       mbstowcs
622               This is identical to the C function "mbstowcs()".  Perl does
623               not have any support for the wide and multibyte characters of
624               the C standards, so this might be a rather useless function.
625
626       mbtowc  This is identical to the C function "mbtowc()".  Perl does not
627               have any support for the wide and multibyte characters of the C
628               standards, so this might be a rather useless function.
629
630       memchr  memchr() is C-specific, see "index" in perlfunc instead.
631
632       memcmp  memcmp() is C-specific, use "eq" instead, see perlop.
633
634       memcpy  memcpy() is C-specific, use "=", see perlop, or see "substr" in
635               perlfunc.
636
637       memmove memmove() is C-specific, use "=", see perlop, or see "substr"
638               in perlfunc.
639
640       memset  memset() is C-specific, use "x" instead, see perlop.
641
642       mkdir   This is identical to Perl's builtin "mkdir()" function for
643               creating directories, see "mkdir" in perlfunc.
644
645       mkfifo  This is similar to the C function "mkfifo()" for creating FIFO
646               special files.
647
648                       if (mkfifo($path, $mode)) { ....
649
650               Returns "undef" on failure.  The $mode is similar to the mode
651               of "mkdir()", see "mkdir" in perlfunc, though for "mkfifo" you
652               must specify the $mode.
653
654       mktime  Convert date/time info to a calendar time.
655
656               Synopsis:
657
658                       mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1)
659
660               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
661               at zero.  I.e. January is 0, not 1; Sunday is 0, not 1; January
662               1st is 0, not 1.  The year ("year") is given in years since
663               1900.  I.e. The year 1995 is 95; the year 2001 is 101.  Consult
664               your system's "mktime()" manpage for details about these and
665               the other arguments.
666
667               Calendar time for December 12, 1995, at 10:30 am.
668
669                       $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
670                       print "Date = ", POSIX::ctime($time_t);
671
672               Returns "undef" on failure.
673
674       modf    Return the integral and fractional parts of a floating-point
675               number.
676
677                       ($fractional, $integral) = POSIX::modf( 3.14 );
678
679       nice    This is similar to the C function "nice()", for changing the
680               scheduling preference of the current process.  Positive
681               arguments mean more polite process, negative values more needy
682               process.  Normal user processes can only be more polite.
683
684               Returns "undef" on failure.
685
686       offsetof
687               offsetof() is C-specific, you probably want to see "pack" in
688               perlfunc instead.
689
690       open    Open a file for reading for writing.  This returns file
691               descriptors, not Perl filehandles.  Use "POSIX::close" to close
692               the file.
693
694               Open a file read-only with mode 0666.
695
696                       $fd = POSIX::open( "foo" );
697
698               Open a file for read and write.
699
700                       $fd = POSIX::open( "foo", &POSIX::O_RDWR );
701
702               Open a file for write, with truncation.
703
704                       $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
705
706               Create a new file with mode 0640.  Set up the file for writing.
707
708                       $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
709
710               Returns "undef" on failure.
711
712               See also "sysopen" in perlfunc.
713
714       opendir Open a directory for reading.
715
716                       $dir = POSIX::opendir( "/var" );
717                       @files = POSIX::readdir( $dir );
718                       POSIX::closedir( $dir );
719
720               Returns "undef" on failure.
721
722       pathconf
723               Retrieves the value of a configurable limit on a file or
724               directory.
725
726               The following will determine the maximum length of the longest
727               allowable pathname on the filesystem which holds "/var".
728
729                       $path_max = POSIX::pathconf( "/var", &POSIX::_PC_PATH_MAX );
730
731               Returns "undef" on failure.
732
733       pause   This is similar to the C function "pause()", which suspends the
734               execution of the current process until a signal is received.
735
736               Returns "undef" on failure.
737
738       perror  This is identical to the C function "perror()", which outputs
739               to the standard error stream the specified message followed by
740               ": " and the current error string.  Use the "warn()" function
741               and the $!  variable instead, see "warn" in perlfunc and
742               "$ERRNO" in perlvar.
743
744       pipe    Create an interprocess channel.  This returns file descriptors
745               like those returned by "POSIX::open".
746
747                       my ($read, $write) = POSIX::pipe();
748                       POSIX::write( $write, "hello", 5 );
749                       POSIX::read( $read, $buf, 5 );
750
751               See also "pipe" in perlfunc.
752
753       pow     Computes $x raised to the power $exponent.
754
755                       $ret = POSIX::pow( $x, $exponent );
756
757               You can also use the "**" operator, see perlop.
758
759       printf  Formats and prints the specified arguments to STDOUT.  See also
760               "printf" in perlfunc.
761
762       putc    putc() is C-specific, see "print" in perlfunc instead.
763
764       putchar putchar() is C-specific, see "print" in perlfunc instead.
765
766       puts    puts() is C-specific, see "print" in perlfunc instead.
767
768       qsort   qsort() is C-specific, see "sort" in perlfunc instead.
769
770       raise   Sends the specified signal to the current process.  See also
771               "kill" in perlfunc and the $$ in "$PID" in perlvar.
772
773       rand    "rand()" is non-portable, see "rand" in perlfunc instead.
774
775       read    Read from a file.  This uses file descriptors such as those
776               obtained by calling "POSIX::open".  If the buffer $buf is not
777               large enough for the read then Perl will extend it to make room
778               for the request.
779
780                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
781                       $bytes = POSIX::read( $fd, $buf, 3 );
782
783               Returns "undef" on failure.
784
785               See also "sysread" in perlfunc.
786
787       readdir This is identical to Perl's builtin "readdir()" function for
788               reading directory entries, see "readdir" in perlfunc.
789
790       realloc realloc() is C-specific.  Perl does memory management
791               transparently.
792
793       remove  This is identical to Perl's builtin "unlink()" function for
794               removing files, see "unlink" in perlfunc.
795
796       rename  This is identical to Perl's builtin "rename()" function for
797               renaming files, see "rename" in perlfunc.
798
799       rewind  Seeks to the beginning of the file.
800
801       rewinddir
802               This is identical to Perl's builtin "rewinddir()" function for
803               rewinding directory entry streams, see "rewinddir" in perlfunc.
804
805       rmdir   This is identical to Perl's builtin "rmdir()" function for
806               removing (empty) directories, see "rmdir" in perlfunc.
807
808       scanf   scanf() is C-specific, use <> and regular expressions instead,
809               see perlre.
810
811       setgid  Sets the real group identifier and the effective group
812               identifier for this process.  Similar to assigning a value to
813               the Perl's builtin $) variable, see "$EGID" in perlvar, except
814               that the latter will change only the real user identifier, and
815               that the setgid() uses only a single numeric argument, as
816               opposed to a space-separated list of numbers.
817
818       setjmp  "setjmp()" is C-specific: use "eval {}" instead, see "eval" in
819               perlfunc.
820
821       setlocale
822               Modifies and queries program's locale.  The following examples
823               assume
824
825                       use POSIX qw(setlocale LC_ALL LC_CTYPE);
826
827               has been issued.
828
829               The following will set the traditional UNIX system locale
830               behavior (the second argument "C").
831
832                       $loc = setlocale( LC_ALL, "C" );
833
834               The following will query the current LC_CTYPE category.  (No
835               second argument means 'query'.)
836
837                       $loc = setlocale( LC_CTYPE );
838
839               The following will set the LC_CTYPE behaviour according to the
840               locale environment variables (the second argument "").  Please
841               see your systems setlocale(3) documentation for the locale
842               environment variables' meaning or consult perllocale.
843
844                       $loc = setlocale( LC_CTYPE, "" );
845
846               The following will set the LC_COLLATE behaviour to Argentinian
847               Spanish. NOTE: The naming and availability of locales depends
848               on your operating system. Please consult perllocale for how to
849               find out which locales are available in your system.
850
851                       $loc = setlocale( LC_ALL, "es_AR.ISO8859-1" );
852
853       setpgid This is similar to the C function "setpgid()" for setting the
854               process group identifier of the current process.
855
856               Returns "undef" on failure.
857
858       setsid  This is identical to the C function "setsid()" for setting the
859               session identifier of the current process.
860
861       setuid  Sets the real user identifier and the effective user identifier
862               for this process.  Similar to assigning a value to the Perl's
863               builtin $< variable, see "$UID" in perlvar, except that the
864               latter will change only the real user identifier.
865
866       sigaction
867               Detailed signal management.  This uses "POSIX::SigAction"
868               objects for the "action" and "oldaction" arguments (the
869               oldaction can also be just a hash reference).  Consult your
870               system's "sigaction" manpage for details, see also
871               "POSIX::SigRt".
872
873               Synopsis:
874
875                       sigaction(signal, action, oldaction = 0)
876
877               Returns "undef" on failure.  The "signal" must be a number
878               (like SIGHUP), not a string (like "SIGHUP"), though Perl does
879               try hard to understand you.
880
881               If you use the SA_SIGINFO flag, the signal handler will in
882               addition to the first argument, the signal name, also receive a
883               second argument, a hash reference, inside which are the
884               following keys with the following semantics, as defined by
885               POSIX/SUSv3:
886
887                   signo       the signal number
888                   errno       the error number
889                   code        if this is zero or less, the signal was sent by
890                               a user process and the uid and pid make sense,
891                               otherwise the signal was sent by the kernel
892
893               The following are also defined by POSIX/SUSv3, but
894               unfortunately not very widely implemented:
895
896                   pid         the process id generating the signal
897                   uid         the uid of the process id generating the signal
898                   status      exit value or signal for SIGCHLD
899                   band        band event for SIGPOLL
900
901               A third argument is also passed to the handler, which contains
902               a copy of the raw binary contents of the siginfo structure: if
903               a system has some non-POSIX fields, this third argument is
904               where to unpack() them from.
905
906               Note that not all siginfo values make sense simultaneously
907               (some are valid only for certain signals, for example), and not
908               all values make sense from Perl perspective, you should to
909               consult your system's "sigaction" and possibly also "siginfo"
910               documentation.
911
912       siglongjmp
913               siglongjmp() is C-specific: use "die" in perlfunc instead.
914
915       sigpending
916               Examine signals that are blocked and pending.  This uses
917               "POSIX::SigSet" objects for the "sigset" argument.  Consult
918               your system's "sigpending" manpage for details.
919
920               Synopsis:
921
922                       sigpending(sigset)
923
924               Returns "undef" on failure.
925
926       sigprocmask
927               Change and/or examine calling process's signal mask.  This uses
928               "POSIX::SigSet" objects for the "sigset" and "oldsigset"
929               arguments.  Consult your system's "sigprocmask" manpage for
930               details.
931
932               Synopsis:
933
934                       sigprocmask(how, sigset, oldsigset = 0)
935
936               Returns "undef" on failure.
937
938       sigsetjmp
939               "sigsetjmp()" is C-specific: use "eval {}" instead, see "eval"
940               in perlfunc.
941
942       sigsuspend
943               Install a signal mask and suspend process until signal arrives.
944               This uses "POSIX::SigSet" objects for the "signal_mask"
945               argument.  Consult your system's "sigsuspend" manpage for
946               details.
947
948               Synopsis:
949
950                       sigsuspend(signal_mask)
951
952               Returns "undef" on failure.
953
954       sin     This is identical to Perl's builtin "sin()" function for
955               returning the sine of the numerical argument, see "sin" in
956               perlfunc.  See also Math::Trig.
957
958       sinh    This is identical to the C function "sinh()" for returning the
959               hyperbolic sine of the numerical argument.  See also
960               Math::Trig.
961
962       sleep   This is functionally identical to Perl's builtin "sleep()"
963               function for suspending the execution of the current for
964               process for certain number of seconds, see "sleep" in perlfunc.
965               There is one significant difference, however: "POSIX::sleep()"
966               returns the number of unslept seconds, while the
967               "CORE::sleep()" returns the number of slept seconds.
968
969       sprintf This is similar to Perl's builtin "sprintf()" function for
970               returning a string that has the arguments formatted as
971               requested, see "sprintf" in perlfunc.
972
973       sqrt    This is identical to Perl's builtin "sqrt()" function.  for
974               returning the square root of the numerical argument, see "sqrt"
975               in perlfunc.
976
977       srand   Give a seed the pseudorandom number generator, see "srand" in
978               perlfunc.
979
980       sscanf  sscanf() is C-specific, use regular expressions instead, see
981               perlre.
982
983       stat    This is identical to Perl's builtin "stat()" function for
984               returning information about files and directories.
985
986       strcat  strcat() is C-specific, use ".=" instead, see perlop.
987
988       strchr  strchr() is C-specific, see "index" in perlfunc instead.
989
990       strcmp  strcmp() is C-specific, use "eq" or "cmp" instead, see perlop.
991
992       strcoll This is identical to the C function "strcoll()" for collating
993               (comparing) strings transformed using the "strxfrm()" function.
994               Not really needed since Perl can do this transparently, see
995               perllocale.
996
997       strcpy  strcpy() is C-specific, use "=" instead, see perlop.
998
999       strcspn strcspn() is C-specific, use regular expressions instead, see
1000               perlre.
1001
1002       strerror
1003               Returns the error string for the specified errno.  Identical to
1004               the string form of the $!, see "$ERRNO" in perlvar.
1005
1006       strftime
1007               Convert date and time information to string.  Returns the
1008               string.
1009
1010               Synopsis:
1011
1012                       strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
1013
1014               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
1015               at zero.  I.e. January is 0, not 1; Sunday is 0, not 1; January
1016               1st is 0, not 1.  The year ("year") is given in years since
1017               1900.  I.e., the year 1995 is 95; the year 2001 is 101.
1018               Consult your system's "strftime()" manpage for details about
1019               these and the other arguments.
1020
1021               If you want your code to be portable, your format ("fmt")
1022               argument should use only the conversion specifiers defined by
1023               the ANSI C standard (C89, to play safe).  These are
1024               "aAbBcdHIjmMpSUwWxXyYZ%".  But even then, the results of some
1025               of the conversion specifiers are non-portable.  For example,
1026               the specifiers "aAbBcpZ" change according to the locale
1027               settings of the user, and both how to set locales (the locale
1028               names) and what output to expect are non-standard.  The
1029               specifier "c" changes according to the timezone settings of the
1030               user and the timezone computation rules of the operating
1031               system.  The "Z" specifier is notoriously unportable since the
1032               names of timezones are non-standard. Sticking to the numeric
1033               specifiers is the safest route.
1034
1035               The given arguments are made consistent as though by calling
1036               "mktime()" before calling your system's "strftime()" function,
1037               except that the "isdst" value is not affected.
1038
1039               The string for Tuesday, December 12, 1995.
1040
1041                       $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 );
1042                       print "$str\n";
1043
1044       strlen  strlen() is C-specific, use "length()" instead, see "length" in
1045               perlfunc.
1046
1047       strncat strncat() is C-specific, use ".=" instead, see perlop.
1048
1049       strncmp strncmp() is C-specific, use "eq" instead, see perlop.
1050
1051       strncpy strncpy() is C-specific, use "=" instead, see perlop.
1052
1053       strpbrk strpbrk() is C-specific, use regular expressions instead, see
1054               perlre.
1055
1056       strrchr strrchr() is C-specific, see "rindex" in perlfunc instead.
1057
1058       strspn  strspn() is C-specific, use regular expressions instead, see
1059               perlre.
1060
1061       strstr  This is identical to Perl's builtin "index()" function, see
1062               "index" in perlfunc.
1063
1064       strtod  String to double translation. Returns the parsed number and the
1065               number of characters in the unparsed portion of the string.
1066               Truly POSIX-compliant systems set $! ($ERRNO) to indicate a
1067               translation error, so clear $! before calling strtod.  However,
1068               non-POSIX systems may not check for overflow, and therefore
1069               will never set $!.
1070
1071               strtod should respect any POSIX setlocale() settings.
1072
1073               To parse a string $str as a floating point number use
1074
1075                   $! = 0;
1076                   ($num, $n_unparsed) = POSIX::strtod($str);
1077
1078               The second returned item and $! can be used to check for valid
1079               input:
1080
1081                   if (($str eq '') || ($n_unparsed != 0) || $!) {
1082                       die "Non-numeric input $str" . ($! ? ": $!\n" : "\n");
1083                   }
1084
1085               When called in a scalar context strtod returns the parsed
1086               number.
1087
1088       strtok  strtok() is C-specific, use regular expressions instead, see
1089               perlre, or "split" in perlfunc.
1090
1091       strtol  String to (long) integer translation.  Returns the parsed
1092               number and the number of characters in the unparsed portion of
1093               the string.  Truly POSIX-compliant systems set $! ($ERRNO) to
1094               indicate a translation error, so clear $! before calling
1095               strtol.  However, non-POSIX systems may not check for overflow,
1096               and therefore will never set $!.
1097
1098               strtol should respect any POSIX setlocale() settings.
1099
1100               To parse a string $str as a number in some base $base use
1101
1102                   $! = 0;
1103                   ($num, $n_unparsed) = POSIX::strtol($str, $base);
1104
1105               The base should be zero or between 2 and 36, inclusive.  When
1106               the base is zero or omitted strtol will use the string itself
1107               to determine the base: a leading "0x" or "0X" means
1108               hexadecimal; a leading "0" means octal; any other leading
1109               characters mean decimal.  Thus, "1234" is parsed as a decimal
1110               number, "01234" as an octal number, and "0x1234" as a
1111               hexadecimal number.
1112
1113               The second returned item and $! can be used to check for valid
1114               input:
1115
1116                   if (($str eq '') || ($n_unparsed != 0) || !$!) {
1117                       die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
1118                   }
1119
1120               When called in a scalar context strtol returns the parsed
1121               number.
1122
1123       strtoul String to unsigned (long) integer translation.  strtoul() is
1124               identical to strtol() except that strtoul() only parses
1125               unsigned integers.  See "strtol" for details.
1126
1127               Note: Some vendors supply strtod() and strtol() but not
1128               strtoul().  Other vendors that do supply strtoul() parse "-1"
1129               as a valid value.
1130
1131       strxfrm String transformation.  Returns the transformed string.
1132
1133                       $dst = POSIX::strxfrm( $src );
1134
1135               Used in conjunction with the "strcoll()" function, see
1136               "strcoll".
1137
1138               Not really needed since Perl can do this transparently, see
1139               perllocale.
1140
1141       sysconf Retrieves values of system configurable variables.
1142
1143               The following will get the machine's clock speed.
1144
1145                       $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
1146
1147               Returns "undef" on failure.
1148
1149       system  This is identical to Perl's builtin "system()" function, see
1150               "system" in perlfunc.
1151
1152       tan     This is identical to the C function "tan()", returning the
1153               tangent of the numerical argument.  See also Math::Trig.
1154
1155       tanh    This is identical to the C function "tanh()", returning the
1156               hyperbolic tangent of the numerical argument.   See also
1157               Math::Trig.
1158
1159       tcdrain This is similar to the C function "tcdrain()" for draining the
1160               output queue of its argument stream.
1161
1162               Returns "undef" on failure.
1163
1164       tcflow  This is similar to the C function "tcflow()" for controlling
1165               the flow of its argument stream.
1166
1167               Returns "undef" on failure.
1168
1169       tcflush This is similar to the C function "tcflush()" for flushing the
1170               I/O buffers of its argument stream.
1171
1172               Returns "undef" on failure.
1173
1174       tcgetpgrp
1175               This is identical to the C function "tcgetpgrp()" for returning
1176               the process group identifier of the foreground process group of
1177               the controlling terminal.
1178
1179       tcsendbreak
1180               This is similar to the C function "tcsendbreak()" for sending a
1181               break on its argument stream.
1182
1183               Returns "undef" on failure.
1184
1185       tcsetpgrp
1186               This is similar to the C function "tcsetpgrp()" for setting the
1187               process group identifier of the foreground process group of the
1188               controlling terminal.
1189
1190               Returns "undef" on failure.
1191
1192       time    This is identical to Perl's builtin "time()" function for
1193               returning the number of seconds since the epoch (whatever it is
1194               for the system), see "time" in perlfunc.
1195
1196       times   The times() function returns elapsed realtime since some point
1197               in the past (such as system startup), user and system times for
1198               this process, and user and system times used by child
1199               processes.  All times are returned in clock ticks.
1200
1201                   ($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
1202
1203               Note: Perl's builtin "times()" function returns four values,
1204               measured in seconds.
1205
1206       tmpfile Use method "IO::File::new_tmpfile()" instead, or see
1207               File::Temp.
1208
1209       tmpnam  Returns a name for a temporary file.
1210
1211                       $tmpfile = POSIX::tmpnam();
1212
1213               For security reasons, which are probably detailed in your
1214               system's documentation for the C library tmpnam() function,
1215               this interface should not be used; instead see File::Temp.
1216
1217       tolower This is identical to the C function, except that it can apply
1218               to a single character or to a whole string.  Consider using the
1219               "lc()" function, see "lc" in perlfunc, or the equivalent "\L"
1220               operator inside doublequotish strings.
1221
1222       toupper This is identical to the C function, except that it can apply
1223               to a single character or to a whole string.  Consider using the
1224               "uc()" function, see "uc" in perlfunc, or the equivalent "\U"
1225               operator inside doublequotish strings.
1226
1227       ttyname This is identical to the C function "ttyname()" for returning
1228               the name of the current terminal.
1229
1230       tzname  Retrieves the time conversion information from the "tzname"
1231               variable.
1232
1233                       POSIX::tzset();
1234                       ($std, $dst) = POSIX::tzname();
1235
1236       tzset   This is identical to the C function "tzset()" for setting the
1237               current timezone based on the environment variable "TZ", to be
1238               used by "ctime()", "localtime()", "mktime()", and "strftime()"
1239               functions.
1240
1241       umask   This is identical to Perl's builtin "umask()" function for
1242               setting (and querying) the file creation permission mask, see
1243               "umask" in perlfunc.
1244
1245       uname   Get name of current operating system.
1246
1247                       ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
1248
1249               Note that the actual meanings of the various fields are not
1250               that well standardized, do not expect any great portability.
1251               The $sysname might be the name of the operating system, the
1252               $nodename might be the name of the host, the $release might be
1253               the (major) release number of the operating system, the
1254               $version might be the (minor) release number of the operating
1255               system, and the $machine might be a hardware identifier.
1256               Maybe.
1257
1258       ungetc  Use method "IO::Handle::ungetc()" instead.
1259
1260       unlink  This is identical to Perl's builtin "unlink()" function for
1261               removing files, see "unlink" in perlfunc.
1262
1263       utime   This is identical to Perl's builtin "utime()" function for
1264               changing the time stamps of files and directories, see "utime"
1265               in perlfunc.
1266
1267       vfprintf
1268               vfprintf() is C-specific, see "printf" in perlfunc instead.
1269
1270       vprintf vprintf() is C-specific, see "printf" in perlfunc instead.
1271
1272       vsprintf
1273               vsprintf() is C-specific, see "sprintf" in perlfunc instead.
1274
1275       wait    This is identical to Perl's builtin "wait()" function, see
1276               "wait" in perlfunc.
1277
1278       waitpid Wait for a child process to change state.  This is identical to
1279               Perl's builtin "waitpid()" function, see "waitpid" in perlfunc.
1280
1281                       $pid = POSIX::waitpid( -1, POSIX::WNOHANG );
1282                       print "status = ", ($? / 256), "\n";
1283
1284       wcstombs
1285               This is identical to the C function "wcstombs()".  Perl does
1286               not have any support for the wide and multibyte characters of
1287               the C standards, so this might be a rather useless function.
1288
1289       wctomb  This is identical to the C function "wctomb()".  Perl does not
1290               have any support for the wide and multibyte characters of the C
1291               standards, so this might be a rather useless function.
1292
1293       write   Write to a file.  This uses file descriptors such as those
1294               obtained by calling "POSIX::open".
1295
1296                       $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
1297                       $buf = "hello";
1298                       $bytes = POSIX::write( $fd, $buf, 5 );
1299
1300               Returns "undef" on failure.
1301
1302               See also "syswrite" in perlfunc.
1303

CLASSES

1305   POSIX::SigAction
1306       new     Creates a new "POSIX::SigAction" object which corresponds to
1307               the C "struct sigaction".  This object will be destroyed
1308               automatically when it is no longer needed.  The first parameter
1309               is the handler, a sub reference.  The second parameter is a
1310               "POSIX::SigSet" object, it defaults to the empty set.  The
1311               third parameter contains the "sa_flags", it defaults to 0.
1312
1313                       $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
1314                       $sigaction = POSIX::SigAction->new( \&handler, $sigset, &POSIX::SA_NOCLDSTOP );
1315
1316               This "POSIX::SigAction" object is intended for use with the
1317               "POSIX::sigaction()" function.
1318
1319       handler
1320       mask
1321       flags   accessor functions to get/set the values of a SigAction object.
1322
1323                       $sigset = $sigaction->mask;
1324                       $sigaction->flags(&POSIX::SA_RESTART);
1325
1326       safe    accessor function for the "safe signals" flag of a SigAction
1327               object; see perlipc for general information on safe (a.k.a.
1328               "deferred") signals.  If you wish to handle a signal safely,
1329               use this accessor to set the "safe" flag in the
1330               "POSIX::SigAction" object:
1331
1332                       $sigaction->safe(1);
1333
1334               You may also examine the "safe" flag on the output action
1335               object which is filled in when given as the third parameter to
1336               "POSIX::sigaction()":
1337
1338                       sigaction(SIGINT, $new_action, $old_action);
1339                       if ($old_action->safe) {
1340                           # previous SIGINT handler used safe signals
1341                       }
1342
1343   POSIX::SigRt
1344       %SIGRT  A hash of the POSIX realtime signal handlers.  It is an
1345               extension of the standard %SIG, the $POSIX::SIGRT{SIGRTMIN} is
1346               roughly equivalent to $SIG{SIGRTMIN}, but the right POSIX moves
1347               (see below) are made with the POSIX::SigSet and
1348               POSIX::sigaction instead of accessing the %SIG.
1349
1350               You can set the %POSIX::SIGRT elements to set the POSIX
1351               realtime signal handlers, use "delete" and "exists" on the
1352               elements, and use "scalar" on the %POSIX::SIGRT to find out how
1353               many POSIX realtime signals there are available (SIGRTMAX -
1354               SIGRTMIN + 1, the SIGRTMAX is a valid POSIX realtime signal).
1355
1356               Setting the %SIGRT elements is equivalent to calling this:
1357
1358                 sub new {
1359                   my ($rtsig, $handler, $flags) = @_;
1360                   my $sigset = POSIX::SigSet($rtsig);
1361                   my $sigact = POSIX::SigAction->new($handler, $sigset, $flags);
1362                   sigaction($rtsig, $sigact);
1363                 }
1364
1365               The flags default to zero, if you want something different you
1366               can either use "local" on $POSIX::SigRt::SIGACTION_FLAGS, or
1367               you can derive from POSIX::SigRt and define your own "new()"
1368               (the tied hash STORE method of the %SIGRT calls "new($rtsig,
1369               $handler, $SIGACTION_FLAGS)", where the $rtsig ranges from zero
1370               to SIGRTMAX - SIGRTMIN + 1).
1371
1372               Just as with any signal, you can use sigaction($rtsig, undef,
1373               $oa) to retrieve the installed signal handler (or, rather, the
1374               signal action).
1375
1376               NOTE: whether POSIX realtime signals really work in your
1377               system, or whether Perl has been compiled so that it works with
1378               them, is outside of this discussion.
1379
1380       SIGRTMIN
1381               Return the minimum POSIX realtime signal number available, or
1382               "undef" if no POSIX realtime signals are available.
1383
1384       SIGRTMAX
1385               Return the maximum POSIX realtime signal number available, or
1386               "undef" if no POSIX realtime signals are available.
1387
1388   POSIX::SigSet
1389       new     Create a new SigSet object.  This object will be destroyed
1390               automatically when it is no longer needed.  Arguments may be
1391               supplied to initialize the set.
1392
1393               Create an empty set.
1394
1395                       $sigset = POSIX::SigSet->new;
1396
1397               Create a set with SIGUSR1.
1398
1399                       $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
1400
1401       addset  Add a signal to a SigSet object.
1402
1403                       $sigset->addset( &POSIX::SIGUSR2 );
1404
1405               Returns "undef" on failure.
1406
1407       delset  Remove a signal from the SigSet object.
1408
1409                       $sigset->delset( &POSIX::SIGUSR2 );
1410
1411               Returns "undef" on failure.
1412
1413       emptyset
1414               Initialize the SigSet object to be empty.
1415
1416                       $sigset->emptyset();
1417
1418               Returns "undef" on failure.
1419
1420       fillset Initialize the SigSet object to include all signals.
1421
1422                       $sigset->fillset();
1423
1424               Returns "undef" on failure.
1425
1426       ismember
1427               Tests the SigSet object to see if it contains a specific
1428               signal.
1429
1430                       if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
1431                               print "contains SIGUSR1\n";
1432                       }
1433
1434   POSIX::Termios
1435       new     Create a new Termios object.  This object will be destroyed
1436               automatically when it is no longer needed.  A Termios object
1437               corresponds to the termios C struct.  new() mallocs a new one,
1438               getattr() fills it from a file descriptor, and setattr() sets a
1439               file descriptor's parameters to match Termios' contents.
1440
1441                       $termios = POSIX::Termios->new;
1442
1443       getattr Get terminal control attributes.
1444
1445               Obtain the attributes for stdin.
1446
1447                       $termios->getattr( 0 ) # Recommended for clarity.
1448                       $termios->getattr()
1449
1450               Obtain the attributes for stdout.
1451
1452                       $termios->getattr( 1 )
1453
1454               Returns "undef" on failure.
1455
1456       getcc   Retrieve a value from the c_cc field of a termios object.  The
1457               c_cc field is an array so an index must be specified.
1458
1459                       $c_cc[1] = $termios->getcc(1);
1460
1461       getcflag
1462               Retrieve the c_cflag field of a termios object.
1463
1464                       $c_cflag = $termios->getcflag;
1465
1466       getiflag
1467               Retrieve the c_iflag field of a termios object.
1468
1469                       $c_iflag = $termios->getiflag;
1470
1471       getispeed
1472               Retrieve the input baud rate.
1473
1474                       $ispeed = $termios->getispeed;
1475
1476       getlflag
1477               Retrieve the c_lflag field of a termios object.
1478
1479                       $c_lflag = $termios->getlflag;
1480
1481       getoflag
1482               Retrieve the c_oflag field of a termios object.
1483
1484                       $c_oflag = $termios->getoflag;
1485
1486       getospeed
1487               Retrieve the output baud rate.
1488
1489                       $ospeed = $termios->getospeed;
1490
1491       setattr Set terminal control attributes.
1492
1493               Set attributes immediately for stdout.
1494
1495                       $termios->setattr( 1, &POSIX::TCSANOW );
1496
1497               Returns "undef" on failure.
1498
1499       setcc   Set a value in the c_cc field of a termios object.  The c_cc
1500               field is an array so an index must be specified.
1501
1502                       $termios->setcc( &POSIX::VEOF, 1 );
1503
1504       setcflag
1505               Set the c_cflag field of a termios object.
1506
1507                       $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
1508
1509       setiflag
1510               Set the c_iflag field of a termios object.
1511
1512                       $termios->setiflag( $c_iflag | &POSIX::BRKINT );
1513
1514       setispeed
1515               Set the input baud rate.
1516
1517                       $termios->setispeed( &POSIX::B9600 );
1518
1519               Returns "undef" on failure.
1520
1521       setlflag
1522               Set the c_lflag field of a termios object.
1523
1524                       $termios->setlflag( $c_lflag | &POSIX::ECHO );
1525
1526       setoflag
1527               Set the c_oflag field of a termios object.
1528
1529                       $termios->setoflag( $c_oflag | &POSIX::OPOST );
1530
1531       setospeed
1532               Set the output baud rate.
1533
1534                       $termios->setospeed( &POSIX::B9600 );
1535
1536               Returns "undef" on failure.
1537
1538       Baud rate values
1539               B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600
1540               B4800 B50 B2400 B110
1541
1542       Terminal interface values
1543               TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH
1544               TCSAFLUSH TCIOFF TCOOFF
1545
1546       c_cc field values
1547               VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN
1548               VTIME NCCS
1549
1550       c_cflag field values
1551               CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
1552
1553       c_iflag field values
1554               BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON
1555               PARMRK
1556
1557       c_lflag field values
1558               ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
1559
1560       c_oflag field values
1561               OPOST
1562

PATHNAME CONSTANTS

1564       Constants
1565               _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT
1566               _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF
1567               _PC_VDISABLE
1568

POSIX CONSTANTS

1570       Constants
1571               _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED
1572               _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON
1573               _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX
1574               _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF
1575               _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX
1576               _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION
1577

SYSTEM CONFIGURATION

1579       Constants
1580               _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
1581               _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
1582               _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
1583

ERRNO

1585       Constants
1586               E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN
1587               EALREADY EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED
1588               ECONNRESET EDEADLK EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG
1589               EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR EINVAL EIO EISCONN
1590               EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENETDOWN
1591               ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
1592               ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN
1593               ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
1594               EPFNOSUPPORT EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE
1595               EREMOTE ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH
1596               ESTALE ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV
1597

FCNTL

1599       Constants
1600               FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD
1601               F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND
1602               O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
1603               O_WRONLY
1604

FLOAT

1606       Constants
1607               DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP
1608               DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG
1609               FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
1610               FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS
1611               LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP
1612               LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP
1613

LIMITS

1615       Constants
1616               ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN
1617               LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX
1618               NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX
1619               SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX
1620               UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
1621

LOCALE

1623       Constants
1624               LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
1625

MATH

1627       Constants
1628               HUGE_VAL
1629

SIGNAL

1631       Constants
1632               SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND
1633               SA_RESTART SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE
1634               SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP
1635               SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIG_BLOCK
1636               SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
1637

STAT

1639       Constants
1640               S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID
1641               S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
1642
1643       Macros  S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
1644

STDLIB

1646       Constants
1647               EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
1648

STDIO

1650       Constants
1651               BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
1652

TIME

1654       Constants
1655               CLK_TCK CLOCKS_PER_SEC
1656

UNISTD

1658       Constants
1659               R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO
1660               STDERR_FILENO W_OK X_OK
1661

WAIT

1663       Constants
1664               WNOHANG WUNTRACED
1665
1666               WNOHANG         Do not suspend the calling process until a
1667                               child process changes state but instead return
1668                               immediately.
1669
1670               WUNTRACED       Catch stopped child processes.
1671
1672       Macros  WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
1673
1674               WIFEXITED       WIFEXITED($?) returns true if the child process
1675                               exited normally ("exit()" or by falling off the
1676                               end of "main()")
1677
1678               WEXITSTATUS     WEXITSTATUS($?) returns the normal exit status
1679                               of the child process (only meaningful if
1680                               WIFEXITED($?) is true)
1681
1682               WIFSIGNALED     WIFSIGNALED($?) returns true if the child
1683                               process terminated because of a signal
1684
1685               WTERMSIG        WTERMSIG($?) returns the signal the child
1686                               process terminated for (only meaningful if
1687                               WIFSIGNALED($?) is true)
1688
1689               WIFSTOPPED      WIFSTOPPED($?) returns true if the child
1690                               process is currently stopped (can happen only
1691                               if you specified the WUNTRACED flag to
1692                               waitpid())
1693
1694               WSTOPSIG        WSTOPSIG($?) returns the signal the child
1695                               process was stopped for (only meaningful if
1696                               WIFSTOPPED($?) is true)
1697
1698
1699
1700perl v5.10.1                      2009-04-12                        POSIX(3pm)
Impressum