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           my $sess_id = POSIX::setsid();
16
17           my $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       This document gives a condensed list of the features available in the
26       POSIX module.  Consult your operating system's manpages for general
27       information on most features.  Consult perlfunc for functions which are
28       noted as being identical or almost identical to Perl's builtin
29       functions.
30
31       The first section describes POSIX functions from the 1003.1
32       specification.  The second section describes some classes for signal
33       objects, TTY objects, and other miscellaneous objects.  The remaining
34       sections list various constants and macros in an organization which
35       roughly follows IEEE Std 1003.1b-1993.
36
37       The notation "[C99]" indicates functions that were added in the ISO/IEC
38       9899:1999 version of the C language standard.  Some may not be
39       available on your system if it adheres to an earlier standard.
40       Attempts to use any missing one will result in a fatal runtime error
41       message.
42

CAVEATS

44       Everything is exported by default (with a handful of exceptions).  This
45       is an unfortunate backwards compatibility feature and its use is
46       strongly discouraged.  You should either prevent the exporting (by
47       saying "use POSIX ();", as usual) and then use fully qualified names
48       (e.g. "POSIX::SEEK_END"), or give an explicit import list.  If you do
49       neither and opt for the default (as in "use POSIX;"), you will import
50       hundreds and hundreds of symbols into your namespace.
51
52       A few functions are not implemented because they are C specific.  If
53       you attempt to call these, they will print a message telling you that
54       they aren't implemented, and suggest using the Perl equivalent, should
55       one exist.  For example, trying to access the setjmp() call will elicit
56       the message ""setjmp() is C-specific: use eval {} instead"".
57
58       Furthermore, some evil vendors will claim 1003.1 compliance, but in
59       fact are not so: they will not pass the PCTS (POSIX Compliance Test
60       Suites).  For example, one vendor may not define "EDEADLK", or the
61       semantics of the errno values set by open(2) might not be quite right.
62       Perl does not attempt to verify POSIX compliance.  That means you can
63       currently successfully say "use POSIX",  and then later in your program
64       you find that your vendor has been lax and there's no usable "ICANON"
65       macro after all.  This could be construed to be a bug.
66

FUNCTIONS

68       "_exit" This is identical to the C function _exit().  It exits the
69               program immediately which means among other things buffered I/O
70               is not flushed.
71
72               Note that when using threads and in Linux this is not a good
73               way to exit a thread because in Linux processes and threads are
74               kind of the same thing (Note: while this is the situation in
75               early 2003 there are projects under way to have threads with
76               more POSIXly semantics in Linux).  If you want not to return
77               from a thread, detach the thread.
78
79       "abort" This is identical to the C function abort().  It terminates the
80               process with a "SIGABRT" signal unless caught by a signal
81               handler or if the handler does not return normally (it e.g.
82               does a "longjmp").
83
84       "abs"   This is identical to Perl's builtin abs() function, returning
85               the absolute value of its numerical argument (except that
86               POSIX::abs() must be provided an explicit value (rather than
87               relying on an implicit $_):
88
89                   $absolute_value = POSIX::abs(42);   # good
90
91                   $absolute_value = POSIX::abs();     # throws exception
92
93       "access"
94               Determines the accessibility of a file.
95
96                       if( POSIX::access( "/", &POSIX::R_OK ) ){
97                               print "have read permission\n";
98                       }
99
100               Returns "undef" on failure.  Note: do not use access() for
101               security purposes.  Between the access() call and the operation
102               you are preparing for the permissions might change: a classic
103               race condition.
104
105       "acos"  This is identical to the C function acos(), returning the arcus
106               cosine of its numerical argument.  See also Math::Trig.
107
108       "acosh" This is identical to the C function acosh(), returning the
109               hyperbolic arcus cosine of its numerical argument [C99].  See
110               also Math::Trig.  Added in Perl v5.22.
111
112       "alarm" This is identical to Perl's builtin alarm() function, either
113               for arming or disarming the "SIGARLM" timer, except that
114               POSIX::alarm() must be provided an explicit value (rather than
115               relying on an implicit $_):
116
117                   POSIX::alarm(3)     # good
118
119                   POSIX::alarm()      # throws exception
120
121       "asctime"
122               This is identical to the C function asctime().  It returns a
123               string of the form
124
125                       "Fri Jun  2 18:22:13 2000\n\0"
126
127               and it is called thusly
128
129                       $asctime = asctime($sec, $min, $hour, $mday, $mon,
130                                          $year, $wday, $yday, $isdst);
131
132               The $mon is zero-based: January equals 0.  The $year is
133               1900-based: 2001 equals 101.  $wday and $yday default to zero
134               (and are usually ignored anyway), and $isdst defaults to -1.
135
136               Note the result is always in English.  Use "strftime" instead
137               to get a result suitable for the current locale.  That
138               function's %c format yields the locale's preferred
139               representation.
140
141       "asin"  This is identical to the C function asin(), returning the arcus
142               sine of its numerical argument.  See also Math::Trig.
143
144       "asinh" This is identical to the C function asinh(), returning the
145               hyperbolic arcus sine of its numerical argument [C99].  See
146               also Math::Trig.  Added in Perl v5.22.
147
148       "assert"
149               Unimplemented, but you can use "die" in perlfunc and the Carp
150               module to achieve similar things.
151
152       "atan"  This is identical to the C function atan(), returning the arcus
153               tangent of its numerical argument.  See also Math::Trig.
154
155       "atanh" This is identical to the C function atanh(), returning the
156               hyperbolic arcus tangent of its numerical argument [C99].  See
157               also Math::Trig.  Added in Perl v5.22.
158
159       "atan2" This is identical to Perl's builtin atan2() function, returning
160               the arcus tangent defined by its two numerical arguments, the y
161               coordinate and the x coordinate.  See also Math::Trig.
162
163       "atexit"
164               Not implemented.  atexit() is C-specific: use "END {}" instead,
165               see perlmod.
166
167       "atof"  Not implemented.  atof() is C-specific.  Perl converts strings
168               to numbers transparently.  If you need to force a scalar to a
169               number, add a zero to it.
170
171       "atoi"  Not implemented.  atoi() is C-specific.  Perl converts strings
172               to numbers transparently.  If you need to force a scalar to a
173               number, add a zero to it.  If you need to have just the integer
174               part, see "int" in perlfunc.
175
176       "atol"  Not implemented.  atol() is C-specific.  Perl converts strings
177               to numbers transparently.  If you need to force a scalar to a
178               number, add a zero to it.  If you need to have just the integer
179               part, see "int" in perlfunc.
180
181       "bsearch"
182               bsearch() not supplied.  For doing binary search on wordlists,
183               see Search::Dict.
184
185       "calloc"
186               Not implemented.  calloc() is C-specific.  Perl does memory
187               management transparently.
188
189       "cbrt"  The cube root [C99].  Added in Perl v5.22.
190
191       "ceil"  This is identical to the C function ceil(), returning the
192               smallest integer value greater than or equal to the given
193               numerical argument.
194
195       "chdir" This is identical to Perl's builtin chdir() function, allowing
196               one to change the working (default) directory -- see "chdir" in
197               perlfunc -- with the exception that POSIX::chdir() must be
198               provided an explicit value (rather than relying on an implicit
199               $_):
200
201                   $rv = POSIX::chdir('path/to/dir');      # good
202
203                   $rv = POSIX::chdir();                   # throws exception
204
205       "chmod" This is identical to Perl's builtin chmod() function, allowing
206               one to change file and directory permissions -- see "chmod" in
207               perlfunc -- with the exception that POSIX::chmod() can only
208               change one file at a time (rather than a list of files):
209
210                   $c = chmod 0664, $file1, $file2;          # good
211
212                   $c = POSIX::chmod 0664, $file1;           # throws exception
213
214                   $c = POSIX::chmod 0664, $file1, $file2;   # throws exception
215
216               As with the built-in chmod(), $file may be a filename or a file
217               handle.
218
219       "chown" This is identical to Perl's builtin chown() function, allowing
220               one to change file and directory owners and groups, see "chown"
221               in perlfunc.
222
223       "clearerr"
224               Not implemented.  Use the method IO::Handle::clearerr()
225               instead, to reset the error state (if any) and EOF state (if
226               any) of the given stream.
227
228       "clock" This is identical to the C function clock(), returning the
229               amount of spent processor time in microseconds.
230
231       "close" Close the file.  This uses file descriptors such as those
232               obtained by calling "POSIX::open".
233
234                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
235                       POSIX::close( $fd );
236
237               Returns "undef" on failure.
238
239               See also "close" in perlfunc.
240
241       "closedir"
242               This is identical to Perl's builtin closedir() function for
243               closing a directory handle, see "closedir" in perlfunc.
244
245       "cos"   This is identical to Perl's builtin cos() function, for
246               returning the cosine of its numerical argument, see "cos" in
247               perlfunc.  See also Math::Trig.
248
249       "cosh"  This is identical to the C function cosh(), for returning the
250               hyperbolic cosine of its numeric argument.  See also
251               Math::Trig.
252
253       "copysign"
254               Returns "x" but with the sign of "y" [C99].  Added in Perl
255               v5.22.
256
257                $x_with_sign_of_y = POSIX::copysign($x, $y);
258
259               See also "signbit".
260
261       "creat" Create a new file.  This returns a file descriptor like the
262               ones returned by "POSIX::open".  Use "POSIX::close" to close
263               the file.
264
265                       $fd = POSIX::creat( "foo", 0611 );
266                       POSIX::close( $fd );
267
268               See also "sysopen" in perlfunc and its "O_CREAT" flag.
269
270       "ctermid"
271               Generates the path name for the controlling terminal.
272
273                       $path = POSIX::ctermid();
274
275       "ctime" This is identical to the C function ctime() and equivalent to
276               "asctime(localtime(...))", see "asctime" and "localtime".
277
278       "cuserid" [POSIX.1-1988]
279               Get the login name of the owner of the current process.
280
281                       $name = POSIX::cuserid();
282
283               Note: this function has not been specified by POSIX since 1990
284               and is included only for backwards compatibility. New code
285               should use getlogin() instead.
286
287       "difftime"
288               This is identical to the C function difftime(), for returning
289               the time difference (in seconds) between two times (as returned
290               by time()), see "time".
291
292       "div"   Not implemented.  div() is C-specific, use "int" in perlfunc on
293               the usual "/" division and the modulus "%".
294
295       "dup"   This is similar to the C function dup(), for duplicating a file
296               descriptor.
297
298               This uses file descriptors such as those obtained by calling
299               "POSIX::open".
300
301               Returns "undef" on failure.
302
303       "dup2"  This is similar to the C function dup2(), for duplicating a
304               file descriptor to an another known file descriptor.
305
306               This uses file descriptors such as those obtained by calling
307               "POSIX::open".
308
309               Returns "undef" on failure.
310
311       "erf"   The error function [C99].  Added in Perl v5.22.
312
313       "erfc"  The complementary error function [C99].  Added in Perl v5.22.
314
315       "errno" Returns the value of errno.
316
317                       $errno = POSIX::errno();
318
319               This identical to the numerical values of the $!, see "$ERRNO"
320               in perlvar.
321
322       "execl" Not implemented.  execl() is C-specific, see "exec" in
323               perlfunc.
324
325       "execle"
326               Not implemented.  execle() is C-specific, see "exec" in
327               perlfunc.
328
329       "execlp"
330               Not implemented.  execlp() is C-specific, see "exec" in
331               perlfunc.
332
333       "execv" Not implemented.  execv() is C-specific, see "exec" in
334               perlfunc.
335
336       "execve"
337               Not implemented.  execve() is C-specific, see "exec" in
338               perlfunc.
339
340       "execvp"
341               Not implemented.  execvp() is C-specific, see "exec" in
342               perlfunc.
343
344       "exit"  This is identical to Perl's builtin exit() function for exiting
345               the program, see "exit" in perlfunc.
346
347       "exp"   This is identical to Perl's builtin exp() function for
348               returning the exponent (e-based) of the numerical argument, see
349               "exp" in perlfunc.
350
351       "expm1" Equivalent to "exp(x) - 1", but more precise for small argument
352               values [C99].  Added in Perl v5.22.
353
354               See also "log1p".
355
356       "fabs"  This is identical to Perl's builtin abs() function for
357               returning the absolute value of the numerical argument, see
358               "abs" in perlfunc.
359
360       "fclose"
361               Not implemented.  Use method IO::Handle::close() instead, or
362               see "close" in perlfunc.
363
364       "fcntl" This is identical to Perl's builtin fcntl() function, see
365               "fcntl" in perlfunc.
366
367       "fdopen"
368               Not implemented.  Use method IO::Handle::new_from_fd() instead,
369               or see "open" in perlfunc.
370
371       "feof"  Not implemented.  Use method IO::Handle::eof() instead, or see
372               "eof" in perlfunc.
373
374       "ferror"
375               Not implemented.  Use method IO::Handle::error() instead.
376
377       "fflush"
378               Not implemented.  Use method IO::Handle::flush() instead.  See
379               also ""$OUTPUT_AUTOFLUSH" in perlvar".
380
381       "fgetc" Not implemented.  Use method IO::Handle::getc() instead, or see
382               "read" in perlfunc.
383
384       "fgetpos"
385               Not implemented.  Use method IO::Seekable::getpos() instead, or
386               see "seek" in perlfunc.
387
388       "fgets" Not implemented.  Use method IO::Handle::gets() instead.
389               Similar to <>, also known as "readline" in perlfunc.
390
391       "fileno"
392               Not implemented.  Use method IO::Handle::fileno() instead, or
393               see "fileno" in perlfunc.
394
395       "floor" This is identical to the C function floor(), returning the
396               largest integer value less than or equal to the numerical
397               argument.
398
399       "fdim"  "Positive difference", "x - y" if "x > y", zero otherwise
400               [C99].  Added in Perl v5.22.
401
402       "fegetround"
403               Returns the current floating point rounding mode, one of
404
405                 FE_TONEAREST FE_TOWARDZERO FE_UPWARD FE_DOWNWARD
406
407               "FE_TONEAREST" is like "round", "FE_TOWARDZERO" is like "trunc"
408               [C99].  Added in Perl v5.22.
409
410       "fesetround"
411               Sets the floating point rounding mode, see "fegetround" [C99].
412               Added in Perl v5.22.
413
414       "fma"   "Fused multiply-add", "x * y + z", possibly faster (and less
415               lossy) than the explicit two operations [C99].  Added in Perl
416               v5.22.
417
418                my $fused = POSIX::fma($x, $y, $z);
419
420       "fmax"  Maximum of "x" and "y", except when either is "NaN", returns
421               the other [C99].  Added in Perl v5.22.
422
423                my $max = POSIX::fmax($x, $y);
424
425       "fmin"  Minimum of "x" and "y", except when either is "NaN", returns
426               the other [C99].  Added in Perl v5.22.
427
428                my $min = POSIX::fmin($x, $y);
429
430       "fmod"  This is identical to the C function fmod().
431
432                       $r = fmod($x, $y);
433
434               It returns the remainder "$r = $x - $n*$y", where
435               "$n = trunc($x/$y)".  The $r has the same sign as $x and
436               magnitude (absolute value) less than the magnitude of $y.
437
438       "fopen" Not implemented.  Use method IO::File::open() instead, or see
439               "open" in perlfunc.
440
441       "fork"  This is identical to Perl's builtin fork() function for
442               duplicating the current process, see "fork" in perlfunc and
443               perlfork if you are in Windows.
444
445       "fpathconf"
446               Retrieves the value of a configurable limit on a file or
447               directory.  This uses file descriptors such as those obtained
448               by calling "POSIX::open".
449
450               The following will determine the maximum length of the longest
451               allowable pathname on the filesystem which holds /var/foo.
452
453                       $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY );
454                       $path_max = POSIX::fpathconf($fd, &POSIX::_PC_PATH_MAX);
455
456               Returns "undef" on failure.
457
458       "fpclassify"
459               Returns one of
460
461                 FP_NORMAL FP_ZERO FP_SUBNORMAL FP_INFINITE FP_NAN
462
463               telling the class of the argument [C99].  "FP_INFINITE" is
464               positive or negative infinity, "FP_NAN" is not-a-number.
465               "FP_SUBNORMAL" means subnormal numbers (also known as
466               denormals), very small numbers with low precision. "FP_ZERO" is
467               zero.  "FP_NORMAL" is all the rest.  Added in Perl v5.22.
468
469       "fprintf"
470               Not implemented.  fprintf() is C-specific, see "printf" in
471               perlfunc instead.
472
473       "fputc" Not implemented.  fputc() is C-specific, see "print" in
474               perlfunc instead.
475
476       "fputs" Not implemented.  fputs() is C-specific, see "print" in
477               perlfunc instead.
478
479       "fread" Not implemented.  fread() is C-specific, see "read" in perlfunc
480               instead.
481
482       "free"  Not implemented.  free() is C-specific.  Perl does memory
483               management transparently.
484
485       "freopen"
486               Not implemented.  freopen() is C-specific, see "open" in
487               perlfunc instead.
488
489       "frexp" Return the mantissa and exponent of a floating-point number.
490
491                       ($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
492
493       "fscanf"
494               Not implemented.  fscanf() is C-specific, use <> and regular
495               expressions instead.
496
497       "fseek" Not implemented.  Use method IO::Seekable::seek() instead, or
498               see "seek" in perlfunc.
499
500       "fsetpos"
501               Not implemented.  Use method IO::Seekable::setpos() instead, or
502               seek "seek" in perlfunc.
503
504       "fstat" Get file status.  This uses file descriptors such as those
505               obtained by calling "POSIX::open".  The data returned is
506               identical to the data from Perl's builtin "stat" function.
507
508                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
509                       @stats = POSIX::fstat( $fd );
510
511       "fsync" Not implemented.  Use method IO::Handle::sync() instead.
512
513       "ftell" Not implemented.  Use method IO::Seekable::tell() instead, or
514               see "tell" in perlfunc.
515
516       "fwrite"
517               Not implemented.  fwrite() is C-specific, see "print" in
518               perlfunc instead.
519
520       "getc"  This is identical to Perl's builtin getc() function, see "getc"
521               in perlfunc.
522
523       "getchar"
524               Returns one character from STDIN.  Identical to Perl's getc(),
525               see "getc" in perlfunc.
526
527       "getcwd"
528               Returns the name of the current working directory.  See also
529               Cwd.
530
531       "getegid"
532               Returns the effective group identifier.  Similar to Perl' s
533               builtin variable $(, see "$EGID" in perlvar.
534
535       "getenv"
536               Returns the value of the specified environment variable.  The
537               same information is available through the %ENV array.
538
539       "geteuid"
540               Returns the effective user identifier.  Identical to Perl's
541               builtin $> variable, see "$EUID" in perlvar.
542
543       "getgid"
544               Returns the user's real group identifier.  Similar to Perl's
545               builtin variable $), see "$GID" in perlvar.
546
547       "getgrgid"
548               This is identical to Perl's builtin getgrgid() function for
549               returning group entries by group identifiers, see "getgrgid" in
550               perlfunc.
551
552       "getgrnam"
553               This is identical to Perl's builtin getgrnam() function for
554               returning group entries by group names, see "getgrnam" in
555               perlfunc.
556
557       "getgroups"
558               Returns the ids of the user's supplementary groups.  Similar to
559               Perl's builtin variable $), see "$GID" in perlvar.
560
561       "getlogin"
562               This is identical to Perl's builtin getlogin() function for
563               returning the user name associated with the current session,
564               see "getlogin" in perlfunc.
565
566       "getpayload"
567                       use POSIX ':nan_payload';
568                       getpayload($var)
569
570               Returns the "NaN" payload.  Added in Perl v5.24.
571
572               Note the API instability warning in "setpayload".
573
574               See "nan" for more discussion about "NaN".
575
576       "getpgrp"
577               This is identical to Perl's builtin getpgrp() function for
578               returning the process group identifier of the current process,
579               see "getpgrp" in perlfunc.
580
581       "getpid"
582               Returns the process identifier.  Identical to Perl's builtin
583               variable $$, see "$PID" in perlvar.
584
585       "getppid"
586               This is identical to Perl's builtin getppid() function for
587               returning the process identifier of the parent process of the
588               current process , see "getppid" in perlfunc.
589
590       "getpwnam"
591               This is identical to Perl's builtin getpwnam() function for
592               returning user entries by user names, see "getpwnam" in
593               perlfunc.
594
595       "getpwuid"
596               This is identical to Perl's builtin getpwuid() function for
597               returning user entries by user identifiers, see "getpwuid" in
598               perlfunc.
599
600       "gets"  Returns one line from "STDIN", similar to <>, also known as the
601               readline() function, see "readline" in perlfunc.
602
603               NOTE: if you have C programs that still use gets(), be very
604               afraid.  The gets() function is a source of endless grief
605               because it has no buffer overrun checks.  It should never be
606               used.  The fgets() function should be preferred instead.
607
608       "getuid"
609               Returns the user's identifier.  Identical to Perl's builtin $<
610               variable, see "$UID" in perlvar.
611
612       "gmtime"
613               This is identical to Perl's builtin gmtime() function for
614               converting seconds since the epoch to a date in Greenwich Mean
615               Time, see "gmtime" in perlfunc.
616
617       "hypot" Equivalent to sqrt(x * x + y * y) except more stable on very
618               large or very small arguments [C99].  Added in Perl v5.22.
619
620       "ilogb" Integer binary logarithm [C99].  Added in Perl v5.22.
621
622               For example ilogb(20) is 4, as an integer.
623
624               See also "logb".
625
626       "Inf"   The infinity as a constant:
627
628                  use POSIX qw(Inf);
629                  my $pos_inf = +Inf;  # Or just Inf.
630                  my $neg_inf = -Inf;
631
632               See also "isinf", and "fpclassify".
633
634       "isalnum"
635               This function has been removed as of Perl v5.24.  It was very
636               similar to matching against "qr/ ^ [[:alnum:]]+ $ /x", which
637               you should convert to use instead.  See "POSIX Character
638               Classes" in perlrecharclass.
639
640       "isalpha"
641               This function has been removed as of Perl v5.24.  It was very
642               similar to matching against "qr/ ^ [[:alpha:]]+ $ /x", which
643               you should convert to use instead.  See "POSIX Character
644               Classes" in perlrecharclass.
645
646       "isatty"
647               Returns a boolean indicating whether the specified filehandle
648               is connected to a tty.  Similar to the "-t" operator, see "-X"
649               in perlfunc.
650
651       "iscntrl"
652               This function has been removed as of Perl v5.24.  It was very
653               similar to matching against "qr/ ^ [[:cntrl:]]+ $ /x", which
654               you should convert to use instead.  See "POSIX Character
655               Classes" in perlrecharclass.
656
657       "isdigit"
658               This function has been removed as of Perl v5.24.  It was very
659               similar to matching against "qr/ ^ [[:digit:]]+ $ /x", which
660               you should convert to use instead.  See "POSIX Character
661               Classes" in perlrecharclass.
662
663       "isfinite"
664               Returns true if the argument is a finite number (that is, not
665               an infinity, or the not-a-number) [C99].  Added in Perl v5.22.
666
667               See also "isinf", "isnan", and "fpclassify".
668
669       "isgraph"
670               This function has been removed as of Perl v5.24.  It was very
671               similar to matching against "qr/ ^ [[:graph:]]+ $ /x", which
672               you should convert to use instead.  See "POSIX Character
673               Classes" in perlrecharclass.
674
675       "isgreater"
676               (Also "isgreaterequal", "isless", "islessequal",
677               "islessgreater", "isunordered")
678
679               Floating point comparisons which handle the "NaN" [C99].  Added
680               in Perl v5.22.
681
682       "isinf" Returns true if the argument is an infinity (positive or
683               negative) [C99].  Added in Perl v5.22.
684
685               See also "Inf", "isnan", "isfinite", and "fpclassify".
686
687       "islower"
688               This function has been removed as of Perl v5.24.  It was very
689               similar to matching against "qr/ ^ [[:lower:]]+ $ /x", which
690               you should convert to use instead.  See "POSIX Character
691               Classes" in perlrecharclass.
692
693       "isnan" Returns true if the argument is "NaN" (not-a-number) [C99].
694               Added in Perl v5.22.
695
696               Note that you can also test for ""NaN"-ness" with equality
697               operators ("==" or "!="), as in
698
699                   print "x is not a NaN\n" if $x == $x;
700
701               since the "NaN" is not equal to anything, including itself.
702
703               See also "nan", "NaN", "isinf", and "fpclassify".
704
705       "isnormal"
706               Returns true if the argument is normal (that is, not a
707               subnormal/denormal, and not an infinity, or a not-a-number)
708               [C99].  Added in Perl v5.22.
709
710               See also "isfinite", and "fpclassify".
711
712       "isprint"
713               This function has been removed as of Perl v5.24.  It was very
714               similar to matching against "qr/ ^ [[:print:]]+ $ /x", which
715               you should convert to use instead.  See "POSIX Character
716               Classes" in perlrecharclass.
717
718       "ispunct"
719               This function has been removed as of Perl v5.24.  It was very
720               similar to matching against "qr/ ^ [[:punct:]]+ $ /x", which
721               you should convert to use instead.  See "POSIX Character
722               Classes" in perlrecharclass.
723
724       "issignaling"
725                       use POSIX ':nan_payload';
726                       issignaling($var, $payload)
727
728               Return true if the argument is a signaling NaN.  Added in Perl
729               v5.24.
730
731               Note the API instability warning in "setpayload".
732
733               See "nan" for more discussion about "NaN".
734
735       "isspace"
736               This function has been removed as of Perl v5.24.  It was very
737               similar to matching against "qr/ ^ [[:space:]]+ $ /x", which
738               you should convert to use instead.  See "POSIX Character
739               Classes" in perlrecharclass.
740
741       "isupper"
742               This function has been removed as of Perl v5.24.  It was very
743               similar to matching against "qr/ ^ [[:upper:]]+ $ /x", which
744               you should convert to use instead.  See "POSIX Character
745               Classes" in perlrecharclass.
746
747       "isxdigit"
748               This function has been removed as of Perl v5.24.  It was very
749               similar to matching against "qr/ ^ [[:xdigit:]]+ $ /x", which
750               you should convert to use instead.  See "POSIX Character
751               Classes" in perlrecharclass.
752
753       "j0"
754       "j1"
755       "jn"
756       "y0"
757       "y1"
758       "yn"    The Bessel function of the first kind of the order zero.
759
760       "kill"  This is identical to Perl's builtin kill() function for sending
761               signals to processes (often to terminate them), see "kill" in
762               perlfunc.
763
764       "labs"  Not implemented.  (For returning absolute values of long
765               integers.)  labs() is C-specific, see "abs" in perlfunc
766               instead.
767
768       "lchown"
769               This is identical to the C function, except the order of
770               arguments is consistent with Perl's builtin chown() with the
771               added restriction of only one path, not a list of paths.  Does
772               the same thing as the chown() function but changes the owner of
773               a symbolic link instead of the file the symbolic link points
774               to.
775
776                POSIX::lchown($uid, $gid, $file_path);
777
778       "ldexp" This is identical to the C function ldexp() for multiplying
779               floating point numbers with powers of two.
780
781                       $x_quadrupled = POSIX::ldexp($x, 2);
782
783       "ldiv"  Not implemented.  (For computing dividends of long integers.)
784               ldiv() is C-specific, use "/" and int() instead.
785
786       "lgamma"
787               The logarithm of the Gamma function [C99].  Added in Perl
788               v5.22.
789
790               See also "tgamma".
791
792       "log1p" Equivalent to "log(1 + x)", but more stable results for small
793               argument values [C99].  Added in Perl v5.22.
794
795       "log2"  Logarithm base two [C99].  Added in Perl v5.22.
796
797               See also "expm1".
798
799       "logb"  Integer binary logarithm [C99].  Added in Perl v5.22.
800
801               For example logb(20) is 4, as a floating point number.
802
803               See also "ilogb".
804
805       "link"  This is identical to Perl's builtin link() function for
806               creating hard links into files, see "link" in perlfunc.
807
808       "localeconv"
809               Get numeric formatting information.  Returns a reference to a
810               hash containing the formatting values of the locale that
811               currently underlies the program, regardless of whether or not
812               it is called from within the scope of a "use locale".  Users of
813               this function should also read perllocale, which provides a
814               comprehensive discussion of Perl locale handling, including a
815               section devoted to this function.  Prior to Perl 5.28, or when
816               operating in a non thread-safe environment, it should not be
817               used in a threaded application unless it's certain that the
818               underlying locale is C or POSIX.  This is because it otherwise
819               changes the locale, which globally affects all threads
820               simultaneously.  Windows platforms starting with Visual Studio
821               2005 are mostly thread-safe, but use of this function in those
822               prior to Visual Studio 2015 can have a race with a thread that
823               has called "switch_to_global_locale" in perlapi.
824
825               Here is how to query the database for the de (Deutsch or
826               German) locale.
827
828                       my $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
829                       print "Locale: \"$loc\"\n";
830                       my $lconv = POSIX::localeconv();
831                       foreach my $property (qw(
832                               decimal_point
833                               thousands_sep
834                               grouping
835                               int_curr_symbol
836                               currency_symbol
837                               mon_decimal_point
838                               mon_thousands_sep
839                               mon_grouping
840                               positive_sign
841                               negative_sign
842                               int_frac_digits
843                               frac_digits
844                               p_cs_precedes
845                               p_sep_by_space
846                               n_cs_precedes
847                               n_sep_by_space
848                               p_sign_posn
849                               n_sign_posn
850                               int_p_cs_precedes
851                               int_p_sep_by_space
852                               int_n_cs_precedes
853                               int_n_sep_by_space
854                               int_p_sign_posn
855                               int_n_sign_posn
856                       ))
857                       {
858                               printf qq(%s: "%s",\n),
859                                       $property, $lconv->{$property};
860                       }
861
862               The members whose names begin with "int_p_" and "int_n_" were
863               added by POSIX.1-2008 and are only available on systems that
864               support them.
865
866               A value of -1 returned for numeric entries indicates that the
867               field is not applicable to the locale.  This is rare except in
868               the C and related locales, which don't have most monetary
869               values defined.  It can also happen, quirkily, in fields that
870               are otherwise boolean to indicate that the value is kind of
871               neither true nor false.  This happens in "p_cs_precedes" and
872               "int_p_cs_precedes" when the currency symbol neither precedes
873               nor succeeds a positive value but is infixed, by replacing the
874               radix character.
875
876               Prior to Perl v5.37.7, empty string fields and numeric fields
877               with value -1 were omittted from the returned hash.
878
879       "localtime"
880               This is identical to Perl's builtin localtime() function for
881               converting seconds since the epoch to a date see "localtime" in
882               perlfunc except that POSIX::localtime() must be provided an
883               explicit value (rather than relying on an implicit $_):
884
885                   @localtime = POSIX::localtime(time);    # good
886
887                   @localtime = localtime();               # good
888
889                   @localtime = POSIX::localtime();        # throws exception
890
891       "log"   This is identical to Perl's builtin log() function, returning
892               the natural (e-based) logarithm of the numerical argument, see
893               "log" in perlfunc.
894
895       "log10" This is identical to the C function log10(), returning the
896               10-base logarithm of the numerical argument.  You can also use
897
898                   sub log10 { log($_[0]) / log(10) }
899
900               or
901
902                   sub log10 { log($_[0]) / 2.30258509299405 }
903
904               or
905
906                   sub log10 { log($_[0]) * 0.434294481903252 }
907
908       "longjmp"
909               Not implemented.  longjmp() is C-specific: use "die" in
910               perlfunc instead.
911
912       "lseek" Move the file's read/write position.  This uses file
913               descriptors such as those obtained by calling "POSIX::open".
914
915                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
916                       $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
917
918               Returns "undef" on failure.
919
920       "lrint" Depending on the current floating point rounding mode, rounds
921               the argument either toward nearest (like "round"), toward zero
922               (like "trunc"), downward (toward negative infinity), or upward
923               (toward positive infinity) [C99].  Added in Perl v5.22.
924
925               For the rounding mode, see "fegetround".
926
927       "lround"
928               Like "round", but as integer, as opposed to floating point
929               [C99].  Added in Perl v5.22.
930
931               See also "ceil", "floor", "trunc".
932
933               Owing to an oversight, this is not currently exported by
934               default, or as part of the ":math_h_c99" export tag; importing
935               it must therefore be done by explicit name.
936
937       "malloc"
938               Not implemented.  malloc() is C-specific.  Perl does memory
939               management transparently.
940
941       "mblen" This is the same as the C function mblen() on unthreaded perls.
942               On threaded perls, it transparently (almost) substitutes the
943               more thread-safe "mbrlen"(3), if available, instead of "mblen".
944
945               Core Perl does not have any support for wide and multibyte
946               locales, except Unicode UTF-8 locales.  This function, in
947               conjunction with "mbtowc" and "wctomb" may be used to roll your
948               own decoding/encoding of other types of multi-byte locales.
949
950               Use "undef" as the first parameter to this function to get the
951               effect of passing NULL as the first parameter to "mblen".  This
952               resets any shift state to its initial value.  The return value
953               is undefined if "mbrlen" was substituted, so you should never
954               rely on it.
955
956               When the first parameter is a scalar containing a value that
957               either is a PV string or can be forced into one, the return
958               value is the number of bytes occupied by the first character of
959               that string; or 0 if that first character is the wide NUL
960               character; or negative if there is an error.  This is based on
961               the locale that currently underlies the program, regardless of
962               whether or not the function is called from Perl code that is
963               within the scope of "use locale".  Perl makes no attempt at
964               hiding from your code any differences in the "errno" setting
965               between "mblen" and "mbrlen".  It does set "errno" to 0 before
966               calling them.
967
968               The optional second parameter is ignored if it is larger than
969               the actual length of the first parameter string.
970
971       "mbtowc"
972               This is the same as the C function mbtowc() on unthreaded
973               perls.  On threaded perls, it transparently (almost)
974               substitutes the more thread-safe "mbrtowc"(3), if available,
975               instead of "mbtowc".
976
977               Core Perl does not have any support for wide and multibyte
978               locales, except Unicode UTF-8 locales.  This function, in
979               conjunction with "mblen" and "wctomb" may be used to roll your
980               own decoding/encoding of other types of multi-byte locales.
981
982               The first parameter is a scalar into which, upon success, the
983               wide character represented by the multi-byte string contained
984               in the second parameter is stored.  The optional third
985               parameter is ignored if it is larger than the actual length of
986               the second parameter string.
987
988               Use "undef" as the second parameter to this function to get the
989               effect of passing NULL as the second parameter to "mbtowc".
990               This ignores the first parameter, and resets any shift state to
991               its initial value.  The return value is undefined if "mbrtowc"
992               was substituted, so you should never rely on it.
993
994               When the second parameter is a scalar containing a value that
995               either is a PV string or can be forced into one, the return
996               value is the number of bytes occupied by the first character of
997               that string; or 0 if that first character is the wide NUL
998               character; or negative if there is an error.  This is based on
999               the locale that currently underlies the program, regardless of
1000               whether or not the function is called from Perl code that is
1001               within the scope of "use locale".  Perl makes no attempt at
1002               hiding from your code any differences in the "errno" setting
1003               between "mbtowc" and "mbrtowc".  It does set "errno" to 0
1004               before calling them.
1005
1006       "memchr"
1007               Not implemented.  memchr() is C-specific, see "index" in
1008               perlfunc instead.
1009
1010       "memcmp"
1011               Not implemented.  memcmp() is C-specific, use "eq" instead, see
1012               perlop.
1013
1014       "memcpy"
1015               Not implemented.  memcpy() is C-specific, use "=", see perlop,
1016               or see "substr" in perlfunc.
1017
1018       "memmove"
1019               Not implemented.  memmove() is C-specific, use "=", see perlop,
1020               or see "substr" in perlfunc.
1021
1022       "memset"
1023               Not implemented.  memset() is C-specific, use "x" instead, see
1024               perlop.
1025
1026       "mkdir" This is identical to Perl's builtin mkdir() function for
1027               creating directories, see "mkdir" in perlfunc.
1028
1029       "mkfifo"
1030               This is similar to the C function mkfifo() for creating FIFO
1031               special files.
1032
1033                       if (mkfifo($path, $mode)) { ....
1034
1035               Returns "undef" on failure.  The $mode is similar to the mode
1036               of mkdir(), see "mkdir" in perlfunc, though for "mkfifo" you
1037               must specify the $mode.
1038
1039       "mktime"
1040               Convert date/time info to a calendar time.
1041
1042               Synopsis:
1043
1044                       mktime(sec, min, hour, mday, mon, year, wday = 0,
1045                              yday = 0, isdst = -1)
1046
1047               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
1048               at zero, i.e., January is 0, not 1; Sunday is 0, not 1; January
1049               1st is 0, not 1.  The year ("year") is given in years since
1050               1900; i.e., the year 1995 is 95; the year 2001 is 101.  Consult
1051               your system's mktime() manpage for details about these and the
1052               other arguments.
1053
1054               Calendar time for December 12, 1995, at 10:30 am.
1055
1056                       $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
1057                       print "Date = ", POSIX::ctime($time_t);
1058
1059               Returns "undef" on failure.
1060
1061       "modf"  Return the integral and fractional parts of a floating-point
1062               number.
1063
1064                       ($fractional, $integral) = POSIX::modf( 3.14 );
1065
1066               See also "round".
1067
1068       "NaN"   The not-a-number as a constant:
1069
1070                  use POSIX qw(NaN);
1071                  my $nan = NaN;
1072
1073               See also "nan", "/isnan", and "fpclassify".
1074
1075       "nan"
1076                  my $nan = nan();
1077
1078               Returns "NaN", not-a-number [C99].  Added in Perl v5.22.
1079
1080               The returned NaN is always a quiet NaN, as opposed to
1081               signaling.
1082
1083               With an argument, can be used to generate a NaN with payload.
1084               The argument is first interpreted as a floating point number,
1085               but then any fractional parts are truncated (towards zero), and
1086               the value is interpreted as an unsigned integer.  The bits of
1087               this integer are stored in the unused bits of the NaN.
1088
1089               The result has a dual nature: it is a NaN, but it also carries
1090               the integer inside it.  The integer can be retrieved with
1091               "getpayload".  Note, though, that the payload is not
1092               propagated, not even on copies, and definitely not in
1093               arithmetic operations.
1094
1095               How many bits fit in the NaN depends on what kind of floating
1096               points are being used, but on the most common platforms (64-bit
1097               IEEE 754, or the x86 80-bit long doubles) there are 51 and 61
1098               bits available, respectively.  (There would be 52 and 62, but
1099               the quiet/signaling bit of NaNs takes away one.)  However,
1100               because of the floating-point-to- integer-and-back conversions,
1101               please test carefully whether you get back what you put in.  If
1102               your integers are only 32 bits wide, you probably should not
1103               rely on more than 32 bits of payload.
1104
1105               Whether a "signaling" NaN is in any way different from a
1106               "quiet" NaN, depends on the platform.  Also note that the
1107               payload of the default NaN (no argument to nan()) is not
1108               necessarily zero, use "setpayload" to explicitly set the
1109               payload.  On some platforms like the 32-bit x86, (unless using
1110               the 80-bit long doubles) the signaling bit is not supported at
1111               all.
1112
1113               See also "isnan", "NaN", "setpayload" and "issignaling".
1114
1115       "nearbyint"
1116               Returns the nearest integer to the argument, according to the
1117               current rounding mode (see "fegetround") [C99].  Added in Perl
1118               v5.22.
1119
1120       "nextafter"
1121               Returns the next representable floating point number after "x"
1122               in the direction of "y" [C99].  Added in Perl v5.22.
1123
1124                my $nextafter = POSIX::nextafter($x, $y);
1125
1126               Like "nexttoward", but potentially less accurate.
1127
1128       "nexttoward"
1129               Returns the next representable floating point number after "x"
1130               in the direction of "y" [C99].  Added in Perl v5.22.
1131
1132                my $nexttoward = POSIX::nexttoward($x, $y);
1133
1134               Like "nextafter", but potentially more accurate.
1135
1136       "nice"  This is similar to the C function nice(), for changing the
1137               scheduling preference of the current process.  Positive
1138               arguments mean a more polite process, negative values a more
1139               needy process.  Normal (non-root) user processes can only
1140               change towards being more polite.
1141
1142               Returns "undef" on failure.
1143
1144       "offsetof"
1145               Not implemented.  offsetof() is C-specific, you probably want
1146               to see "pack" in perlfunc instead.
1147
1148       "open"  Open a file for reading for writing.  This returns file
1149               descriptors, not Perl filehandles.  Use "POSIX::close" to close
1150               the file.
1151
1152               Open a file read-only with mode 0666.
1153
1154                       $fd = POSIX::open( "foo" );
1155
1156               Open a file for read and write.
1157
1158                       $fd = POSIX::open( "foo", &POSIX::O_RDWR );
1159
1160               Open a file for write, with truncation.
1161
1162                       $fd = POSIX::open(
1163                               "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC
1164                       );
1165
1166               Create a new file with mode 0640.  Set up the file for writing.
1167
1168                       $fd = POSIX::open(
1169                               "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640
1170                       );
1171
1172               Returns "undef" on failure.
1173
1174               See also "sysopen" in perlfunc.
1175
1176       "opendir"
1177               Open a directory for reading.
1178
1179                       $dir = POSIX::opendir( "/var" );
1180                       @files = POSIX::readdir( $dir );
1181                       POSIX::closedir( $dir );
1182
1183               Returns "undef" on failure.
1184
1185       "pathconf"
1186               Retrieves the value of a configurable limit on a file or
1187               directory.
1188
1189               The following will determine the maximum length of the longest
1190               allowable pathname on the filesystem which holds "/var".
1191
1192                       $path_max = POSIX::pathconf( "/var",
1193                                                     &POSIX::_PC_PATH_MAX );
1194
1195               Returns "undef" on failure.
1196
1197       "pause" This is similar to the C function pause(), which suspends the
1198               execution of the current process until a signal is received.
1199
1200               Returns "undef" on failure.
1201
1202       "perror"
1203               This is identical to the C function perror(), which outputs to
1204               the standard error stream the specified message followed by ":
1205               " and the current error string.  Use the warn() function and
1206               the $!  variable instead, see "warn" in perlfunc and "$ERRNO"
1207               in perlvar.
1208
1209       "pipe"  Create an interprocess channel.  This returns file descriptors
1210               like those returned by "POSIX::open".
1211
1212                       my ($read, $write) = POSIX::pipe();
1213                       POSIX::write( $write, "hello", 5 );
1214                       POSIX::read( $read, $buf, 5 );
1215
1216               See also "pipe" in perlfunc.
1217
1218       "pow"   Computes $x raised to the power $exponent.
1219
1220                       $ret = POSIX::pow( $x, $exponent );
1221
1222               You can also use the "**" operator, see perlop.
1223
1224       "printf"
1225               Formats and prints the specified arguments to "STDOUT".  See
1226               also "printf" in perlfunc.
1227
1228       "putc"  Not implemented.  putc() is C-specific, see "print" in perlfunc
1229               instead.
1230
1231       "putchar"
1232               Not implemented.  putchar() is C-specific, see "print" in
1233               perlfunc instead.
1234
1235       "puts"  Not implemented.  puts() is C-specific, see "print" in perlfunc
1236               instead.
1237
1238       "qsort" Not implemented.  qsort() is C-specific, see "sort" in perlfunc
1239               instead.
1240
1241       "raise" Sends the specified signal to the current process.  See also
1242               "kill" in perlfunc and the $$ in "$PID" in perlvar.
1243
1244       "rand"  Not implemented.  rand() is non-portable, see "rand" in
1245               perlfunc instead.
1246
1247       "read"  Read from a file.  This uses file descriptors such as those
1248               obtained by calling "POSIX::open".  If the buffer $buf is not
1249               large enough for the read then Perl will extend it to make room
1250               for the request.
1251
1252                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
1253                       $bytes = POSIX::read( $fd, $buf, 3 );
1254
1255               Returns "undef" on failure.
1256
1257               See also "sysread" in perlfunc.
1258
1259       "readdir"
1260               This is identical to Perl's builtin readdir() function for
1261               reading directory entries, see "readdir" in perlfunc.
1262
1263       "realloc"
1264               Not implemented.  realloc() is C-specific.  Perl does memory
1265               management transparently.
1266
1267       "remainder"
1268               Given "x" and "y", returns the value "x - n*y", where "n" is
1269               the integer closest to "x"/"y" [C99].  Added in Perl v5.22.
1270
1271                my $remainder = POSIX::remainder($x, $y)
1272
1273               See also "remquo".
1274
1275       "remove"
1276               Deletes a name from the filesystem.  Calls "unlink" in perlfunc
1277               for files and "rmdir" in perlfunc for directories.
1278
1279       "remquo"
1280               Like "remainder" but also returns the low-order bits of the
1281               quotient (n) [C99].  Added in Perl v5.22.
1282
1283               (This is quite esoteric interface, mainly used to implement
1284               numerical algorithms.)
1285
1286       "rename"
1287               This is identical to Perl's builtin rename() function for
1288               renaming files, see "rename" in perlfunc.
1289
1290       "rewind"
1291               Seeks to the beginning of the file.
1292
1293       "rewinddir"
1294               This is identical to Perl's builtin rewinddir() function for
1295               rewinding directory entry streams, see "rewinddir" in perlfunc.
1296
1297       "rint"  Identical to "lrint".
1298
1299       "rmdir" This is identical to Perl's builtin rmdir() function for
1300               removing (empty) directories, see "rmdir" in perlfunc.
1301
1302       "round" Returns the integer (but still as floating point) nearest to
1303               the argument [C99].  Added in Perl v5.22.
1304
1305               See also "ceil", "floor", "lround", "modf", and "trunc".
1306
1307       "scalbn"
1308               Returns "x * 2**y" [C99].  Added in Perl v5.22.
1309
1310               See also "frexp" and "ldexp".
1311
1312       "scanf" Not implemented.  scanf() is C-specific, use <> and regular
1313               expressions instead, see perlre.
1314
1315       "setgid"
1316               Sets the real group identifier and the effective group
1317               identifier for this process.  Similar to assigning a value to
1318               the Perl's builtin $) variable, see "$EGID" in perlvar, except
1319               that the latter will change only the real user identifier, and
1320               that the setgid() uses only a single numeric argument, as
1321               opposed to a space-separated list of numbers.
1322
1323       "setjmp"
1324               Not implemented.  setjmp() is C-specific: use "eval {}"
1325               instead, see "eval" in perlfunc.
1326
1327       "setlocale"
1328               WARNING!  Prior to Perl 5.28 or on a system that does not
1329               support thread-safe locale operations, do NOT use this function
1330               in a thread.  The locale will change in all other threads at
1331               the same time, and should your thread get paused by the
1332               operating system, and another started, that thread will not
1333               have the locale it is expecting.  On some platforms, there can
1334               be a race leading to segfaults if two threads call this
1335               function nearly simultaneously.  This warning does not apply on
1336               unthreaded builds, or on perls where "${^SAFE_LOCALES}" exists
1337               and is non-zero; namely Perl 5.28 and later compiled to be
1338               locale-thread-safe.
1339
1340               This function modifies and queries the program's underlying
1341               locale.  Users of this function should read perllocale, whch
1342               provides a comprehensive discussion of Perl locale handling,
1343               knowledge of which is necessary to properly use this function.
1344               It contains a section devoted to this function.  The discussion
1345               here is merely a summary reference for setlocale().  Note that
1346               Perl itself is almost entirely unaffected by the locale except
1347               within the scope of "use locale".  (Exceptions are listed in
1348               "Not within the scope of "use locale"" in perllocale, and
1349               locale-dependent functions within the POSIX module ARE always
1350               affected by the current locale.)
1351
1352               The following examples assume
1353
1354                       use POSIX qw(setlocale LC_ALL LC_CTYPE);
1355
1356               has been issued.
1357
1358               The following will set the traditional UNIX system locale
1359               behavior (the second argument "C").
1360
1361                       $loc = setlocale( LC_ALL, "C" );
1362
1363               The following will query the current "LC_CTYPE" category.  (No
1364               second argument means 'query'.)
1365
1366                       $loc = setlocale( LC_CTYPE );
1367
1368               The following will set the "LC_CTYPE" behaviour according to
1369               the locale environment variables (the second argument "").
1370               Please see your system's setlocale(3) documentation for the
1371               locale environment variables' meaning or consult perllocale.
1372
1373                       $loc = setlocale( LC_CTYPE, "" );
1374
1375               The following will set the "LC_COLLATE" behaviour to
1376               Argentinian Spanish. NOTE: The naming and availability of
1377               locales depends on your operating system. Please consult
1378               perllocale for how to find out which locales are available in
1379               your system.
1380
1381                       $loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" );
1382
1383       "setpayload"
1384                       use POSIX ':nan_payload';
1385                       setpayload($var, $payload);
1386
1387               Sets the "NaN" payload of var.  Added in Perl v5.24.
1388
1389               NOTE: the NaN payload APIs are based on the latest (as of June
1390               2015) proposed ISO C interfaces, but they are not yet a
1391               standard.  Things may change.
1392
1393               See "nan" for more discussion about "NaN".
1394
1395               See also "setpayloadsig", "isnan", "getpayload", and
1396               "issignaling".
1397
1398       "setpayloadsig"
1399                       use POSIX ':nan_payload';
1400                       setpayloadsig($var, $payload);
1401
1402               Like "setpayload" but also makes the NaN signaling.  Added in
1403               Perl v5.24.
1404
1405               Depending on the platform the NaN may or may not behave
1406               differently.
1407
1408               Note the API instability warning in "setpayload".
1409
1410               Note that because how the floating point formats work out, on
1411               the most common platforms signaling payload of zero is best
1412               avoided, since it might end up being identical to "+Inf".
1413
1414               See also "nan", "isnan", "getpayload", and "issignaling".
1415
1416       "setpgid"
1417               This is similar to the C function setpgid() for setting the
1418               process group identifier of the current process.
1419
1420               Returns "undef" on failure.
1421
1422       "setsid"
1423               This is identical to the C function setsid() for setting the
1424               session identifier of the current process.
1425
1426       "setuid"
1427               Sets the real user identifier and the effective user identifier
1428               for this process.  Similar to assigning a value to the Perl's
1429               builtin $< variable, see "$UID" in perlvar, except that the
1430               latter will change only the real user identifier.
1431
1432       "sigaction"
1433               Detailed signal management.  This uses "POSIX::SigAction"
1434               objects for the "action" and "oldaction" arguments (the
1435               oldaction can also be just a hash reference).  Consult your
1436               system's "sigaction" manpage for details, see also
1437               "POSIX::SigRt".
1438
1439               Synopsis:
1440
1441                       sigaction(signal, action, oldaction = 0)
1442
1443               Returns "undef" on failure.  The "signal" must be a number
1444               (like "SIGHUP"), not a string (like "SIGHUP"), though Perl does
1445               try hard to understand you.
1446
1447               If you use the "SA_SIGINFO" flag, the signal handler will in
1448               addition to the first argument, the signal name, also receive a
1449               second argument, a hash reference, inside which are the
1450               following keys with the following semantics, as defined by
1451               POSIX/SUSv3:
1452
1453                   signo       the signal number
1454                   errno       the error number
1455                   code        if this is zero or less, the signal was sent by
1456                               a user process and the uid and pid make sense,
1457                               otherwise the signal was sent by the kernel
1458
1459               The constants for specific "code" values can be imported
1460               individually or using the ":signal_h_si_code" tag, since Perl
1461               v5.24.
1462
1463               The following are also defined by POSIX/SUSv3, but
1464               unfortunately not very widely implemented:
1465
1466                   pid         the process id generating the signal
1467                   uid         the uid of the process id generating the signal
1468                   status      exit value or signal for SIGCHLD
1469                   band        band event for SIGPOLL
1470                   addr        address of faulting instruction or memory
1471                               reference for SIGILL, SIGFPE, SIGSEGV or SIGBUS
1472
1473               A third argument is also passed to the handler, which contains
1474               a copy of the raw binary contents of the "siginfo" structure:
1475               if a system has some non-POSIX fields, this third argument is
1476               where to unpack() them from.
1477
1478               Note that not all "siginfo" values make sense simultaneously
1479               (some are valid only for certain signals, for example), and not
1480               all values make sense from Perl perspective, you should to
1481               consult your system's "sigaction" and possibly also "siginfo"
1482               documentation.
1483
1484       "siglongjmp"
1485               Not implemented.  siglongjmp() is C-specific: use "die" in
1486               perlfunc instead.
1487
1488       "signbit"
1489               Returns zero for positive arguments, non-zero for negative
1490               arguments [C99].  Added in Perl v5.22.
1491
1492       "sigpending"
1493               Examine signals that are blocked and pending.  This uses
1494               "POSIX::SigSet" objects for the "sigset" argument.  Consult
1495               your system's "sigpending" manpage for details.
1496
1497               Synopsis:
1498
1499                       sigpending(sigset)
1500
1501               Returns "undef" on failure.
1502
1503       "sigprocmask"
1504               Change and/or examine calling process's signal mask.  This uses
1505               "POSIX::SigSet" objects for the "sigset" and "oldsigset"
1506               arguments.  Consult your system's "sigprocmask" manpage for
1507               details.
1508
1509               Synopsis:
1510
1511                       sigprocmask(how, sigset, oldsigset = 0)
1512
1513               Returns "undef" on failure.
1514
1515               Note that you can't reliably block or unblock a signal from its
1516               own signal handler if you're using safe signals. Other signals
1517               can be blocked or unblocked reliably.
1518
1519       "sigsetjmp"
1520               Not implemented.  sigsetjmp() is C-specific: use "eval {}"
1521               instead, see "eval" in perlfunc.
1522
1523       "sigsuspend"
1524               Install a signal mask and suspend process until signal arrives.
1525               This uses "POSIX::SigSet" objects for the "signal_mask"
1526               argument.  Consult your system's "sigsuspend" manpage for
1527               details.
1528
1529               Synopsis:
1530
1531                       sigsuspend(signal_mask)
1532
1533               Returns "undef" on failure.
1534
1535       "sin"   This is identical to Perl's builtin sin() function for
1536               returning the sine of the numerical argument, see "sin" in
1537               perlfunc.  See also Math::Trig.
1538
1539       "sinh"  This is identical to the C function sinh() for returning the
1540               hyperbolic sine of the numerical argument.  See also
1541               Math::Trig.
1542
1543       "sleep" This is functionally identical to Perl's builtin sleep()
1544               function for suspending the execution of the current for
1545               process for certain number of seconds, see "sleep" in perlfunc.
1546               There is one significant difference, however: POSIX::sleep()
1547               returns the number of unslept seconds, while the CORE::sleep()
1548               returns the number of slept seconds.
1549
1550       "sprintf"
1551               This is similar to Perl's builtin sprintf() function for
1552               returning a string that has the arguments formatted as
1553               requested, see "sprintf" in perlfunc.
1554
1555       "sqrt"  This is identical to Perl's builtin sqrt() function.  for
1556               returning the square root of the numerical argument, see "sqrt"
1557               in perlfunc.
1558
1559       "srand" Give a seed the pseudorandom number generator, see "srand" in
1560               perlfunc.
1561
1562       "sscanf"
1563               Not implemented.  sscanf() is C-specific, use regular
1564               expressions instead, see perlre.
1565
1566       "stat"  This is identical to Perl's builtin stat() function for
1567               returning information about files and directories.
1568
1569       "strcat"
1570               Not implemented.  strcat() is C-specific, use ".=" instead, see
1571               perlop.
1572
1573       "strchr"
1574               Not implemented.  strchr() is C-specific, see "index" in
1575               perlfunc instead.
1576
1577       "strcmp"
1578               Not implemented.  strcmp() is C-specific, use "eq" or "cmp"
1579               instead, see perlop.
1580
1581       "strcoll"
1582               This is identical to the C function strcoll() for collating
1583               (comparing) strings transformed using the strxfrm() function.
1584               Not really needed since Perl can do this transparently, see
1585               perllocale.
1586
1587               Beware that in a UTF-8 locale, anything you pass to this
1588               function must be in UTF-8; and when not in a UTF-8 locale,
1589               anything passed must not be UTF-8 encoded.
1590
1591               Note also that it doesn't make sense for a string to be encoded
1592               in one locale (say, ISO-8859-6, Arabic) and to collate it based
1593               on another (like ISO-8859-7, Greek).  The results will be
1594               essentially meaningless.
1595
1596       "strcpy"
1597               Not implemented.  strcpy() is C-specific, use "=" instead, see
1598               perlop.
1599
1600       "strcspn"
1601               Not implemented.  strcspn() is C-specific, use regular
1602               expressions instead, see perlre.
1603
1604       "strerror"
1605               Returns the error string for the specified errno.  Identical to
1606               the string form of $!, see "$ERRNO" in perlvar.
1607
1608       "strftime"
1609               Convert date and time information to string.  Returns the
1610               string.
1611
1612               Synopsis:
1613
1614                       strftime(fmt, sec, min, hour, mday, mon, year,
1615                                wday = -1, yday = -1, isdst = -1)
1616
1617               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
1618               at zero, i.e., January is 0, not 1; Sunday is 0, not 1; January
1619               1st is 0, not 1.  The year ("year") is given in years since
1620               1900, i.e., the year 1995 is 95; the year 2001 is 101.  Consult
1621               your system's strftime() manpage for details about these and
1622               the other arguments.
1623
1624               If you want your code to be portable, your format ("fmt")
1625               argument should use only the conversion specifiers defined by
1626               the ANSI C standard (C99, to play safe).  These are
1627               "aAbBcdHIjmMpSUwWxXyYZ%".  But even then, the results of some
1628               of the conversion specifiers are non-portable.  For example,
1629               the specifiers "aAbBcpZ" change according to the locale
1630               settings of the user, and both how to set locales (the locale
1631               names) and what output to expect are non-standard.  The
1632               specifier "c" changes according to the timezone settings of the
1633               user and the timezone computation rules of the operating
1634               system.  The "Z" specifier is notoriously unportable since the
1635               names of timezones are non-standard. Sticking to the numeric
1636               specifiers is the safest route.
1637
1638               The given arguments are made consistent as though by calling
1639               mktime() before calling your system's strftime() function,
1640               except that the "isdst" value is not affected.
1641
1642               The string for Tuesday, December 12, 1995.
1643
1644                       $str = POSIX::strftime( "%A, %B %d, %Y",
1645                                                0, 0, 0, 12, 11, 95, 2 );
1646                       print "$str\n";
1647
1648       "strlen"
1649               Not implemented.  strlen() is C-specific, use length() instead,
1650               see "length" in perlfunc.
1651
1652       "strncat"
1653               Not implemented.  strncat() is C-specific, use ".=" instead,
1654               see perlop.
1655
1656       "strncmp"
1657               Not implemented.  strncmp() is C-specific, use "eq" instead,
1658               see perlop.
1659
1660       "strncpy"
1661               Not implemented.  strncpy() is C-specific, use "=" instead, see
1662               perlop.
1663
1664       "strpbrk"
1665               Not implemented.  strpbrk() is C-specific, use regular
1666               expressions instead, see perlre.
1667
1668       "strrchr"
1669               Not implemented.  strrchr() is C-specific, see "rindex" in
1670               perlfunc instead.
1671
1672       "strspn"
1673               Not implemented.  strspn() is C-specific, use regular
1674               expressions instead, see perlre.
1675
1676       "strstr"
1677               This is identical to Perl's builtin index() function, see
1678               "index" in perlfunc.
1679
1680       "strtod"
1681               String to double translation. Returns the parsed number and the
1682               number of characters in the unparsed portion of the string.
1683               Truly POSIX-compliant systems set $! ($ERRNO) to indicate a
1684               translation error, so clear $! before calling "strtod".
1685               However, non-POSIX systems may not check for overflow, and
1686               therefore will never set $!.
1687
1688               "strtod" respects any POSIX setlocale() "LC_NUMERIC" settings,
1689               regardless of whether or not it is called from Perl code that
1690               is within the scope of "use locale".  Prior to Perl 5.28, or
1691               when operating in a non thread-safe environment, it should not
1692               be used in a threaded application unless it's certain that the
1693               underlying locale is C or POSIX.  This is because it otherwise
1694               changes the locale, which globally affects all threads
1695               simultaneously.
1696
1697               To parse a string $str as a floating point number use
1698
1699                   $! = 0;
1700                   ($num, $n_unparsed) = POSIX::strtod($str);
1701
1702               The second returned item and $! can be used to check for valid
1703               input:
1704
1705                   if (($str eq '') || ($n_unparsed != 0) || $!) {
1706                       die "Non-numeric input $str" . ($! ? ": $!\n" : "\n");
1707                   }
1708
1709               When called in a scalar context "strtod" returns the parsed
1710               number.
1711
1712       "strtok"
1713               Not implemented.  strtok() is C-specific, use regular
1714               expressions instead, see perlre, or "split" in perlfunc.
1715
1716       "strtol"
1717               String to (long) integer translation.  Returns the parsed
1718               number and the number of characters in the unparsed portion of
1719               the string.  Truly POSIX-compliant systems set $! ($ERRNO) to
1720               indicate a translation error, so clear $! before calling
1721               "strtol".  However, non-POSIX systems may not check for
1722               overflow, and therefore will never set $!.
1723
1724               "strtol" should respect any POSIX setlocale() settings.
1725
1726               To parse a string $str as a number in some base $base use
1727
1728                   $! = 0;
1729                   ($num, $n_unparsed) = POSIX::strtol($str, $base);
1730
1731               The base should be zero or between 2 and 36, inclusive.  When
1732               the base is zero or omitted "strtol" will use the string itself
1733               to determine the base: a leading "0x" or "0X" means
1734               hexadecimal; a leading "0" means octal; any other leading
1735               characters mean decimal.  Thus, "1234" is parsed as a decimal
1736               number, "01234" as an octal number, and "0x1234" as a
1737               hexadecimal number.
1738
1739               The second returned item and $! can be used to check for valid
1740               input:
1741
1742                   if (($str eq '') || ($n_unparsed != 0) || !$!) {
1743                       die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
1744                   }
1745
1746               When called in a scalar context "strtol" returns the parsed
1747               number.
1748
1749       "strtold"
1750               Like "strtod" but for long doubles.  Defined only if the system
1751               supports long doubles.
1752
1753       "strtoul"
1754               String to unsigned (long) integer translation.  strtoul() is
1755               identical to strtol() except that strtoul() only parses
1756               unsigned integers.  See "strtol" for details.
1757
1758               Note: Some vendors supply strtod() and strtol() but not
1759               strtoul().  Other vendors that do supply strtoul() parse "-1"
1760               as a valid value.
1761
1762       "strxfrm"
1763               String transformation.  Returns the transformed string.
1764
1765                       $dst = POSIX::strxfrm( $src );
1766
1767               Used with "eq" or "cmp" as an alternative to "strcoll".
1768
1769               Not really needed since Perl can do this transparently, see
1770               perllocale.
1771
1772               Unlike the libc "strxfrm", this allows NUL characters in the
1773               input $src.
1774
1775               It doesn't make sense for a string to be encoded in one locale
1776               (say, ISO-8859-6, Arabic) and to collate it based on another
1777               (like ISO-8859-7, Greek).  Perl assumes that the current
1778               "LC_CTYPE" locale correctly represents the encoding of $src,
1779               and ignores the value of "LC_COLLATE".
1780
1781       "sysconf"
1782               Retrieves values of system configurable variables.
1783
1784               The following will get the machine's clock speed.
1785
1786                       $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
1787
1788               Returns "undef" on failure.
1789
1790       "system"
1791               This is identical to Perl's builtin system() function, see
1792               "system" in perlfunc.
1793
1794       "tan"   This is identical to the C function tan(), returning the
1795               tangent of the numerical argument.  See also Math::Trig.
1796
1797       "tanh"  This is identical to the C function tanh(), returning the
1798               hyperbolic tangent of the numerical argument.   See also
1799               Math::Trig.
1800
1801       "tcdrain"
1802               This is similar to the C function tcdrain() for draining the
1803               output queue of its argument stream.
1804
1805               Returns "undef" on failure.
1806
1807       "tcflow"
1808               This is similar to the C function tcflow() for controlling the
1809               flow of its argument stream.
1810
1811               Returns "undef" on failure.
1812
1813       "tcflush"
1814               This is similar to the C function tcflush() for flushing the
1815               I/O buffers of its argument stream.
1816
1817               Returns "undef" on failure.
1818
1819       "tcgetpgrp"
1820               This is identical to the C function tcgetpgrp() for returning
1821               the process group identifier of the foreground process group of
1822               the controlling terminal.
1823
1824       "tcsendbreak"
1825               This is similar to the C function tcsendbreak() for sending a
1826               break on its argument stream.
1827
1828               Returns "undef" on failure.
1829
1830       "tcsetpgrp"
1831               This is similar to the C function tcsetpgrp() for setting the
1832               process group identifier of the foreground process group of the
1833               controlling terminal.
1834
1835               Returns "undef" on failure.
1836
1837       "tgamma"
1838               The Gamma function [C99].  Added in Perl v5.22.
1839
1840               See also "lgamma".
1841
1842       "time"  This is identical to Perl's builtin time() function for
1843               returning the number of seconds since the epoch (whatever it is
1844               for the system), see "time" in perlfunc.
1845
1846       "times" The times() function returns elapsed realtime since some point
1847               in the past (such as system startup), user and system times for
1848               this process, and user and system times used by child
1849               processes.  All times are returned in clock ticks.
1850
1851                   ($realtime, $user, $system, $cuser, $csystem)
1852                       = POSIX::times();
1853
1854               Note: Perl's builtin times() function returns four values,
1855               measured in seconds.
1856
1857       "tmpfile"
1858               Not implemented.  Use method IO::File::new_tmpfile() instead,
1859               or see File::Temp.
1860
1861       "tmpnam"
1862               For security reasons, which are probably detailed in your
1863               system's documentation for the C library tmpnam() function,
1864               this interface is no longer available since Perl v5.26; instead
1865               use File::Temp.
1866
1867       "tolower"
1868               This function has been removed as of Perl v5.26.  This is
1869               identical to the C function, except that it can apply to a
1870               single character or to a whole string, and currently operates
1871               as if the locale always is "C".  Consider using the lc()
1872               function, see "lc" in perlfunc, see "lc" in perlfunc, or the
1873               equivalent "\L" operator inside doublequotish strings.
1874
1875       "toupper"
1876               This function has been removed as of Perl v5.26.  This is
1877               similar to the C function, except that it can apply to a single
1878               character or to a whole string, and currently operates as if
1879               the locale always is "C".  Consider using the uc() function,
1880               see "uc" in perlfunc, or the equivalent "\U" operator inside
1881               doublequotish strings.
1882
1883       "trunc" Returns the integer toward zero from the argument [C99].  Added
1884               in Perl v5.22.
1885
1886               See also "ceil", "floor", and "round".
1887
1888       "ttyname"
1889               This is identical to the C function ttyname() for returning the
1890               name of the current terminal.
1891
1892       "tzname"
1893               Retrieves the time conversion information from the "tzname"
1894               variable.
1895
1896                       POSIX::tzset();
1897                       ($std, $dst) = POSIX::tzname();
1898
1899       "tzset" This is identical to the C function tzset() for setting the
1900               current timezone based on the environment variable "TZ", to be
1901               used by ctime(), localtime(), mktime(), and strftime()
1902               functions.
1903
1904       "umask" This is identical to Perl's builtin umask() function for
1905               setting (and querying) the file creation permission mask, see
1906               "umask" in perlfunc.
1907
1908       "uname" Get name of current operating system.
1909
1910                       ($sysname, $nodename, $release, $version, $machine)
1911                               = POSIX::uname();
1912
1913               Note that the actual meanings of the various fields are not
1914               that well standardized, do not expect any great portability.
1915               The $sysname might be the name of the operating system, the
1916               $nodename might be the name of the host, the $release might be
1917               the (major) release number of the operating system, the
1918               $version might be the (minor) release number of the operating
1919               system, and the $machine might be a hardware identifier.
1920               Maybe.
1921
1922       "ungetc"
1923               Not implemented.  Use method IO::Handle::ungetc() instead.
1924
1925       "unlink"
1926               This is identical to Perl's builtin unlink() function for
1927               removing files, see "unlink" in perlfunc.
1928
1929       "utime" This is identical to Perl's builtin utime() function for
1930               changing the time stamps of files and directories, see "utime"
1931               in perlfunc.
1932
1933       "vfprintf"
1934               Not implemented.  vfprintf() is C-specific, see "printf" in
1935               perlfunc instead.
1936
1937       "vprintf"
1938               Not implemented.  vprintf() is C-specific, see "printf" in
1939               perlfunc instead.
1940
1941       "vsprintf"
1942               Not implemented.  vsprintf() is C-specific, see "sprintf" in
1943               perlfunc instead.
1944
1945       "wait"  This is identical to Perl's builtin wait() function, see "wait"
1946               in perlfunc.
1947
1948       "waitpid"
1949               Wait for a child process to change state.  This is identical to
1950               Perl's builtin waitpid() function, see "waitpid" in perlfunc.
1951
1952                       $pid = POSIX::waitpid( -1, POSIX::WNOHANG );
1953                       print "status = ", ($? / 256), "\n";
1954
1955               See "mblen".
1956
1957       "wctomb"
1958               This is the same as the C function wctomb() on unthreaded
1959               perls.  On threaded perls, it transparently (almost)
1960               substitutes the more thread-safe "wcrtomb"(3), if available,
1961               instead of "wctomb".
1962
1963               Core Perl does not have any support for wide and multibyte
1964               locales, except Unicode UTF-8 locales.  This function, in
1965               conjunction with "mblen" and "mbtowc" may be used to roll your
1966               own decoding/encoding of other types of multi-byte locales.
1967
1968               Use "undef" as the first parameter to this function to get the
1969               effect of passing NULL as the first parameter to "wctomb".
1970               This ignores the second parameter, and resets any shift state
1971               to its initial value.  The return value is undefined if
1972               "wcrtomb" was substituted, so you should never rely on it.
1973
1974               When the first parameter is a scalar, the code point contained
1975               in the scalar second parameter is converted into a multi-byte
1976               string and stored into the first parameter scalar.  This is
1977               based on the locale that currently underlies the program,
1978               regardless of whether or not the function is called from Perl
1979               code that is within the scope of "use locale".  The return
1980               value is the number of bytes stored; or negative if the code
1981               point isn't representable in the current locale.  Perl makes no
1982               attempt at hiding from your code any differences in the "errno"
1983               setting between "wctomb" and "wcrtomb".  It does set "errno" to
1984               0 before calling them.
1985
1986       "write" Write to a file.  This uses file descriptors such as those
1987               obtained by calling "POSIX::open".
1988
1989                       $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
1990                       $buf = "hello";
1991                       $bytes = POSIX::write( $fd, $buf, 5 );
1992
1993               Returns "undef" on failure.
1994
1995               See also "syswrite" in perlfunc.
1996

CLASSES

1998   "POSIX::SigAction"
1999       "new"   Creates a new "POSIX::SigAction" object which corresponds to
2000               the C "struct sigaction".  This object will be destroyed
2001               automatically when it is no longer needed.  The first parameter
2002               is the handler, a sub reference.  The second parameter is a
2003               "POSIX::SigSet" object, it defaults to the empty set.  The
2004               third parameter contains the "sa_flags", it defaults to 0.
2005
2006                       $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
2007                       $sigaction = POSIX::SigAction->new(
2008                                       \&handler, $sigset, &POSIX::SA_NOCLDSTOP
2009                                    );
2010
2011               This "POSIX::SigAction" object is intended for use with the
2012               POSIX::sigaction() function.
2013
2014       "handler"
2015       "mask"
2016       "flags" accessor functions to get/set the values of a SigAction object.
2017
2018                       $sigset = $sigaction->mask;
2019                       $sigaction->flags(&POSIX::SA_RESTART);
2020
2021       "safe"  accessor function for the "safe signals" flag of a SigAction
2022               object; see perlipc for general information on safe (a.k.a.
2023               "deferred") signals.  If you wish to handle a signal safely,
2024               use this accessor to set the "safe" flag in the
2025               "POSIX::SigAction" object:
2026
2027                       $sigaction->safe(1);
2028
2029               You may also examine the "safe" flag on the output action
2030               object which is filled in when given as the third parameter to
2031               POSIX::sigaction():
2032
2033                       sigaction(SIGINT, $new_action, $old_action);
2034                       if ($old_action->safe) {
2035                           # previous SIGINT handler used safe signals
2036                       }
2037
2038   "POSIX::SigRt"
2039       %SIGRT  A hash of the POSIX realtime signal handlers.  It is an
2040               extension of the standard %SIG, the $POSIX::SIGRT{SIGRTMIN} is
2041               roughly equivalent to $SIG{SIGRTMIN}, but the right POSIX moves
2042               (see below) are made with the "POSIX::SigSet" and
2043               "POSIX::sigaction" instead of accessing the %SIG.
2044
2045               You can set the %POSIX::SIGRT elements to set the POSIX
2046               realtime signal handlers, use "delete" and "exists" on the
2047               elements, and use "scalar" on the %POSIX::SIGRT to find out how
2048               many POSIX realtime signals there are available
2049               "(SIGRTMAX - SIGRTMIN + 1", the "SIGRTMAX" is a valid POSIX
2050               realtime signal).
2051
2052               Setting the %SIGRT elements is equivalent to calling this:
2053
2054                 sub new {
2055                   my ($rtsig, $handler, $flags) = @_;
2056                   my $sigset = POSIX::SigSet($rtsig);
2057                   my $sigact = POSIX::SigAction->new($handler,$sigset,$flags);
2058                   sigaction($rtsig, $sigact);
2059                 }
2060
2061               The flags default to zero, if you want something different you
2062               can either use "local" on $POSIX::SigRt::SIGACTION_FLAGS, or
2063               you can derive from POSIX::SigRt and define your own new() (the
2064               tied hash STORE method of the %SIGRT calls "new($rtsig,
2065               $handler, $SIGACTION_FLAGS)", where the $rtsig ranges from zero
2066               to "SIGRTMAX - SIGRTMIN + 1)".
2067
2068               Just as with any signal, you can use "sigaction($rtsig, undef,
2069               $oa)" to retrieve the installed signal handler (or, rather, the
2070               signal action).
2071
2072               NOTE: whether POSIX realtime signals really work in your
2073               system, or whether Perl has been compiled so that it works with
2074               them, is outside of this discussion.
2075
2076       "SIGRTMIN"
2077               Return the minimum POSIX realtime signal number available, or
2078               "undef" if no POSIX realtime signals are available.
2079
2080       "SIGRTMAX"
2081               Return the maximum POSIX realtime signal number available, or
2082               "undef" if no POSIX realtime signals are available.
2083
2084   "POSIX::SigSet"
2085       "new"   Create a new SigSet object.  This object will be destroyed
2086               automatically when it is no longer needed.  Arguments may be
2087               supplied to initialize the set.
2088
2089               Create an empty set.
2090
2091                       $sigset = POSIX::SigSet->new;
2092
2093               Create a set with "SIGUSR1".
2094
2095                       $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
2096
2097               Throws an error if any of the signals supplied cannot be added
2098               to the set.
2099
2100       "addset"
2101               Add a signal to a SigSet object.
2102
2103                       $sigset->addset( &POSIX::SIGUSR2 );
2104
2105               Returns "undef" on failure.
2106
2107       "delset"
2108               Remove a signal from the SigSet object.
2109
2110                       $sigset->delset( &POSIX::SIGUSR2 );
2111
2112               Returns "undef" on failure.
2113
2114       "emptyset"
2115               Initialize the SigSet object to be empty.
2116
2117                       $sigset->emptyset();
2118
2119               Returns "undef" on failure.
2120
2121       "fillset"
2122               Initialize the SigSet object to include all signals.
2123
2124                       $sigset->fillset();
2125
2126               Returns "undef" on failure.
2127
2128       "ismember"
2129               Tests the SigSet object to see if it contains a specific
2130               signal.
2131
2132                       if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
2133                               print "contains SIGUSR1\n";
2134                       }
2135
2136   "POSIX::Termios"
2137       "new"   Create a new Termios object.  This object will be destroyed
2138               automatically when it is no longer needed.  A Termios object
2139               corresponds to the "termios" C struct.  new() mallocs a new
2140               one, getattr() fills it from a file descriptor, and setattr()
2141               sets a file descriptor's parameters to match Termios' contents.
2142
2143                       $termios = POSIX::Termios->new;
2144
2145       "getattr"
2146               Get terminal control attributes.
2147
2148               Obtain the attributes for "stdin".
2149
2150                       $termios->getattr( 0 ) # Recommended for clarity.
2151                       $termios->getattr()
2152
2153               Obtain the attributes for stdout.
2154
2155                       $termios->getattr( 1 )
2156
2157               Returns "undef" on failure.
2158
2159       "getcc" Retrieve a value from the "c_cc" field of a "termios" object.
2160               The "c_cc" field is an array so an index must be specified.
2161
2162                       $c_cc[1] = $termios->getcc(1);
2163
2164       "getcflag"
2165               Retrieve the "c_cflag" field of a "termios" object.
2166
2167                       $c_cflag = $termios->getcflag;
2168
2169       "getiflag"
2170               Retrieve the "c_iflag" field of a "termios" object.
2171
2172                       $c_iflag = $termios->getiflag;
2173
2174       "getispeed"
2175               Retrieve the input baud rate.
2176
2177                       $ispeed = $termios->getispeed;
2178
2179       "getlflag"
2180               Retrieve the "c_lflag" field of a "termios" object.
2181
2182                       $c_lflag = $termios->getlflag;
2183
2184       "getoflag"
2185               Retrieve the "c_oflag" field of a "termios" object.
2186
2187                       $c_oflag = $termios->getoflag;
2188
2189       "getospeed"
2190               Retrieve the output baud rate.
2191
2192                       $ospeed = $termios->getospeed;
2193
2194       "setattr"
2195               Set terminal control attributes.
2196
2197               Set attributes immediately for stdout.
2198
2199                       $termios->setattr( 1, &POSIX::TCSANOW );
2200
2201               Returns "undef" on failure.
2202
2203       "setcc" Set a value in the "c_cc" field of a "termios" object.  The
2204               "c_cc" field is an array so an index must be specified.
2205
2206                       $termios->setcc( &POSIX::VEOF, 1 );
2207
2208       "setcflag"
2209               Set the "c_cflag" field of a "termios" object.
2210
2211                       $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
2212
2213       "setiflag"
2214               Set the "c_iflag" field of a "termios" object.
2215
2216                       $termios->setiflag( $c_iflag | &POSIX::BRKINT );
2217
2218       "setispeed"
2219               Set the input baud rate.
2220
2221                       $termios->setispeed( &POSIX::B9600 );
2222
2223               Returns "undef" on failure.
2224
2225       "setlflag"
2226               Set the "c_lflag" field of a "termios" object.
2227
2228                       $termios->setlflag( $c_lflag | &POSIX::ECHO );
2229
2230       "setoflag"
2231               Set the "c_oflag" field of a "termios" object.
2232
2233                       $termios->setoflag( $c_oflag | &POSIX::OPOST );
2234
2235       "setospeed"
2236               Set the output baud rate.
2237
2238                       $termios->setospeed( &POSIX::B9600 );
2239
2240               Returns "undef" on failure.
2241
2242       Baud rate values
2243               "B38400" "B75" "B200" "B134" "B300" "B1800" "B150" "B0"
2244               "B19200" "B1200" "B9600" "B600" "B4800" "B50" "B2400" "B110"
2245
2246       Terminal interface values
2247               "TCSADRAIN" "TCSANOW" "TCOON" "TCIOFLUSH" "TCOFLUSH" "TCION"
2248               "TCIFLUSH" "TCSAFLUSH" "TCIOFF" "TCOOFF"
2249
2250       "c_cc" field values
2251               "VEOF" "VEOL" "VERASE" "VINTR" "VKILL" "VQUIT" "VSUSP" "VSTART"
2252               "VSTOP" "VMIN" "VTIME" "NCCS"
2253
2254       "c_cflag" field values
2255               "CLOCAL" "CREAD" "CSIZE" "CS5" "CS6" "CS7" "CS8" "CSTOPB"
2256               "HUPCL" "PARENB" "PARODD"
2257
2258       "c_iflag" field values
2259               "BRKINT" "ICRNL" "IGNBRK" "IGNCR" "IGNPAR" "INLCR" "INPCK"
2260               "ISTRIP" "IXOFF" "IXON" "PARMRK"
2261
2262       "c_lflag" field values
2263               "ECHO" "ECHOE" "ECHOK" "ECHONL" "ICANON" "IEXTEN" "ISIG"
2264               "NOFLSH" "TOSTOP"
2265
2266       "c_oflag" field values
2267               "OPOST"
2268

PATHNAME CONSTANTS

2270       Constants
2271               "_PC_CHOWN_RESTRICTED" "_PC_LINK_MAX" "_PC_MAX_CANON"
2272               "_PC_MAX_INPUT" "_PC_NAME_MAX" "_PC_NO_TRUNC" "_PC_PATH_MAX"
2273               "_PC_PIPE_BUF" "_PC_VDISABLE"
2274

POSIX CONSTANTS

2276       Constants
2277               "_POSIX_ARG_MAX" "_POSIX_CHILD_MAX" "_POSIX_CHOWN_RESTRICTED"
2278               "_POSIX_JOB_CONTROL" "_POSIX_LINK_MAX" "_POSIX_MAX_CANON"
2279               "_POSIX_MAX_INPUT" "_POSIX_NAME_MAX" "_POSIX_NGROUPS_MAX"
2280               "_POSIX_NO_TRUNC" "_POSIX_OPEN_MAX" "_POSIX_PATH_MAX"
2281               "_POSIX_PIPE_BUF" "_POSIX_SAVED_IDS" "_POSIX_SSIZE_MAX"
2282               "_POSIX_STREAM_MAX" "_POSIX_TZNAME_MAX" "_POSIX_VDISABLE"
2283               "_POSIX_VERSION"
2284

RESOURCE CONSTANTS

2286       Imported with the ":sys_resource_h" tag.
2287
2288       Constants
2289               Added in Perl v5.28:
2290
2291               "PRIO_PROCESS" "PRIO_PGRP" "PRIO_USER"
2292

SYSTEM CONFIGURATION

2294       Constants
2295               "_SC_ARG_MAX" "_SC_CHILD_MAX" "_SC_CLK_TCK" "_SC_JOB_CONTROL"
2296               "_SC_NGROUPS_MAX" "_SC_OPEN_MAX" "_SC_PAGESIZE" "_SC_SAVED_IDS"
2297               "_SC_STREAM_MAX" "_SC_TZNAME_MAX" "_SC_VERSION"
2298

ERRNO

2300       Constants
2301               "E2BIG" "EACCES" "EADDRINUSE" "EADDRNOTAVAIL" "EAFNOSUPPORT"
2302               "EAGAIN" "EALREADY" "EBADF" "EBADMSG" "EBUSY" "ECANCELED"
2303               "ECHILD" "ECONNABORTED" "ECONNREFUSED" "ECONNRESET" "EDEADLK"
2304               "EDESTADDRREQ" "EDOM" "EDQUOT" "EEXIST" "EFAULT" "EFBIG"
2305               "EHOSTDOWN" "EHOSTUNREACH" "EIDRM" "EILSEQ" "EINPROGRESS"
2306               "EINTR" "EINVAL" "EIO" "EISCONN" "EISDIR" "ELOOP" "EMFILE"
2307               "EMLINK" "EMSGSIZE" "ENAMETOOLONG" "ENETDOWN" "ENETRESET"
2308               "ENETUNREACH" "ENFILE" "ENOBUFS" "ENODATA" "ENODEV" "ENOENT"
2309               "ENOEXEC" "ENOLCK" "ENOLINK" "ENOMEM" "ENOMSG" "ENOPROTOOPT"
2310               "ENOSPC" "ENOSR" "ENOSTR" "ENOSYS" "ENOTBLK" "ENOTCONN"
2311               "ENOTDIR" "ENOTEMPTY" "ENOTRECOVERABLE" "ENOTSOCK" "ENOTSUP"
2312               "ENOTTY" "ENXIO" "EOPNOTSUPP" "EOTHER" "EOVERFLOW" "EOWNERDEAD"
2313               "EPERM" "EPFNOSUPPORT" "EPIPE" "EPROCLIM" "EPROTO"
2314               "EPROTONOSUPPORT" "EPROTOTYPE" "ERANGE" "EREMOTE" "ERESTART"
2315               "EROFS" "ESHUTDOWN" "ESOCKTNOSUPPORT" "ESPIPE" "ESRCH" "ESTALE"
2316               "ETIME" "ETIMEDOUT" "ETOOMANYREFS" "ETXTBSY" "EUSERS"
2317               "EWOULDBLOCK" "EXDEV"
2318

FCNTL

2320       Constants
2321               "FD_CLOEXEC" "F_DUPFD" "F_GETFD" "F_GETFL" "F_GETLK" "F_OK"
2322               "F_RDLCK" "F_SETFD" "F_SETFL" "F_SETLK" "F_SETLKW" "F_UNLCK"
2323               "F_WRLCK" "O_ACCMODE" "O_APPEND" "O_CREAT" "O_EXCL" "O_NOCTTY"
2324               "O_NONBLOCK" "O_RDONLY" "O_RDWR" "O_TRUNC" "O_WRONLY"
2325

FLOAT

2327       Constants
2328               "DBL_DIG" "DBL_EPSILON" "DBL_MANT_DIG" "DBL_MAX"
2329               "DBL_MAX_10_EXP" "DBL_MAX_EXP" "DBL_MIN" "DBL_MIN_10_EXP"
2330               "DBL_MIN_EXP" "FLT_DIG" "FLT_EPSILON" "FLT_MANT_DIG" "FLT_MAX"
2331               "FLT_MAX_10_EXP" "FLT_MAX_EXP" "FLT_MIN" "FLT_MIN_10_EXP"
2332               "FLT_MIN_EXP" "FLT_RADIX" "FLT_ROUNDS" "LDBL_DIG"
2333               "LDBL_EPSILON" "LDBL_MANT_DIG" "LDBL_MAX" "LDBL_MAX_10_EXP"
2334               "LDBL_MAX_EXP" "LDBL_MIN" "LDBL_MIN_10_EXP" "LDBL_MIN_EXP"
2335

FLOATING-POINT ENVIRONMENT

2337       Constants
2338               "FE_DOWNWARD" "FE_TONEAREST" "FE_TOWARDZERO" "FE_UPWARD" on
2339               systems that support them.
2340

LIMITS

2342       Constants
2343               "ARG_MAX" "CHAR_BIT" "CHAR_MAX" "CHAR_MIN" "CHILD_MAX"
2344               "INT_MAX" "INT_MIN" "LINK_MAX" "LONG_MAX" "LONG_MIN"
2345               "MAX_CANON" "MAX_INPUT" "MB_LEN_MAX" "NAME_MAX" "NGROUPS_MAX"
2346               "OPEN_MAX" "PATH_MAX" "PIPE_BUF" "SCHAR_MAX" "SCHAR_MIN"
2347               "SHRT_MAX" "SHRT_MIN" "SSIZE_MAX" "STREAM_MAX" "TZNAME_MAX"
2348               "UCHAR_MAX" "UINT_MAX" "ULONG_MAX" "USHRT_MAX"
2349

LOCALE

2351       Constants
2352               "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MONETARY" "LC_NUMERIC"
2353               "LC_TIME" "LC_MESSAGES" on systems that support them.
2354

MATH

2356       Constants
2357               "HUGE_VAL"
2358
2359               Added in Perl v5.22:
2360
2361               "FP_ILOGB0" "FP_ILOGBNAN" "FP_INFINITE" "FP_NAN" "FP_NORMAL"
2362               "FP_SUBNORMAL" "FP_ZERO" "INFINITY" "NAN" "Inf" "NaN" "M_1_PI"
2363               "M_2_PI" "M_2_SQRTPI" "M_E" "M_LN10" "M_LN2" "M_LOG10E"
2364               "M_LOG2E" "M_PI" "M_PI_2" "M_PI_4" "M_SQRT1_2" "M_SQRT2" on
2365               systems with C99 support.
2366

SIGNAL

2368       Constants
2369               "SA_NOCLDSTOP" "SA_NOCLDWAIT" "SA_NODEFER" "SA_ONSTACK"
2370               "SA_RESETHAND" "SA_RESTART" "SA_SIGINFO" "SIGABRT" "SIGALRM"
2371               "SIGCHLD" "SIGCONT" "SIGFPE" "SIGHUP" "SIGILL" "SIGINT"
2372               "SIGKILL" "SIGPIPE" "SIGQUIT" "SIGSEGV" "SIGSTOP" "SIGTERM"
2373               "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGUSR1" "SIGUSR2" "SIG_BLOCK"
2374               "SIG_DFL" "SIG_ERR" "SIG_IGN" "SIG_SETMASK" "SIG_UNBLOCK"
2375
2376               Added in Perl v5.24:
2377
2378               "ILL_ILLOPC" "ILL_ILLOPN" "ILL_ILLADR" "ILL_ILLTRP"
2379               "ILL_PRVOPC" "ILL_PRVREG" "ILL_COPROC" "ILL_BADSTK"
2380               "FPE_INTDIV" "FPE_INTOVF" "FPE_FLTDIV" "FPE_FLTOVF"
2381               "FPE_FLTUND" "FPE_FLTRES" "FPE_FLTINV" "FPE_FLTSUB"
2382               "SEGV_MAPERR" "SEGV_ACCERR" "BUS_ADRALN" "BUS_ADRERR"
2383               "BUS_OBJERR" "TRAP_BRKPT" "TRAP_TRACE" "CLD_EXITED"
2384               "CLD_KILLED" "CLD_DUMPED" "CLD_TRAPPED" "CLD_STOPPED"
2385               "CLD_CONTINUED" "POLL_IN" "POLL_OUT" "POLL_MSG" "POLL_ERR"
2386               "POLL_PRI" "POLL_HUP" "SI_USER" "SI_QUEUE" "SI_TIMER"
2387               "SI_ASYNCIO" "SI_MESGQ"
2388

STAT

2390       Constants
2391               "S_IRGRP" "S_IROTH" "S_IRUSR" "S_IRWXG" "S_IRWXO" "S_IRWXU"
2392               "S_ISGID" "S_ISUID" "S_IWGRP" "S_IWOTH" "S_IWUSR" "S_IXGRP"
2393               "S_IXOTH" "S_IXUSR"
2394
2395       Macros  "S_ISBLK" "S_ISCHR" "S_ISDIR" "S_ISFIFO" "S_ISLNK" "S_ISREG"
2396               "S_ISSOCK"
2397

STDLIB

2399       Constants
2400               "EXIT_FAILURE" "EXIT_SUCCESS" "MB_CUR_MAX" "RAND_MAX"
2401

STDIO

2403       Constants
2404               "BUFSIZ" "EOF" "FILENAME_MAX" "L_ctermid" "L_cuserid" "TMP_MAX"
2405

TIME

2407       Constants
2408               "CLK_TCK" "CLOCKS_PER_SEC"
2409

UNISTD

2411       Constants
2412               "R_OK" "SEEK_CUR" "SEEK_END" "SEEK_SET" "STDIN_FILENO"
2413               "STDOUT_FILENO" "STDERR_FILENO" "W_OK" "X_OK"
2414

WAIT

2416       Constants
2417               "WNOHANG" "WUNTRACED"
2418
2419               "WNOHANG"       Do not suspend the calling process until a
2420                               child process changes state but instead return
2421                               immediately.
2422
2423               "WUNTRACED"     Catch stopped child processes.
2424
2425       Macros  "WIFEXITED" "WEXITSTATUS" "WIFSIGNALED" "WTERMSIG" "WIFSTOPPED"
2426               "WSTOPSIG"
2427
2428               "WIFEXITED"     WIFEXITED(${^CHILD_ERROR_NATIVE}) returns true
2429                               if the child process exited normally (exit() or
2430                               by falling off the end of main())
2431
2432               "WEXITSTATUS"   WEXITSTATUS(${^CHILD_ERROR_NATIVE}) returns the
2433                               normal exit status of the child process (only
2434                               meaningful if WIFEXITED(${^CHILD_ERROR_NATIVE})
2435                               is true)
2436
2437               "WIFSIGNALED"   WIFSIGNALED(${^CHILD_ERROR_NATIVE}) returns
2438                               true if the child process terminated because of
2439                               a signal
2440
2441               "WTERMSIG"      WTERMSIG(${^CHILD_ERROR_NATIVE}) returns the
2442                               signal the child process terminated for (only
2443                               meaningful if
2444                               WIFSIGNALED(${^CHILD_ERROR_NATIVE}) is true)
2445
2446               "WIFSTOPPED"    WIFSTOPPED(${^CHILD_ERROR_NATIVE}) returns true
2447                               if the child process is currently stopped (can
2448                               happen only if you specified the WUNTRACED flag
2449                               to waitpid())
2450
2451               "WSTOPSIG"      WSTOPSIG(${^CHILD_ERROR_NATIVE}) returns the
2452                               signal the child process was stopped for (only
2453                               meaningful if
2454                               WIFSTOPPED(${^CHILD_ERROR_NATIVE}) is true)
2455

WINSOCK

2457       (Windows only.)
2458
2459       Constants
2460               Added in Perl v5.24:
2461
2462               "WSAEINTR" "WSAEBADF" "WSAEACCES" "WSAEFAULT" "WSAEINVAL"
2463               "WSAEMFILE" "WSAEWOULDBLOCK" "WSAEINPROGRESS" "WSAEALREADY"
2464               "WSAENOTSOCK" "WSAEDESTADDRREQ" "WSAEMSGSIZE" "WSAEPROTOTYPE"
2465               "WSAENOPROTOOPT" "WSAEPROTONOSUPPORT" "WSAESOCKTNOSUPPORT"
2466               "WSAEOPNOTSUPP" "WSAEPFNOSUPPORT" "WSAEAFNOSUPPORT"
2467               "WSAEADDRINUSE" "WSAEADDRNOTAVAIL" "WSAENETDOWN"
2468               "WSAENETUNREACH" "WSAENETRESET" "WSAECONNABORTED"
2469               "WSAECONNRESET" "WSAENOBUFS" "WSAEISCONN" "WSAENOTCONN"
2470               "WSAESHUTDOWN" "WSAETOOMANYREFS" "WSAETIMEDOUT"
2471               "WSAECONNREFUSED" "WSAELOOP" "WSAENAMETOOLONG" "WSAEHOSTDOWN"
2472               "WSAEHOSTUNREACH" "WSAENOTEMPTY" "WSAEPROCLIM" "WSAEUSERS"
2473               "WSAEDQUOT" "WSAESTALE" "WSAEREMOTE" "WSAEDISCON" "WSAENOMORE"
2474               "WSAECANCELLED" "WSAEINVALIDPROCTABLE" "WSAEINVALIDPROVIDER"
2475               "WSAEPROVIDERFAILEDINIT" "WSAEREFUSED"
2476
2477
2478
2479perl v5.38.2                      2023-11-30                        POSIX(3pm)
Impressum