POSIX 1003.1 identifiers. Many of these identifiers have been given Perl-ish
interfaces.
-I<Everything is exported by default> with the exception of any POSIX
-functions with the same name as a built-in Perl function, such as
-C<abs>, C<alarm>, C<rmdir>, C<write>, etc.., which will be exported
-only if you ask for them explicitly. This is an unfortunate backwards
-compatibility feature. You can stop the exporting by saying S<C<use
-POSIX ()>> and then use the fully qualified names (I<e.g.>, C<POSIX::SEEK_END>),
-or by giving an explicit import list. If you do neither, and opt for the
-default, S<C<use POSIX;>> has to import I<553 symbols>.
-
This document gives a condensed list of the features available in the POSIX
module. Consult your operating system's manpages for general information on
most features. Consult L<perlfunc> for functions which are noted as being
-identical to Perl's builtin functions.
+identical or almost identical to Perl's builtin functions.
The first section describes POSIX functions from the 1003.1 specification.
The second section describes some classes for signal objects, TTY objects,
constants and macros in an organization which roughly follows IEEE Std
1003.1b-1993.
-=head1 C99 "math" interfaces
-
-Mathematic functions and constants from the C99 standard are available
-on many platforms. In the below functions list they are marked [C99].
-
-The mathematical constants include:
-
- M_SQRT2 # the square root of two
- M_E # the Euler's (or Napier's) constant
- M_PI # the Pi
-
-and other related/similar ones
-
- M_SQRT1_2 # sqrt(1/2)
- M_LN10 M_LN2 M_LOG10E M_LOG2E
- M_1_PI M_2_PI M_2_SQRTPI M_PI_2 M_PI_4 # 1/Pi, ..., Pi/4
-
-and the
-
- INFINITY
- NAN
-
-The last two are also available as just C<Inf> and C<NaN>.
-
-The Bessel functions (j0, j1, jn, y0, y1, yn) are also available.
-
=head1 CAVEATS
+I<Everything is exported by default> (with a handful of exceptions).
+This is an unfortunate backwards compatibility feature and its use is
+B<strongly L<discouraged|perlpolicy/discouraged>>.
+You should either prevent the exporting (by saying S<C<use POSIX ();>>,
+as usual) and then use fully qualified names (e.g. C<POSIX::SEEK_END>),
+or give an explicit import list.
+If you do neither and opt for the default (as in S<C<use POSIX;>>), you
+will import I<hundreds and hundreds> of symbols into your namespace.
+
A few functions are not implemented because they are C specific. If you
attempt to call these, they will print a message telling you that they
aren't implemented, and suggest using the Perl equivalent, should one
=item C<abs>
-This is identical to Perl's builtin C<abs()> function, returning
-the absolute value of its numerical argument.
+This is identical to Perl's builtin C<abs()> function, returning the absolute
+value of its numerical argument (except that C<POSIX::abs()> must be provided
+an explicit value (rather than relying on an implicit C<$_>):
+
+ $absolute_value = POSIX::abs(42); # good
+
+ $absolute_value = POSIX::abs(); # throws exception
=item C<access>
This is identical to the C function C<acosh()>, returning the
hyperbolic arcus cosine of its numerical argument [C99]. See also
-L<Math::Trig>.
+L<Math::Trig>. Added in Perl v5.22.
=item C<alarm>
-This is identical to Perl's builtin C<alarm()> function,
-either for arming or disarming the C<SIGARLM> timer.
+This is identical to Perl's builtin C<alarm()> function, either for arming or
+disarming the C<SIGARLM> timer, except that C<POSIX::alarm()> must be provided
+an explicit value (rather than relying on an implicit C<$_>):
+
+ POSIX::alarm(3) # good
+
+ POSIX::alarm() # throws exception
=item C<asctime>
1900-based: 2001 equals C<101>. C<$wday> and C<$yday> default to zero
(and are usually ignored anyway), and C<$isdst> defaults to -1.
+Note the result is always in English. Use C<L</strftime>> instead to
+get a result suitable for the current locale. That function's C<%c>
+format yields the locale's preferred representation.
+
=item C<asin>
This is identical to the C function C<asin()>, returning
This is identical to the C function C<asinh()>, returning the
hyperbolic arcus sine of its numerical argument [C99]. See also
-L<Math::Trig>.
+L<Math::Trig>. Added in Perl v5.22.
=item C<assert>
This is identical to the C function C<atanh()>, returning the
hyperbolic arcus tangent of its numerical argument [C99]. See also
-L<Math::Trig>.
+L<Math::Trig>. Added in Perl v5.22.
=item C<atan2>
=item C<cbrt>
-The cube root [C99].
+The cube root [C99]. Added in Perl v5.22.
=item C<ceil>
=item C<chdir>
-This is identical to Perl's builtin C<chdir()> function, allowing
-one to change the working (default) directory, see L<perlfunc/chdir>.
+This is identical to Perl's builtin C<chdir()> function, allowing one to
+change the working (default) directory -- see L<perlfunc/chdir> -- with the
+exception that C<POSIX::chdir()> must be provided an explicit value (rather
+than relying on an implicit C<$_>):
+
+ $rv = POSIX::chdir('path/to/dir'); # good
+
+ $rv = POSIX::chdir(); # throws exception
=item C<chmod>
This is identical to Perl's builtin C<chmod()> function, allowing
-one to change file and directory permissions, see L<perlfunc/chmod>.
+one to change file and directory permissions -- see L<perlfunc/chmod> -- with
+the exception that C<POSIX::chmod()> can only change one file at a time
+(rather than a list of files):
+
+ $c = chmod 0664, $file1, $file2; # good
+
+ $c = POSIX::chmod 0664, $file1; # throws exception
+
+ $c = POSIX::chmod 0664, $file1, $file2; # throws exception
+
+As with the built-in C<chmod()>, C<$file> may be a filename or a file
+handle.
=item C<chown>
=item C<copysign>
-Returns C<x> but with the sign of C<y> [C99].
+Returns C<x> but with the sign of C<y> [C99]. Added in Perl v5.22.
$x_with_sign_of_y = POSIX::copysign($x, $y);
This is identical to the C function C<ctime()> and equivalent
to C<asctime(localtime(...))>, see L</asctime> and L</localtime>.
-=item C<cuserid>
+=item C<cuserid> [POSIX.1-1988]
Get the login name of the owner of the current process.
$name = POSIX::cuserid();
+Note: this function has not been specified by POSIX since 1990 and is included
+only for backwards compatibility. New code should use L<C<getlogin()>|perlfunc/getlogin> instead.
+
=item C<difftime>
This is identical to the C function C<difftime()>, for returning
=item C<erf>
-The error function [C99].
+The error function [C99]. Added in Perl v5.22.
=item C<erfc>
-The complementary error function [C99].
+The complementary error function [C99]. Added in Perl v5.22.
=item C<errno>
=item C<expm1>
Equivalent to C<exp(x) - 1>, but more precise for small argument values [C99].
+Added in Perl v5.22.
See also L</log1p>.
=item C<fdim>
"Positive difference", S<C<x - y>> if S<C<x E<gt> y>>, zero otherwise [C99].
+Added in Perl v5.22.
=item C<fegetround>
Returns the current floating point rounding mode, one of
- FE_TONEAREST FE_TOWARDZERO FE_UPWARD FE_UPWARD
+ FE_TONEAREST FE_TOWARDZERO FE_UPWARD FE_DOWNWARD
C<FE_TONEAREST> is like L</round>, C<FE_TOWARDZERO> is like L</trunc> [C99].
+Added in Perl v5.22.
=item C<fesetround>
-Sets the floating point rounding mode, see L</fegetround>.
+Sets the floating point rounding mode, see L</fegetround> [C99]. Added in
+Perl v5.22.
=item C<fma>
"Fused multiply-add", S<C<x * y + z>>, possibly faster (and less lossy)
-than the explicit two operations [C99].
+than the explicit two operations [C99]. Added in Perl v5.22.
my $fused = POSIX::fma($x, $y, $z);
=item C<fmax>
Maximum of C<x> and C<y>, except when either is C<NaN>, returns the other [C99].
+Added in Perl v5.22.
my $min = POSIX::fmax($x, $y);
=item C<fmin>
Minimum of C<x> and C<y>, except when either is C<NaN>, returns the other [C99].
+Added in Perl v5.22.
my $min = POSIX::fmin($x, $y);
FP_NORMAL FP_ZERO FP_SUBNORMAL FP_INFINITE FP_NAN
-telling the class of the argument [C99].
+telling the class of the argument [C99]. C<FP_INFINITE> is positive
+or negative infinity, C<FP_NAN> is not-a-number. C<FP_SUBNORMAL>
+means subnormal numbers (also known as denormals), very small numbers
+with low precision. C<FP_ZERO> is zero. C<FP_NORMAL> is all the rest.
+Added in Perl v5.22.
=item C<fprintf>
returning the user name associated with the current session, see
L<perlfunc/getlogin>.
+=item C<getpayload>
+
+ use POSIX ':nan_payload';
+ getpayload($var)
+
+Returns the C<NaN> payload. Added in Perl v5.24.
+
+Note the API instability warning in L</setpayload>.
+
+See L</nan> for more discussion about C<NaN>.
+
=item C<getpgrp>
This is identical to Perl's builtin C<getpgrp()> function for
=item C<hypot>
Equivalent to C<S<sqrt(x * x + y * y)>> except more stable on very large
-or very small arguments [C99].
+or very small arguments [C99]. Added in Perl v5.22.
=item C<ilogb>
-Integer binary logarithm [C99]
+Integer binary logarithm [C99]. Added in Perl v5.22.
For example C<ilogb(20)> is 4, as an integer.
See also L</logb>.
-=item C<isalnum>
+=item C<Inf>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:alnum:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
+The infinity as a constant:
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+ use POSIX qw(Inf);
+ my $pos_inf = +Inf; # Or just Inf.
+ my $neg_inf = -Inf;
-You may want to use the C<L<E<sol>\wE<sol>|perlrecharclass/Word
-characters>> construct instead.
+See also L</isinf>, and L</fpclassify>.
-=item C<isalpha>
+=item C<isalnum>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:alpha:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:alnum:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+=item C<isalpha>
+
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:alpha:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isatty>
=item C<iscntrl>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:cntrl:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:cntrl:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isdigit>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:digit:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
-
-You may want to use the C<L<E<sol>\dE<sol>|perlrecharclass/Digits>>
-construct instead.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:digit:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isfinite>
Returns true if the argument is a finite number (that is, not an
-infinity, or the not-a-number) [C99].
+infinity, or the not-a-number) [C99]. Added in Perl v5.22.
-See also L</nan>, L</isinf>, L</issignaling>, and L</fpclassify>.
+See also L</isinf>, L</isnan>, and L</fpclassify>.
=item C<isgraph>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:graph:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:graph:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isgreater>
(Also C<isgreaterequal>, C<isless>, C<islessequal>, C<islessgreater>,
C<isunordered>)
-Floating point comparisons which handle the C<NaN> [C99].
+Floating point comparisons which handle the C<NaN> [C99]. Added in Perl
+v5.22.
=item C<isinf>
Returns true if the argument is an infinity (positive or negative) [C99].
+Added in Perl v5.22.
-See also L</isnan>, L</isfinite>, and L</fpclassify>.
+See also L</Inf>, L</isnan>, L</isfinite>, and L</fpclassify>.
=item C<islower>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:lower:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
-
-Do B<not> use C</[a-z]/> unless you don't care about the current locale.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:lower:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isnan>
-Returns true if the argument is C<NaN> (not-a-number) [C99].
+Returns true if the argument is C<NaN> (not-a-number) [C99]. Added in
+Perl v5.22.
Note that you cannot test for "C<NaN>-ness" with
since the C<NaN> is not equivalent to anything, B<including itself>.
-See also L</nan>, L</isinf>, and L</fpclassify>.
+See also L</nan>, L</NaN>, L</isinf>, and L</fpclassify>.
=item C<isnormal>
Returns true if the argument is normal (that is, not a subnormal/denormal,
-and not an infinity, or a not-a-number) [C99].
+and not an infinity, or a not-a-number) [C99]. Added in Perl v5.22.
See also L</isfinite>, and L</fpclassify>.
=item C<isprint>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:print:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:print:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<ispunct>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:punct:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
-
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:punct:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<issignaling>
-Returns true if the argument is a signaling C<NaN> (not-a-number)
+ use POSIX ':nan_payload';
+ issignaling($var, $payload)
-See also L</isnan> and L</fpclassify>. (There is no "isquiet".)
+Return true if the argument is a I<signaling> NaN. Added in Perl v5.24.
-=item C<isspace>
+Note the API instability warning in L</setpayload>.
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:space:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
+See L</nan> for more discussion about C<NaN>.
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+=item C<isspace>
-You may want to use the C<L<E<sol>\sE<sol>|perlrecharclass/Whitespace>>
-construct instead.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:space:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
=item C<isupper>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:upper:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:upper:]]+ $ /x>>, which you should convert
+to use instead. See L<perlrecharclass/POSIX Character Classes>.
+
+=item C<isxdigit>
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+This function has been removed as of Perl v5.24. It was very similar to
+matching against S<C<qr/ ^ [[:xdigit:]]+ $ /x>>, which you should
+convert to use instead. See L<perlrecharclass/POSIX Character Classes>.
-Do B<not> use C</[A-Z]/> unless you don't care about the current locale.
+=item C<j0>
-=item C<isxdigit>
+=item C<j1>
-Deprecated function whose use raises a warning, and which is slated to
-be removed in a future Perl version. It is very similar to matching
-against S<C<qr/ ^ [[:xdigit:]]+ $ /x>>, which you should convert to use
-instead. The function is deprecated because 1) it doesn't handle UTF-8
-encoded strings properly; and 2) it returns C<TRUE> even if the input is
-the empty string. The function return is always based on the current
-locale, whereas using locale rules is optional with the regular
-expression, based on pragmas in effect and pattern modifiers (see
-L<perlre/Character set modifiers> and L<perlre/Which character set
-modifier is in effect?>).
+=item C<jn>
-The function returns C<TRUE> if the input string is empty, or if the
-corresponding C function returns C<TRUE> for every byte in the string.
+=item C<y0>
-=item C<j0>
+=item C<y1>
-(Also C<j1>, C<jn>, C<y0>, C<y1>, C<yn>)
+=item C<yn>
The Bessel function of the first kind of the order zero.
=item C<lgamma>
-The logarithm of the Gamma function [C99].
+The logarithm of the Gamma function [C99]. Added in Perl v5.22.
See also L</tgamma>.
=item C<log1p>
Equivalent to S<C<log(1 + x)>>, but more stable results for small argument
-values [C99].
+values [C99]. Added in Perl v5.22.
=item C<log2>
-Logarithm base two [C99].
+Logarithm base two [C99]. Added in Perl v5.22.
See also L</expm1>.
=item C<logb>
-Integer binary logarithm [C99].
+Integer binary logarithm [C99]. Added in Perl v5.22.
For example C<logb(20)> is 4, as a floating point number.
=item C<localeconv>
Get numeric formatting information. Returns a reference to a hash
-containing the current underlying locale's formatting values. Users of this function
-should also read L<perllocale>, which provides a comprehensive
-discussion of Perl locale handling, including
+containing the formatting values of the locale that currently underlies
+the program, regardless of whether or not it is called from within the
+scope of a S<C<use locale>>. Users of this function should also read
+L<perllocale>, which provides a comprehensive discussion of Perl locale
+handling, including
L<a section devoted to this function|perllocale/The localeconv function>.
+Prior to Perl 5.28, or when operating in a non thread-safe environment,
+it should not be used in a threaded application unless it's certain that
+the underlying locale is C or POSIX. This is because it otherwise
+changes the locale, which globally affects all threads simultaneously.
+Windows platforms starting with Visual Studio 2005 are mostly
+thread-safe, but use of this function in those prior to Visual Studio
+2015 can interfere with a thread that has called
+L<perlapi/switch_to_global_locale>.
Here is how to query the database for the B<de> (Deutsch or German) locale.
=item C<localtime>
This is identical to Perl's builtin C<localtime()> function for
-converting seconds since the epoch to a date see L<perlfunc/localtime>.
+converting seconds since the epoch to a date see L<perlfunc/localtime> except
+that C<POSIX::localtime()> must be provided an explicit value (rather than
+relying on an implicit C<$_>):
+
+ @localtime = POSIX::localtime(time); # good
+
+ @localtime = localtime(); # good
+
+ @localtime = POSIX::localtime(); # throws exception
=item C<log>
Depending on the current floating point rounding mode, rounds the
argument either toward nearest (like L</round>), toward zero (like
L</trunc>), downward (toward negative infinity), or upward (toward
-positive infinity) [C99].
+positive infinity) [C99]. Added in Perl v5.22.
For the rounding mode, see L</fegetround>.
=item C<lround>
-Like L</round>, but as integer, as opposed to floating point [C99].
+Like L</round>, but as integer, as opposed to floating point [C99]. Added
+in Perl v5.22.
See also L</ceil>, L</floor>, L</trunc>.
+Owing to an oversight, this is not currently exported by default, or as part of
+the C<:math_h_c99> export tag; importing it must therefore be done by explicit
+name.
+
=item C<malloc>
Not implemented. C<malloc()> is C-specific. Perl does memory management transparently.
=item C<mblen>
-This is identical to the C function C<mblen()>.
-
-Core Perl does not have any support for the wide and multibyte
-characters of the C standards, except under UTF-8 locales, so this might
-be a rather useless function.
-
-However, Perl supports Unicode, see L<perluniintro>.
-
-=item C<mbstowcs>
-
-This is identical to the C function C<mbstowcs()>.
-
-See L</mblen>.
+This is the same as the C function C<mblen()> on unthreaded perls. On
+threaded perls, it transparently (almost) substitutes the more
+thread-safe L<C<mbrlen>(3)>, if available, instead of C<mblen>.
+
+Core Perl does not have any support for wide and multibyte locales,
+except Unicode UTF-8 locales. This function, in conjunction with
+L</mbtowc> and L</wctomb> may be used to roll your own decoding/encoding
+of other types of multi-byte locales.
+
+Use C<undef> as the first parameter to this function to get the effect
+of passing NULL as the first parameter to C<mblen>. This resets any
+shift state to its initial value. The return value is undefined if
+C<mbrlen> was substituted, so you should never rely on it.
+
+When the first parameter is a scalar containing a value that either is a
+PV string or can be forced into one, the return value is the number of
+bytes occupied by the first character of that string; or 0 if that first
+character is the wide NUL character; or negative if there is an error.
+This is based on the locale that currently underlies the program,
+regardless of whether or not the function is called from Perl code that
+is within the scope of S<C<use locale>>. Perl makes no attempt at
+hiding from your code any differences in the C<errno> setting between
+C<mblen> and C<mbrlen>. It does set C<errno> to 0 before calling them.
+
+The optional second parameter is ignored if it is larger than the
+actual length of the first parameter string.
=item C<mbtowc>
-This is identical to the C function C<mbtowc()>.
-
-See L</mblen>.
+This is the same as the C function C<mbtowc()> on unthreaded perls. On
+threaded perls, it transparently (almost) substitutes the more
+thread-safe L<C<mbrtowc>(3)>, if available, instead of C<mbtowc>.
+
+Core Perl does not have any support for wide and multibyte locales,
+except Unicode UTF-8 locales. This function, in conjunction with
+L</mblen> and L</wctomb> may be used to roll your own decoding/encoding
+of other types of multi-byte locales.
+
+The first parameter is a scalar into which, upon success, the wide
+character represented by the multi-byte string contained in the second
+parameter is stored. The optional third parameter is ignored if it is
+larger than the actual length of the second parameter string.
+
+Use C<undef> as the second parameter to this function to get the effect
+of passing NULL as the second parameter to C<mbtowc>. This resets any
+shift state to its initial value. The return value is undefined if
+C<mbrtowc> was substituted, so you should never rely on it.
+
+When the second parameter is a scalar containing a value that either is
+a PV string or can be forced into one, the return value is the number of
+bytes occupied by the first character of that string; or 0 if that first
+character is the wide NUL character; or negative if there is an error.
+This is based on the locale that currently underlies the program,
+regardless of whether or not the function is called from Perl code that
+is within the scope of S<C<use locale>>. Perl makes no attempt at
+hiding from your code any differences in the C<errno> setting between
+C<mbtowc> and C<mbrtowc>. It does set C<errno> to 0 before calling
+them.
=item C<memchr>
See also L</round>.
+=item C<NaN>
+
+The not-a-number as a constant:
+
+ use POSIX qw(NaN);
+ my $nan = NaN;
+
+See also L</nan>, C</isnan>, and L</fpclassify>.
+
=item C<nan>
-Returns not-a-number [C99].
+ my $nan = nan();
-See also L</isnan>.
+Returns C<NaN>, not-a-number [C99]. Added in Perl v5.22.
+
+The returned NaN is always a I<quiet> NaN, as opposed to I<signaling>.
+
+With an argument, can be used to generate a NaN with I<payload>.
+The argument is first interpreted as a floating point number,
+but then any fractional parts are truncated (towards zero),
+and the value is interpreted as an unsigned integer.
+The bits of this integer are stored in the unused bits of the NaN.
+
+The result has a dual nature: it is a NaN, but it also carries
+the integer inside it. The integer can be retrieved with L</getpayload>.
+Note, though, that the payload is not propagated, not even on copies,
+and definitely not in arithmetic operations.
+
+How many bits fit in the NaN depends on what kind of floating points
+are being used, but on the most common platforms (64-bit IEEE 754,
+or the x86 80-bit long doubles) there are 51 and 61 bits available,
+respectively. (There would be 52 and 62, but the quiet/signaling
+bit of NaNs takes away one.) However, because of the floating-point-to-
+integer-and-back conversions, please test carefully whether you get back
+what you put in. If your integers are only 32 bits wide, you probably
+should not rely on more than 32 bits of payload.
+
+Whether a "signaling" NaN is in any way different from a "quiet" NaN,
+depends on the platform. Also note that the payload of the default
+NaN (no argument to nan()) is not necessarily zero, use C<setpayload>
+to explicitly set the payload. On some platforms like the 32-bit x86,
+(unless using the 80-bit long doubles) the signaling bit is not supported
+at all.
+
+See also L</isnan>, L</NaN>, L</setpayload> and L</issignaling>.
=item C<nearbyint>
Returns the nearest integer to the argument, according to the current
-rounding mode (see L</fegetround>) [C99].
+rounding mode (see L</fegetround>) [C99]. Added in Perl v5.22.
=item C<nextafter>
Returns the next representable floating point number after C<x> in the
-direction of C<y> [C99].
+direction of C<y> [C99]. Added in Perl v5.22.
my $nextafter = POSIX::nextafter($x, $y);
=item C<nexttoward>
Returns the next representable floating point number after C<x> in the
-direction of C<y> [C99].
+direction of C<y> [C99]. Added in Perl v5.22.
my $nexttoward = POSIX::nexttoward($x, $y);
=item C<remainder>
Given C<x> and C<y>, returns the value S<C<x - n*y>>, where C<n> is the integer
-closest to C<x/y>. [C99]
+closest to C<x>/C<y> [C99]. Added in Perl v5.22.
my $remainder = POSIX::remainder($x, $y)
=item C<remove>
-This is identical to Perl's builtin C<unlink()> function
-for removing files, see L<perlfunc/unlink>.
+Deletes a name from the filesystem. Calls L<perlfunc/unlink> for
+files and L<perlfunc/rmdir> for directories.
=item C<remquo>
Like L</remainder> but also returns the low-order bits of the quotient (n)
-[C99]
+[C99]. Added in Perl v5.22.
(This is quite esoteric interface, mainly used to implement numerical
algorithms.)
=item C<round>
Returns the integer (but still as floating point) nearest to the
-argument [C99].
+argument [C99]. Added in Perl v5.22.
See also L</ceil>, L</floor>, L</lround>, L</modf>, and L</trunc>.
=item C<scalbn>
-Returns S<C<x * 2**y>> [C99].
+Returns S<C<x * 2**y>> [C99]. Added in Perl v5.22.
See also L</frexp> and L</ldexp>.
=item C<setlocale>
-Modifies and queries the program's underlying locale. Users of this
+WARNING! Prior to Perl 5.28 or on a system that does not support
+thread-safe locale operations, do NOT use this function in a
+L<thread|threads>. The locale will change in all other threads at the
+same time, and should your thread get paused by the operating system,
+and another started, that thread will not have the locale it is
+expecting. On some platforms, there can be a race leading to segfaults
+if two threads call this function nearly simultaneously. This warning
+does not apply on unthreaded builds, or on perls where
+C<${^SAFE_LOCALES}> exists and is non-zero; namely Perl 5.28 and later
+compiled to be locale-thread-safe.
+
+This function
+modifies and queries the program's underlying locale. Users of this
function should read L<perllocale>, whch provides a comprehensive
discussion of Perl locale handling, knowledge of which is necessary to
properly use this function. It contains
The discussion here is merely a summary reference for C<setlocale()>.
Note that Perl itself is almost entirely unaffected by the locale
except within the scope of S<C<"use locale">>. (Exceptions are listed
-in L<perllocale/Not within the scope of "use locale">.)
+in L<perllocale/Not within the scope of "use locale">, and
+locale-dependent functions within the POSIX module ARE always affected
+by the current locale.)
The following examples assume
$loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" );
+=item C<setpayload>
+
+ use POSIX ':nan_payload';
+ setpayload($var, $payload);
+
+Sets the C<NaN> payload of var. Added in Perl v5.24.
+
+NOTE: the NaN payload APIs are based on the latest (as of June 2015)
+proposed ISO C interfaces, but they are not yet a standard. Things
+may change.
+
+See L</nan> for more discussion about C<NaN>.
+
+See also L</setpayloadsig>, L</isnan>, L</getpayload>, and L</issignaling>.
+
+=item C<setpayloadsig>
+
+ use POSIX ':nan_payload';
+ setpayloadsig($var, $payload);
+
+Like L</setpayload> but also makes the NaN I<signaling>. Added in Perl
+v5.24.
+
+Depending on the platform the NaN may or may not behave differently.
+
+Note the API instability warning in L</setpayload>.
+
+Note that because how the floating point formats work out, on the most
+common platforms signaling payload of zero is best avoided,
+since it might end up being identical to C<+Inf>.
+
+See also L</nan>, L</isnan>, L</getpayload>, and L</issignaling>.
+
=item C<setpgid>
This is similar to the C function C<setpgid()> for
a user process and the uid and pid make sense,
otherwise the signal was sent by the kernel
+The constants for specific C<code> values can be imported individually
+or using the C<:signal_h_si_code> tag, since Perl v5.24.
+
The following are also defined by POSIX/SUSv3, but unfortunately
not very widely implemented:
uid the uid of the process id generating the signal
status exit value or signal for SIGCHLD
band band event for SIGPOLL
+ addr address of faulting instruction or memory
+ reference for SIGILL, SIGFPE, SIGSEGV or SIGBUS
A third argument is also passed to the handler, which contains a copy
of the raw binary contents of the C<siginfo> structure: if a system has
=item C<signbit>
Returns zero for positive arguments, non-zero for negative arguments [C99].
+Added in Perl v5.22.
=item C<sigpending>
the C<strxfrm()> function. Not really needed since
Perl can do this transparently, see L<perllocale>.
+Beware that in a UTF-8 locale, anything you pass to this function must
+be in UTF-8; and when not in a UTF-8 locale, anything passed must not be
+UTF-8 encoded.
+
=item C<strcpy>
Not implemented. C<strcpy()> is C-specific, use C<=> instead, see L<perlop>.
error, so clear C<$!> before calling C<strtod>. However, non-POSIX systems
may not check for overflow, and therefore will never set C<$!>.
-C<strtod> respects any POSIX C<setlocale()> C<LC_TIME> settings,
+C<strtod> respects any POSIX C<setlocale()> C<LC_NUMERIC> settings,
regardless of whether or not it is called from Perl code that is within
-the scope of S<C<use locale>>.
+the scope of S<C<use locale>>. Prior to Perl 5.28, or when operating in
+a non thread-safe environment, it should not be used in a threaded
+application unless it's certain that the underlying locale is C
+or POSIX. This is because it otherwise changes the locale, which
+globally affects all threads simultaneously.
To parse a string C<$str> as a floating point number use
Not really needed since Perl can do this transparently, see
L<perllocale>.
+Beware that in a UTF-8 locale, anything you pass to this function must
+be in UTF-8; and when not in a UTF-8 locale, anything passed must not be
+UTF-8 encoded.
+
=item C<sysconf>
Retrieves values of system configurable variables.
=item C<tgamma>
-The Gamma function [C99].
+The Gamma function [C99]. Added in Perl v5.22.
See also L</lgamma>.
=item C<tmpnam>
-Returns a name for a temporary file.
-
- $tmpfile = POSIX::tmpnam();
-
For security reasons, which are probably detailed in your system's
documentation for the C library C<tmpnam()> function, this interface
-should not be used; instead see L<File::Temp>.
+is no longer available since Perl v5.26; instead use L<File::Temp>.
=item C<tolower>
+This function has been removed as of Perl v5.26.
This is identical to the C function, except that it can apply to a single
character or to a whole string, and currently operates as if the locale
always is "C". Consider using the C<lc()> function, see L<perlfunc/lc>,
=item C<toupper>
+This function has been removed as of Perl v5.26.
This is similar to the C function, except that it can apply to a single
character or to a whole string, and currently operates as if the locale
always is "C". Consider using the C<uc()> function, see L<perlfunc/uc>,
=item C<trunc>
-Returns the integer toward zero from the argument [C99].
+Returns the integer toward zero from the argument [C99]. Added in Perl
+v5.22.
See also L</ceil>, L</floor>, and L</round>.
$pid = POSIX::waitpid( -1, POSIX::WNOHANG );
print "status = ", ($? / 256), "\n";
-=item C<wcstombs>
-
-This is identical to the C function C<wcstombs()>.
-
See L</mblen>.
=item C<wctomb>
-This is identical to the C function C<wctomb()>.
-
-See L</mblen>.
+This is the same as the C function C<wctomb()> on unthreaded perls. On
+threaded perls, it transparently (almost) substitutes the more
+thread-safe L<C<wcrtomb>(3)>, if available, instead of C<wctomb>.
+
+Core Perl does not have any support for wide and multibyte locales,
+except Unicode UTF-8 locales. This function, in conjunction with
+L</mblen> and L</mbtowc> may be used to roll your own decoding/encoding
+of other types of multi-byte locales.
+
+Use C<undef> as the first parameter to this function to get the effect
+of passing NULL as the first parameter to C<wctomb>. This resets any
+shift state to its initial value. The return value is undefined if
+C<wcrtomb> was substituted, so you should never rely on it.
+
+When the first parameter is a scalar, the code point contained in the
+scalar second parameter is converted into a multi-byte string and stored
+into the first parameter scalar. This is based on the locale that
+currently underlies the program, regardless of whether or not the
+function is called from Perl code that is within the scope of S<C<use
+locale>>. The return value is the number of bytes stored; or negative
+if the code point isn't representable in the current locale. Perl makes
+no attempt at hiding from your code any differences in the C<errno>
+setting between C<wctomb> and C<wcrtomb>. It does set C<errno> to 0
+before calling them.
=item C<write>
$sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
+Throws an error if any of the signals supplied cannot be added to the
+set.
+
=item C<addset>
Add a signal to a SigSet object.
=back
+=head1 RESOURCE CONSTANTS
+
+Imported with the C<:sys_resource_h> tag.
+
+=over 8
+
+=item Constants
+
+Added in Perl v5.28:
+
+C<PRIO_PROCESS> C<PRIO_PGRP> C<PRIO_USER>
+
+=back
+
=head1 SYSTEM CONFIGURATION
=over 8
=back
+=head1 FLOATING-POINT ENVIRONMENT
+
+=over 8
+
+=item Constants
+
+C<FE_DOWNWARD> C<FE_TONEAREST> C<FE_TOWARDZERO> C<FE_UPWARD>
+on systems that support them.
+
+=back
+
=head1 LIMITS
=over 8
C<HUGE_VAL>
+Added in Perl v5.22:
+
+C<FP_ILOGB0> C<FP_ILOGBNAN> C<FP_INFINITE> C<FP_NAN> C<FP_NORMAL> C<FP_SUBNORMAL> C<FP_ZERO>
+C<INFINITY> C<NAN> C<Inf> C<NaN>
+C<M_1_PI> C<M_2_PI> C<M_2_SQRTPI> C<M_E> C<M_LN10> C<M_LN2> C<M_LOG10E> C<M_LOG2E> C<M_PI>
+C<M_PI_2> C<M_PI_4> C<M_SQRT1_2> C<M_SQRT2>
+on systems with C99 support.
+
=back
=head1 SIGNAL
C<SIGUSR1> C<SIGUSR2> C<SIG_BLOCK> C<SIG_DFL> C<SIG_ERR> C<SIG_IGN> C<SIG_SETMASK>
C<SIG_UNBLOCK>
+Added in Perl v5.24:
+
+C<ILL_ILLOPC> C<ILL_ILLOPN> C<ILL_ILLADR> C<ILL_ILLTRP> C<ILL_PRVOPC> C<ILL_PRVREG> C<ILL_COPROC>
+C<ILL_BADSTK> C<FPE_INTDIV> C<FPE_INTOVF> C<FPE_FLTDIV> C<FPE_FLTOVF> C<FPE_FLTUND> C<FPE_FLTRES>
+C<FPE_FLTINV> C<FPE_FLTSUB> C<SEGV_MAPERR> C<SEGV_ACCERR> C<BUS_ADRALN> C<BUS_ADRERR>
+C<BUS_OBJERR> C<TRAP_BRKPT> C<TRAP_TRACE> C<CLD_EXITED> C<CLD_KILLED> C<CLD_DUMPED> C<CLD_TRAPPED>
+C<CLD_STOPPED> C<CLD_CONTINUED> C<POLL_IN> C<POLL_OUT> C<POLL_MSG> C<POLL_ERR> C<POLL_PRI>
+C<POLL_HUP> C<SI_USER> C<SI_QUEUE> C<SI_TIMER> C<SI_ASYNCIO> C<SI_MESGQ>
+
=back
=head1 STAT
=item Constants
-C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<L_tmpname> C<TMP_MAX>
+C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<TMP_MAX>
=back
=back
+=head1 WINSOCK
+
+(Windows only.)
+
+=over 8
+
+=item Constants
+
+Added in Perl v5.24:
+
+C<WSAEINTR> C<WSAEBADF> C<WSAEACCES> C<WSAEFAULT> C<WSAEINVAL> C<WSAEMFILE> C<WSAEWOULDBLOCK>
+C<WSAEINPROGRESS> C<WSAEALREADY> C<WSAENOTSOCK> C<WSAEDESTADDRREQ> C<WSAEMSGSIZE>
+C<WSAEPROTOTYPE> C<WSAENOPROTOOPT> C<WSAEPROTONOSUPPORT> C<WSAESOCKTNOSUPPORT>
+C<WSAEOPNOTSUPP> C<WSAEPFNOSUPPORT> C<WSAEAFNOSUPPORT> C<WSAEADDRINUSE>
+C<WSAEADDRNOTAVAIL> C<WSAENETDOWN> C<WSAENETUNREACH> C<WSAENETRESET> C<WSAECONNABORTED>
+C<WSAECONNRESET> C<WSAENOBUFS> C<WSAEISCONN> C<WSAENOTCONN> C<WSAESHUTDOWN>
+C<WSAETOOMANYREFS> C<WSAETIMEDOUT> C<WSAECONNREFUSED> C<WSAELOOP> C<WSAENAMETOOLONG>
+C<WSAEHOSTDOWN> C<WSAEHOSTUNREACH> C<WSAENOTEMPTY> C<WSAEPROCLIM> C<WSAEUSERS>
+C<WSAEDQUOT> C<WSAESTALE> C<WSAEREMOTE> C<WSAEDISCON> C<WSAENOMORE> C<WSAECANCELLED>
+C<WSAEINVALIDPROCTABLE> C<WSAEINVALIDPROVIDER> C<WSAEPROVIDERFAILEDINIT>
+C<WSAEREFUSED>
+
+=back
+