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

NAME

6       POSIX - Perl interface to IEEE Std 1003.1
7

SYNOPSIS

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

DESCRIPTION

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

CLASSES

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

PATHNAME CONSTANTS

2256       Constants
2257               "_PC_CHOWN_RESTRICTED" "_PC_LINK_MAX" "_PC_MAX_CANON"
2258               "_PC_MAX_INPUT" "_PC_NAME_MAX" "_PC_NO_TRUNC" "_PC_PATH_MAX"
2259               "_PC_PIPE_BUF" "_PC_VDISABLE"
2260

POSIX CONSTANTS

2262       Constants
2263               "_POSIX_ARG_MAX" "_POSIX_CHILD_MAX" "_POSIX_CHOWN_RESTRICTED"
2264               "_POSIX_JOB_CONTROL" "_POSIX_LINK_MAX" "_POSIX_MAX_CANON"
2265               "_POSIX_MAX_INPUT" "_POSIX_NAME_MAX" "_POSIX_NGROUPS_MAX"
2266               "_POSIX_NO_TRUNC" "_POSIX_OPEN_MAX" "_POSIX_PATH_MAX"
2267               "_POSIX_PIPE_BUF" "_POSIX_SAVED_IDS" "_POSIX_SSIZE_MAX"
2268               "_POSIX_STREAM_MAX" "_POSIX_TZNAME_MAX" "_POSIX_VDISABLE"
2269               "_POSIX_VERSION"
2270

RESOURCE CONSTANTS

2272       Imported with the ":sys_resource_h" tag.
2273
2274       Constants
2275               Added in Perl v5.28:
2276
2277               "PRIO_PROCESS" "PRIO_PGRP" "PRIO_USER"
2278

SYSTEM CONFIGURATION

2280       Constants
2281               "_SC_ARG_MAX" "_SC_CHILD_MAX" "_SC_CLK_TCK" "_SC_JOB_CONTROL"
2282               "_SC_NGROUPS_MAX" "_SC_OPEN_MAX" "_SC_PAGESIZE" "_SC_SAVED_IDS"
2283               "_SC_STREAM_MAX" "_SC_TZNAME_MAX" "_SC_VERSION"
2284

ERRNO

2286       Constants
2287               "E2BIG" "EACCES" "EADDRINUSE" "EADDRNOTAVAIL" "EAFNOSUPPORT"
2288               "EAGAIN" "EALREADY" "EBADF" "EBADMSG" "EBUSY" "ECANCELED"
2289               "ECHILD" "ECONNABORTED" "ECONNREFUSED" "ECONNRESET" "EDEADLK"
2290               "EDESTADDRREQ" "EDOM" "EDQUOT" "EEXIST" "EFAULT" "EFBIG"
2291               "EHOSTDOWN" "EHOSTUNREACH" "EIDRM" "EILSEQ" "EINPROGRESS"
2292               "EINTR" "EINVAL" "EIO" "EISCONN" "EISDIR" "ELOOP" "EMFILE"
2293               "EMLINK" "EMSGSIZE" "ENAMETOOLONG" "ENETDOWN" "ENETRESET"
2294               "ENETUNREACH" "ENFILE" "ENOBUFS" "ENODATA" "ENODEV" "ENOENT"
2295               "ENOEXEC" "ENOLCK" "ENOLINK" "ENOMEM" "ENOMSG" "ENOPROTOOPT"
2296               "ENOSPC" "ENOSR" "ENOSTR" "ENOSYS" "ENOTBLK" "ENOTCONN"
2297               "ENOTDIR" "ENOTEMPTY" "ENOTRECOVERABLE" "ENOTSOCK" "ENOTSUP"
2298               "ENOTTY" "ENXIO" "EOPNOTSUPP" "EOTHER" "EOVERFLOW" "EOWNERDEAD"
2299               "EPERM" "EPFNOSUPPORT" "EPIPE" "EPROCLIM" "EPROTO"
2300               "EPROTONOSUPPORT" "EPROTOTYPE" "ERANGE" "EREMOTE" "ERESTART"
2301               "EROFS" "ESHUTDOWN" "ESOCKTNOSUPPORT" "ESPIPE" "ESRCH" "ESTALE"
2302               "ETIME" "ETIMEDOUT" "ETOOMANYREFS" "ETXTBSY" "EUSERS"
2303               "EWOULDBLOCK" "EXDEV"
2304

FCNTL

2306       Constants
2307               "FD_CLOEXEC" "F_DUPFD" "F_GETFD" "F_GETFL" "F_GETLK" "F_OK"
2308               "F_RDLCK" "F_SETFD" "F_SETFL" "F_SETLK" "F_SETLKW" "F_UNLCK"
2309               "F_WRLCK" "O_ACCMODE" "O_APPEND" "O_CREAT" "O_EXCL" "O_NOCTTY"
2310               "O_NONBLOCK" "O_RDONLY" "O_RDWR" "O_TRUNC" "O_WRONLY"
2311

FLOAT

2313       Constants
2314               "DBL_DIG" "DBL_EPSILON" "DBL_MANT_DIG" "DBL_MAX"
2315               "DBL_MAX_10_EXP" "DBL_MAX_EXP" "DBL_MIN" "DBL_MIN_10_EXP"
2316               "DBL_MIN_EXP" "FLT_DIG" "FLT_EPSILON" "FLT_MANT_DIG" "FLT_MAX"
2317               "FLT_MAX_10_EXP" "FLT_MAX_EXP" "FLT_MIN" "FLT_MIN_10_EXP"
2318               "FLT_MIN_EXP" "FLT_RADIX" "FLT_ROUNDS" "LDBL_DIG"
2319               "LDBL_EPSILON" "LDBL_MANT_DIG" "LDBL_MAX" "LDBL_MAX_10_EXP"
2320               "LDBL_MAX_EXP" "LDBL_MIN" "LDBL_MIN_10_EXP" "LDBL_MIN_EXP"
2321

FLOATING-POINT ENVIRONMENT

2323       Constants
2324               "FE_DOWNWARD" "FE_TONEAREST" "FE_TOWARDZERO" "FE_UPWARD" on
2325               systems that support them.
2326

LIMITS

2328       Constants
2329               "ARG_MAX" "CHAR_BIT" "CHAR_MAX" "CHAR_MIN" "CHILD_MAX"
2330               "INT_MAX" "INT_MIN" "LINK_MAX" "LONG_MAX" "LONG_MIN"
2331               "MAX_CANON" "MAX_INPUT" "MB_LEN_MAX" "NAME_MAX" "NGROUPS_MAX"
2332               "OPEN_MAX" "PATH_MAX" "PIPE_BUF" "SCHAR_MAX" "SCHAR_MIN"
2333               "SHRT_MAX" "SHRT_MIN" "SSIZE_MAX" "STREAM_MAX" "TZNAME_MAX"
2334               "UCHAR_MAX" "UINT_MAX" "ULONG_MAX" "USHRT_MAX"
2335

LOCALE

2337       Constants
2338               "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MONETARY" "LC_NUMERIC"
2339               "LC_TIME" "LC_MESSAGES" on systems that support them.
2340

MATH

2342       Constants
2343               "HUGE_VAL"
2344
2345               Added in Perl v5.22:
2346
2347               "FP_ILOGB0" "FP_ILOGBNAN" "FP_INFINITE" "FP_NAN" "FP_NORMAL"
2348               "FP_SUBNORMAL" "FP_ZERO" "INFINITY" "NAN" "Inf" "NaN" "M_1_PI"
2349               "M_2_PI" "M_2_SQRTPI" "M_E" "M_LN10" "M_LN2" "M_LOG10E"
2350               "M_LOG2E" "M_PI" "M_PI_2" "M_PI_4" "M_SQRT1_2" "M_SQRT2" on
2351               systems with C99 support.
2352

SIGNAL

2354       Constants
2355               "SA_NOCLDSTOP" "SA_NOCLDWAIT" "SA_NODEFER" "SA_ONSTACK"
2356               "SA_RESETHAND" "SA_RESTART" "SA_SIGINFO" "SIGABRT" "SIGALRM"
2357               "SIGCHLD" "SIGCONT" "SIGFPE" "SIGHUP" "SIGILL" "SIGINT"
2358               "SIGKILL" "SIGPIPE" "SIGQUIT" "SIGSEGV" "SIGSTOP" "SIGTERM"
2359               "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGUSR1" "SIGUSR2" "SIG_BLOCK"
2360               "SIG_DFL" "SIG_ERR" "SIG_IGN" "SIG_SETMASK" "SIG_UNBLOCK"
2361
2362               Added in Perl v5.24:
2363
2364               "ILL_ILLOPC" "ILL_ILLOPN" "ILL_ILLADR" "ILL_ILLTRP"
2365               "ILL_PRVOPC" "ILL_PRVREG" "ILL_COPROC" "ILL_BADSTK"
2366               "FPE_INTDIV" "FPE_INTOVF" "FPE_FLTDIV" "FPE_FLTOVF"
2367               "FPE_FLTUND" "FPE_FLTRES" "FPE_FLTINV" "FPE_FLTSUB"
2368               "SEGV_MAPERR" "SEGV_ACCERR" "BUS_ADRALN" "BUS_ADRERR"
2369               "BUS_OBJERR" "TRAP_BRKPT" "TRAP_TRACE" "CLD_EXITED"
2370               "CLD_KILLED" "CLD_DUMPED" "CLD_TRAPPED" "CLD_STOPPED"
2371               "CLD_CONTINUED" "POLL_IN" "POLL_OUT" "POLL_MSG" "POLL_ERR"
2372               "POLL_PRI" "POLL_HUP" "SI_USER" "SI_QUEUE" "SI_TIMER"
2373               "SI_ASYNCIO" "SI_MESGQ"
2374

STAT

2376       Constants
2377               "S_IRGRP" "S_IROTH" "S_IRUSR" "S_IRWXG" "S_IRWXO" "S_IRWXU"
2378               "S_ISGID" "S_ISUID" "S_IWGRP" "S_IWOTH" "S_IWUSR" "S_IXGRP"
2379               "S_IXOTH" "S_IXUSR"
2380
2381       Macros  "S_ISBLK" "S_ISCHR" "S_ISDIR" "S_ISFIFO" "S_ISREG"
2382

STDLIB

2384       Constants
2385               "EXIT_FAILURE" "EXIT_SUCCESS" "MB_CUR_MAX" "RAND_MAX"
2386

STDIO

2388       Constants
2389               "BUFSIZ" "EOF" "FILENAME_MAX" "L_ctermid" "L_cuserid" "TMP_MAX"
2390

TIME

2392       Constants
2393               "CLK_TCK" "CLOCKS_PER_SEC"
2394

UNISTD

2396       Constants
2397               "R_OK" "SEEK_CUR" "SEEK_END" "SEEK_SET" "STDIN_FILENO"
2398               "STDOUT_FILENO" "STDERR_FILENO" "W_OK" "X_OK"
2399

WAIT

2401       Constants
2402               "WNOHANG" "WUNTRACED"
2403
2404               "WNOHANG"       Do not suspend the calling process until a
2405                               child process changes state but instead return
2406                               immediately.
2407
2408               "WUNTRACED"     Catch stopped child processes.
2409
2410       Macros  "WIFEXITED" "WEXITSTATUS" "WIFSIGNALED" "WTERMSIG" "WIFSTOPPED"
2411               "WSTOPSIG"
2412
2413               "WIFEXITED"     "WIFEXITED(${^CHILD_ERROR_NATIVE})" returns
2414                               true if the child process exited normally
2415                               ("exit()" or by falling off the end of
2416                               "main()")
2417
2418               "WEXITSTATUS"   "WEXITSTATUS(${^CHILD_ERROR_NATIVE})" returns
2419                               the normal exit status of the child process
2420                               (only meaningful if
2421                               "WIFEXITED(${^CHILD_ERROR_NATIVE})" is true)
2422
2423               "WIFSIGNALED"   "WIFSIGNALED(${^CHILD_ERROR_NATIVE})" returns
2424                               true if the child process terminated because of
2425                               a signal
2426
2427               "WTERMSIG"      "WTERMSIG(${^CHILD_ERROR_NATIVE})" returns the
2428                               signal the child process terminated for (only
2429                               meaningful if
2430                               "WIFSIGNALED(${^CHILD_ERROR_NATIVE})" is true)
2431
2432               "WIFSTOPPED"    "WIFSTOPPED(${^CHILD_ERROR_NATIVE})" returns
2433                               true if the child process is currently stopped
2434                               (can happen only if you specified the WUNTRACED
2435                               flag to "waitpid()")
2436
2437               "WSTOPSIG"      "WSTOPSIG(${^CHILD_ERROR_NATIVE})" returns the
2438                               signal the child process was stopped for (only
2439                               meaningful if
2440                               "WIFSTOPPED(${^CHILD_ERROR_NATIVE})" is true)
2441

WINSOCK

2443       (Windows only.)
2444
2445       Constants
2446               Added in Perl v5.24:
2447
2448               "WSAEINTR" "WSAEBADF" "WSAEACCES" "WSAEFAULT" "WSAEINVAL"
2449               "WSAEMFILE" "WSAEWOULDBLOCK" "WSAEINPROGRESS" "WSAEALREADY"
2450               "WSAENOTSOCK" "WSAEDESTADDRREQ" "WSAEMSGSIZE" "WSAEPROTOTYPE"
2451               "WSAENOPROTOOPT" "WSAEPROTONOSUPPORT" "WSAESOCKTNOSUPPORT"
2452               "WSAEOPNOTSUPP" "WSAEPFNOSUPPORT" "WSAEAFNOSUPPORT"
2453               "WSAEADDRINUSE" "WSAEADDRNOTAVAIL" "WSAENETDOWN"
2454               "WSAENETUNREACH" "WSAENETRESET" "WSAECONNABORTED"
2455               "WSAECONNRESET" "WSAENOBUFS" "WSAEISCONN" "WSAENOTCONN"
2456               "WSAESHUTDOWN" "WSAETOOMANYREFS" "WSAETIMEDOUT"
2457               "WSAECONNREFUSED" "WSAELOOP" "WSAENAMETOOLONG" "WSAEHOSTDOWN"
2458               "WSAEHOSTUNREACH" "WSAENOTEMPTY" "WSAEPROCLIM" "WSAEUSERS"
2459               "WSAEDQUOT" "WSAESTALE" "WSAEREMOTE" "WSAEDISCON" "WSAENOMORE"
2460               "WSAECANCELLED" "WSAEINVALIDPROCTABLE" "WSAEINVALIDPROVIDER"
2461               "WSAEPROVIDERFAILEDINIT" "WSAEREFUSED"
2462
2463
2464
2465perl v5.36.3                      2023-11-30                        POSIX(3pm)
Impressum