1=head1 NAME 2 3POSIX - Perl interface to IEEE Std 1003.1 4 5=head1 SYNOPSIS 6 7 use POSIX (); 8 use POSIX qw(setsid); 9 use POSIX qw(:errno_h :fcntl_h); 10 11 printf "EINTR is %d\n", EINTR; 12 13 my $sess_id = POSIX::setsid(); 14 15 my $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); 16 # note: that's a filedescriptor, *NOT* a filehandle 17 18=head1 DESCRIPTION 19 20The POSIX module permits you to access all (or nearly all) the standard 21POSIX 1003.1 identifiers. Many of these identifiers have been given Perl-ish 22interfaces. 23 24This document gives a condensed list of the features available in the POSIX 25module. Consult your operating system's manpages for general information on 26most features. Consult L<perlfunc> for functions which are noted as being 27identical or almost identical to Perl's builtin functions. 28 29The first section describes POSIX functions from the 1003.1 specification. 30The second section describes some classes for signal objects, TTY objects, 31and other miscellaneous objects. The remaining sections list various 32constants and macros in an organization which roughly follows IEEE Std 331003.1b-1993. 34 35The notation C<[C99]> indicates functions that were added in the ISO/IEC 369899:1999 version of the C language standard. Some may not be available 37on your system if it adheres to an earlier standard. Attempts to use 38any missing one will result in a fatal runtime error message. 39 40=head1 CAVEATS 41 42I<Everything is exported by default> (with a handful of exceptions). 43This is an unfortunate backwards compatibility feature and its use is 44B<strongly L<discouraged|perlpolicy/discouraged>>. 45You should either prevent the exporting (by saying S<C<use POSIX ();>>, 46as usual) and then use fully qualified names (e.g. C<POSIX::SEEK_END>), 47or give an explicit import list. 48If you do neither and opt for the default (as in S<C<use POSIX;>>), you 49will import I<hundreds and hundreds> of symbols into your namespace. 50 51A few functions are not implemented because they are C specific. If you 52attempt to call these, they will print a message telling you that they 53aren't implemented, and suggest using the Perl equivalent, should one 54exist. For example, trying to access the C<setjmp()> call will elicit the 55message "C<setjmp() is C-specific: use eval {} instead>". 56 57Furthermore, some evil vendors will claim 1003.1 compliance, but in fact 58are not so: they will not pass the PCTS (POSIX Compliance Test Suites). 59For example, one vendor may not define C<EDEADLK>, or the semantics of the 60errno values set by C<open(2)> might not be quite right. Perl does not 61attempt to verify POSIX compliance. That means you can currently 62successfully say "use POSIX", and then later in your program you find 63that your vendor has been lax and there's no usable C<ICANON> macro after 64all. This could be construed to be a bug. 65 66=head1 FUNCTIONS 67 68=over 8 69 70=item C<_exit> 71 72This is identical to the C function C<_exit()>. It exits the program 73immediately which means among other things buffered I/O is B<not> flushed. 74 75Note that when using threads and in Linux this is B<not> a good way to 76exit a thread because in Linux processes and threads are kind of the 77same thing (Note: while this is the situation in early 2003 there are 78projects under way to have threads with more POSIXly semantics in Linux). 79If you want not to return from a thread, detach the thread. 80 81=item C<abort> 82 83This is identical to the C function C<abort()>. It terminates the 84process with a C<SIGABRT> signal unless caught by a signal handler or 85if the handler does not return normally (it e.g. does a C<longjmp>). 86 87=item C<abs> 88 89This is identical to Perl's builtin C<abs()> function, returning the absolute 90value of its numerical argument (except that C<POSIX::abs()> must be provided 91an explicit value (rather than relying on an implicit C<$_>): 92 93 $absolute_value = POSIX::abs(42); # good 94 95 $absolute_value = POSIX::abs(); # throws exception 96 97=item C<access> 98 99Determines the accessibility of a file. 100 101 if( POSIX::access( "/", &POSIX::R_OK ) ){ 102 print "have read permission\n"; 103 } 104 105Returns C<undef> on failure. Note: do not use C<access()> for 106security purposes. Between the C<access()> call and the operation 107you are preparing for the permissions might change: a classic 108I<race condition>. 109 110=item C<acos> 111 112This is identical to the C function C<acos()>, returning 113the arcus cosine of its numerical argument. See also L<Math::Trig>. 114 115=item C<acosh> 116 117This is identical to the C function C<acosh()>, returning the 118hyperbolic arcus cosine of its numerical argument [C99]. See also 119L<Math::Trig>. Added in Perl v5.22. 120 121=item C<alarm> 122 123This is identical to Perl's builtin C<alarm()> function, either for arming or 124disarming the C<SIGARLM> timer, except that C<POSIX::alarm()> must be provided 125an explicit value (rather than relying on an implicit C<$_>): 126 127 POSIX::alarm(3) # good 128 129 POSIX::alarm() # throws exception 130 131=item C<asctime> 132 133This is identical to the C function C<asctime()>. It returns 134a string of the form 135 136 "Fri Jun 2 18:22:13 2000\n\0" 137 138and it is called thusly 139 140 $asctime = asctime($sec, $min, $hour, $mday, $mon, 141 $year, $wday, $yday, $isdst); 142 143The C<$mon> is zero-based: January equals C<0>. The C<$year> is 1441900-based: 2001 equals C<101>. C<$wday> and C<$yday> default to zero 145(and are usually ignored anyway), and C<$isdst> defaults to -1. 146 147Note the result is always in English. Use C<L</strftime>> instead to 148get a result suitable for the current locale. That function's C<%c> 149format yields the locale's preferred representation. 150 151=item C<asin> 152 153This is identical to the C function C<asin()>, returning 154the arcus sine of its numerical argument. See also L<Math::Trig>. 155 156=item C<asinh> 157 158This is identical to the C function C<asinh()>, returning the 159hyperbolic arcus sine of its numerical argument [C99]. See also 160L<Math::Trig>. Added in Perl v5.22. 161 162=item C<assert> 163 164Unimplemented, but you can use L<perlfunc/die> and the L<Carp> module 165to achieve similar things. 166 167=item C<atan> 168 169This is identical to the C function C<atan()>, returning the 170arcus tangent of its numerical argument. See also L<Math::Trig>. 171 172=item C<atanh> 173 174This is identical to the C function C<atanh()>, returning the 175hyperbolic arcus tangent of its numerical argument [C99]. See also 176L<Math::Trig>. Added in Perl v5.22. 177 178=item C<atan2> 179 180This is identical to Perl's builtin C<atan2()> function, returning 181the arcus tangent defined by its two numerical arguments, the I<y> 182coordinate and the I<x> coordinate. See also L<Math::Trig>. 183 184=item C<atexit> 185 186Not implemented. C<atexit()> is C-specific: use C<END {}> instead, see L<perlmod>. 187 188=item C<atof> 189 190Not implemented. C<atof()> is C-specific. Perl converts strings to numbers transparently. 191If you need to force a scalar to a number, add a zero to it. 192 193=item C<atoi> 194 195Not implemented. C<atoi()> is C-specific. Perl converts strings to numbers transparently. 196If you need to force a scalar to a number, add a zero to it. 197If you need to have just the integer part, see L<perlfunc/int>. 198 199=item C<atol> 200 201Not implemented. C<atol()> is C-specific. Perl converts strings to numbers transparently. 202If you need to force a scalar to a number, add a zero to it. 203If you need to have just the integer part, see L<perlfunc/int>. 204 205=item C<bsearch> 206 207C<bsearch()> not supplied. For doing binary search on wordlists, 208see L<Search::Dict>. 209 210=item C<calloc> 211 212Not implemented. C<calloc()> is C-specific. Perl does memory management transparently. 213 214=item C<cbrt> 215 216The cube root [C99]. Added in Perl v5.22. 217 218=item C<ceil> 219 220This is identical to the C function C<ceil()>, returning the smallest 221integer value greater than or equal to the given numerical argument. 222 223=item C<chdir> 224 225This is identical to Perl's builtin C<chdir()> function, allowing one to 226change the working (default) directory -- see L<perlfunc/chdir> -- with the 227exception that C<POSIX::chdir()> must be provided an explicit value (rather 228than relying on an implicit C<$_>): 229 230 $rv = POSIX::chdir('path/to/dir'); # good 231 232 $rv = POSIX::chdir(); # throws exception 233 234=item C<chmod> 235 236This is identical to Perl's builtin C<chmod()> function, allowing 237one to change file and directory permissions -- see L<perlfunc/chmod> -- with 238the exception that C<POSIX::chmod()> can only change one file at a time 239(rather than a list of files): 240 241 $c = chmod 0664, $file1, $file2; # good 242 243 $c = POSIX::chmod 0664, $file1; # throws exception 244 245 $c = POSIX::chmod 0664, $file1, $file2; # throws exception 246 247As with the built-in C<chmod()>, C<$file> may be a filename or a file 248handle. 249 250=item C<chown> 251 252This is identical to Perl's builtin C<chown()> function, allowing one 253to change file and directory owners and groups, see L<perlfunc/chown>. 254 255=item C<clearerr> 256 257Not implemented. Use the method C<IO::Handle::clearerr()> instead, to reset the error 258state (if any) and EOF state (if any) of the given stream. 259 260=item C<clock> 261 262This is identical to the C function C<clock()>, returning the 263amount of spent processor time in microseconds. 264 265=item C<close> 266 267Close the file. This uses file descriptors such as those obtained by calling 268C<POSIX::open>. 269 270 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 271 POSIX::close( $fd ); 272 273Returns C<undef> on failure. 274 275See also L<perlfunc/close>. 276 277=item C<closedir> 278 279This is identical to Perl's builtin C<closedir()> function for closing 280a directory handle, see L<perlfunc/closedir>. 281 282=item C<cos> 283 284This is identical to Perl's builtin C<cos()> function for returning the cosine 285of its numerical argument -- except that C<POSIX::cos()> must be provided with 286an explicit value (rather than relying on an implicit C<$_>): 287 288 $cosine = POSIX::cos(3); # good 289 290 $cosine = POSIX::cos(); # throws exception 291 292See L<perlfunc/cos>; see also L<Math::Trig>. 293 294=item C<cosh> 295 296This is identical to the C function C<cosh()>, for returning 297the hyperbolic cosine of its numeric argument. See also L<Math::Trig>. 298 299=item C<copysign> 300 301Returns C<x> but with the sign of C<y> [C99]. Added in Perl v5.22. 302 303 $x_with_sign_of_y = POSIX::copysign($x, $y); 304 305See also L</signbit>. 306 307=item C<creat> 308 309Create a new file. This returns a file descriptor like the ones returned by 310C<POSIX::open>. Use C<POSIX::close> to close the file. 311 312 $fd = POSIX::creat( "foo", 0611 ); 313 POSIX::close( $fd ); 314 315See also L<perlfunc/sysopen> and its C<O_CREAT> flag. 316 317=item C<ctermid> 318 319Generates the path name for the controlling terminal. 320 321 $path = POSIX::ctermid(); 322 323=item C<ctime> 324 325This is identical to the C function C<ctime()> and equivalent 326to C<asctime(localtime(...))>, see L</asctime> and L</localtime>. 327 328=item C<cuserid> [POSIX.1-1988] 329 330Get the login name of the owner of the current process. 331 332 $name = POSIX::cuserid(); 333 334Note: this function has not been specified by POSIX since 1990 and is included 335only for backwards compatibility. New code should use L<C<getlogin()>|perlfunc/getlogin> instead. 336 337=item C<difftime> 338 339This is identical to the C function C<difftime()>, for returning 340the time difference (in seconds) between two times (as returned 341by C<time()>), see L</time>. 342 343=item C<div> 344 345Not implemented. C<div()> is C-specific, use L<perlfunc/int> on the usual C</> division and 346the modulus C<%>. 347 348=item C<dup> 349 350This is similar to the C function C<dup()>, for duplicating a file 351descriptor. 352 353This uses file descriptors such as those obtained by calling 354C<POSIX::open>. 355 356Returns C<undef> on failure. 357 358=item C<dup2> 359 360This is similar to the C function C<dup2()>, for duplicating a file 361descriptor to an another known file descriptor. 362 363This uses file descriptors such as those obtained by calling 364C<POSIX::open>. 365 366Returns C<undef> on failure. 367 368=item C<erf> 369 370The error function [C99]. Added in Perl v5.22. 371 372=item C<erfc> 373 374The complementary error function [C99]. Added in Perl v5.22. 375 376=item C<errno> 377 378Returns the value of errno. 379 380 $errno = POSIX::errno(); 381 382This identical to the numerical values of the C<$!>, see L<perlvar/$ERRNO>. 383 384=item C<execl> 385 386Not implemented. C<execl()> is C-specific, see L<perlfunc/exec>. 387 388=item C<execle> 389 390Not implemented. C<execle()> is C-specific, see L<perlfunc/exec>. 391 392=item C<execlp> 393 394Not implemented. C<execlp()> is C-specific, see L<perlfunc/exec>. 395 396=item C<execv> 397 398Not implemented. C<execv()> is C-specific, see L<perlfunc/exec>. 399 400=item C<execve> 401 402Not implemented. C<execve()> is C-specific, see L<perlfunc/exec>. 403 404=item C<execvp> 405 406Not implemented. C<execvp()> is C-specific, see L<perlfunc/exec>. 407 408=item C<exit> 409 410This is identical to Perl's builtin C<exit()> function for exiting the 411program, see L<perlfunc/exit>. 412 413=item C<exp> 414 415This is identical to Perl's builtin C<exp()> function for returning the 416exponent (I<e>-based) of the numerical argument -- except that C<POSIX::exp()> 417must be provided with an explicit value (rather than relying on an implicit 418C<$_>): 419 420 $exp = POSIX::exp(3); # good 421 422 $exp = POSIX::exp(); # throws exception 423 424See L<perlfunc/exp>. 425 426=item C<expm1> 427 428Equivalent to C<exp(x) - 1>, but more precise for small argument values [C99]. 429Added in Perl v5.22. 430 431See also L</log1p>. 432 433=item C<fabs> 434 435This is identical to Perl's builtin C<abs()> function for returning the 436absolute value of the numerical argument -- except that C<POSIX::fabs()> must 437be provided with an explicit value (rather than relying on an implicit C<$_>): 438 439 $absolute_value = POSIX::fabs(3); # good 440 441 $absolute_value = POSIX::fabs(); # throws exception 442 443See L<perlfunc/abs>. 444 445This is identical to Perl's builtin C<cos()> function for returning the cosine 446=item C<fclose> 447 448Not implemented. Use method C<IO::Handle::close()> instead, or see L<perlfunc/close>. 449 450=item C<fcntl> 451 452This is identical to Perl's builtin C<fcntl()> function, 453see L<perlfunc/fcntl>. 454 455=item C<fdopen> 456 457Not implemented. Use method C<IO::Handle::new_from_fd()> instead, or see L<perlfunc/open>. 458 459=item C<feof> 460 461Not implemented. Use method C<IO::Handle::eof()> instead, or see L<perlfunc/eof>. 462 463=item C<ferror> 464 465Not implemented. Use method C<IO::Handle::error()> instead. 466 467=item C<fflush> 468 469Not implemented. Use method C<IO::Handle::flush()> instead. 470See also C<L<perlvar/$OUTPUT_AUTOFLUSH>>. 471 472=item C<fgetc> 473 474Not implemented. Use method C<IO::Handle::getc()> instead, or see L<perlfunc/read>. 475 476=item C<fgetpos> 477 478Not implemented. Use method C<IO::Seekable::getpos()> instead, or see L<perlfunc/seek>. 479 480=item C<fgets> 481 482Not implemented. Use method C<IO::Handle::gets()> instead. Similar to E<lt>E<gt>, also known 483as L<perlfunc/readline>. 484 485=item C<fileno> 486 487Not implemented. Use method C<IO::Handle::fileno()> instead, or see L<perlfunc/fileno>. 488 489=item C<floor> 490 491This is identical to the C function C<floor()>, returning the largest 492integer value less than or equal to the numerical argument. 493 494=item C<fdim> 495 496"Positive difference", S<C<x - y>> if S<C<x E<gt> y>>, zero otherwise [C99]. 497Added in Perl v5.22. 498 499=item C<fegetround> 500 501Returns the current floating point rounding mode, one of 502 503 FE_TONEAREST FE_TOWARDZERO FE_UPWARD FE_DOWNWARD 504 505C<FE_TONEAREST> is like L</round>, C<FE_TOWARDZERO> is like L</trunc> [C99]. 506Added in Perl v5.22. 507 508=item C<fesetround> 509 510Sets the floating point rounding mode, see L</fegetround> [C99]. Added in 511Perl v5.22. 512 513=item C<fma> 514 515"Fused multiply-add", S<C<x * y + z>>, possibly faster (and less lossy) 516than the explicit two operations [C99]. Added in Perl v5.22. 517 518 my $fused = POSIX::fma($x, $y, $z); 519 520=item C<fmax> 521 522Maximum of C<x> and C<y>, except when either is C<NaN>, returns the other [C99]. 523Added in Perl v5.22. 524 525 my $max = POSIX::fmax($x, $y); 526 527=item C<fmin> 528 529Minimum of C<x> and C<y>, except when either is C<NaN>, returns the other [C99]. 530Added in Perl v5.22. 531 532 my $min = POSIX::fmin($x, $y); 533 534=item C<fmod> 535 536This is identical to the C function C<fmod()>. 537 538 $r = fmod($x, $y); 539 540It returns the remainder S<C<$r = $x - $n*$y>>, where S<C<$n = trunc($x/$y)>>. 541The C<$r> has the same sign as C<$x> and magnitude (absolute value) 542less than the magnitude of C<$y>. 543 544=item C<fopen> 545 546Not implemented. Use method C<IO::File::open()> instead, or see L<perlfunc/open>. 547 548=item C<fork> 549 550This is identical to Perl's builtin C<fork()> function 551for duplicating the current process, see L<perlfunc/fork> 552and L<perlfork> if you are in Windows. 553 554=item C<fpathconf> 555 556Retrieves the value of a configurable limit on a file or directory. This 557uses file descriptors such as those obtained by calling C<POSIX::open>. 558 559The following will determine the maximum length of the longest allowable 560pathname on the filesystem which holds F</var/foo>. 561 562 $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY ); 563 $path_max = POSIX::fpathconf($fd, &POSIX::_PC_PATH_MAX); 564 565Returns C<undef> on failure. 566 567=item C<fpclassify> 568 569Returns one of 570 571 FP_NORMAL FP_ZERO FP_SUBNORMAL FP_INFINITE FP_NAN 572 573telling the class of the argument [C99]. C<FP_INFINITE> is positive 574or negative infinity, C<FP_NAN> is not-a-number. C<FP_SUBNORMAL> 575means subnormal numbers (also known as denormals), very small numbers 576with low precision. C<FP_ZERO> is zero. C<FP_NORMAL> is all the rest. 577Added in Perl v5.22. 578 579=item C<fprintf> 580 581Not implemented. C<fprintf()> is C-specific, see L<perlfunc/printf> instead. 582 583=item C<fputc> 584 585Not implemented. C<fputc()> is C-specific, see L<perlfunc/print> instead. 586 587=item C<fputs> 588 589Not implemented. C<fputs()> is C-specific, see L<perlfunc/print> instead. 590 591=item C<fread> 592 593Not implemented. C<fread()> is C-specific, see L<perlfunc/read> instead. 594 595=item C<free> 596 597Not implemented. C<free()> is C-specific. Perl does memory management transparently. 598 599=item C<freopen> 600 601Not implemented. C<freopen()> is C-specific, see L<perlfunc/open> instead. 602 603=item C<frexp> 604 605Return the mantissa and exponent of a floating-point number. 606 607 ($mantissa, $exponent) = POSIX::frexp( 1.234e56 ); 608 609=item C<fscanf> 610 611Not implemented. C<fscanf()> is C-specific, use E<lt>E<gt> and regular expressions instead. 612 613=item C<fseek> 614 615Not implemented. Use method C<IO::Seekable::seek()> instead, or see L<perlfunc/seek>. 616 617=item C<fsetpos> 618 619Not implemented. Use method C<IO::Seekable::setpos()> instead, or seek L<perlfunc/seek>. 620 621=item C<fstat> 622 623Get file status. This uses file descriptors such as those obtained by 624calling C<POSIX::open>. The data returned is identical to the data from 625Perl's builtin C<stat> function. 626 627 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 628 @stats = POSIX::fstat( $fd ); 629 630=item C<fsync> 631 632Not implemented. Use method C<IO::Handle::sync()> instead. 633 634=item C<ftell> 635 636Not implemented. Use method C<IO::Seekable::tell()> instead, or see L<perlfunc/tell>. 637 638=item C<fwrite> 639 640Not implemented. C<fwrite()> is C-specific, see L<perlfunc/print> instead. 641 642=item C<getc> 643 644This is identical to Perl's builtin C<getc()> function, 645see L<perlfunc/getc>. 646 647=item C<getchar> 648 649Returns one character from STDIN. Identical to Perl's C<getc()>, 650see L<perlfunc/getc>. 651 652=item C<getcwd> 653 654Returns the name of the current working directory. 655See also L<Cwd>. 656 657=item C<getegid> 658 659Returns the effective group identifier. Similar to Perl' s builtin 660variable C<$(>, see L<perlvar/$EGID>. 661 662=item C<getenv> 663 664Returns the value of the specified environment variable. 665The same information is available through the C<%ENV> array. 666 667=item C<geteuid> 668 669Returns the effective user identifier. Identical to Perl's builtin C<$E<gt>> 670variable, see L<perlvar/$EUID>. 671 672=item C<getgid> 673 674Returns the user's real group identifier. Similar to Perl's builtin 675variable C<$)>, see L<perlvar/$GID>. 676 677=item C<getgrgid> 678 679This is identical to Perl's builtin C<getgrgid()> function for 680returning group entries by group identifiers, see 681L<perlfunc/getgrgid>. 682 683=item C<getgrnam> 684 685This is identical to Perl's builtin C<getgrnam()> function for 686returning group entries by group names, see L<perlfunc/getgrnam>. 687 688=item C<getgroups> 689 690Returns the ids of the user's supplementary groups. Similar to Perl's 691builtin variable C<$)>, see L<perlvar/$GID>. 692 693=item C<getlogin> 694 695This is identical to Perl's builtin C<getlogin()> function for 696returning the user name associated with the current session, see 697L<perlfunc/getlogin>. 698 699=item C<getpayload> 700 701 use POSIX ':nan_payload'; 702 getpayload($var) 703 704Returns the C<NaN> payload. Added in Perl v5.24. 705 706Note the API instability warning in L</setpayload>. 707 708See L</nan> for more discussion about C<NaN>. 709 710=item C<getpgrp> 711 712This is identical to Perl's builtin C<getpgrp()> function for 713returning the process group identifier of the current process, see 714L<perlfunc/getpgrp>. 715 716=item C<getpid> 717 718Returns the process identifier. Identical to Perl's builtin 719variable C<$$>, see L<perlvar/$PID>. 720 721=item C<getppid> 722 723This is identical to Perl's builtin C<getppid()> function for 724returning the process identifier of the parent process of the current 725process , see L<perlfunc/getppid>. 726 727=item C<getpwnam> 728 729This is identical to Perl's builtin C<getpwnam()> function for 730returning user entries by user names, see L<perlfunc/getpwnam>. 731 732=item C<getpwuid> 733 734This is identical to Perl's builtin C<getpwuid()> function for 735returning user entries by user identifiers, see L<perlfunc/getpwuid>. 736 737=item C<gets> 738 739Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known 740as the C<readline()> function, see L<perlfunc/readline>. 741 742B<NOTE>: if you have C programs that still use C<gets()>, be very 743afraid. The C<gets()> function is a source of endless grief because 744it has no buffer overrun checks. It should B<never> be used. The 745C<fgets()> function should be preferred instead. 746 747=item C<getuid> 748 749Returns the user's identifier. Identical to Perl's builtin C<$E<lt>> variable, 750see L<perlvar/$UID>. 751 752=item C<gmtime> 753 754This is identical to Perl's builtin C<gmtime()> function for 755converting seconds since the epoch to a date in Greenwich Mean Time, 756see L<perlfunc/gmtime>. 757 758=item C<hypot> 759 760Equivalent to C<S<sqrt(x * x + y * y)>> except more stable on very large 761or very small arguments [C99]. Added in Perl v5.22. 762 763=item C<ilogb> 764 765Integer binary logarithm [C99]. Added in Perl v5.22. 766 767For example C<ilogb(20)> is 4, as an integer. 768 769See also L</logb>. 770 771=item C<Inf> 772 773The infinity as a constant: 774 775 use POSIX qw(Inf); 776 my $pos_inf = +Inf; # Or just Inf. 777 my $neg_inf = -Inf; 778 779See also L</isinf>, and L</fpclassify>. 780 781=item C<isalnum> 782 783This function has been removed as of Perl v5.24. It was very similar to 784matching against S<C<qr/ ^ [[:alnum:]]+ $ /x>>, which you should convert 785to use instead. See L<perlrecharclass/POSIX Character Classes>. 786 787=item C<isalpha> 788 789This function has been removed as of Perl v5.24. It was very similar to 790matching against S<C<qr/ ^ [[:alpha:]]+ $ /x>>, which you should convert 791to use instead. See L<perlrecharclass/POSIX Character Classes>. 792 793=item C<isatty> 794 795Returns a boolean indicating whether the specified filehandle is connected 796to a tty. Similar to the C<-t> operator, see L<perlfunc/-X>. 797 798=item C<iscntrl> 799 800This function has been removed as of Perl v5.24. It was very similar to 801matching against S<C<qr/ ^ [[:cntrl:]]+ $ /x>>, which you should convert 802to use instead. See L<perlrecharclass/POSIX Character Classes>. 803 804=item C<isdigit> 805 806This function has been removed as of Perl v5.24. It was very similar to 807matching against S<C<qr/ ^ [[:digit:]]+ $ /x>>, which you should convert 808to use instead. See L<perlrecharclass/POSIX Character Classes>. 809 810=item C<isfinite> 811 812Returns true if the argument is a finite number (that is, not an 813infinity, or the not-a-number) [C99]. Added in Perl v5.22. 814 815See also L</isinf>, L</isnan>, and L</fpclassify>. 816 817=item C<isgraph> 818 819This function has been removed as of Perl v5.24. It was very similar to 820matching against S<C<qr/ ^ [[:graph:]]+ $ /x>>, which you should convert 821to use instead. See L<perlrecharclass/POSIX Character Classes>. 822 823=item C<isgreater> 824 825(Also C<isgreaterequal>, C<isless>, C<islessequal>, C<islessgreater>, 826C<isunordered>) 827 828Floating point comparisons which handle the C<NaN> [C99]. Added in Perl 829v5.22. 830 831=item C<isinf> 832 833Returns true if the argument is an infinity (positive or negative) [C99]. 834Added in Perl v5.22. 835 836See also L</Inf>, L</isnan>, L</isfinite>, and L</fpclassify>. 837 838=item C<islower> 839 840This function has been removed as of Perl v5.24. It was very similar to 841matching against S<C<qr/ ^ [[:lower:]]+ $ /x>>, which you should convert 842to use instead. See L<perlrecharclass/POSIX Character Classes>. 843 844=item C<isnan> 845 846Returns true if the argument is C<NaN> (not-a-number) [C99]. Added in 847Perl v5.22. 848 849Note that you can also test for "C<NaN>-ness" with 850L<equality operators|perlop/"Equality Operators"> (C<==> or C<!=>), as in 851 852 print "x is not a NaN\n" if $x == $x; 853 854since the C<NaN> is not equal to anything, B<including itself>. 855 856See also L</nan>, L</NaN>, L</isinf>, and L</fpclassify>. 857 858=item C<isnormal> 859 860Returns true if the argument is normal (that is, not a subnormal/denormal, 861and not an infinity, or a not-a-number) [C99]. Added in Perl v5.22. 862 863See also L</isfinite>, and L</fpclassify>. 864 865=item C<isprint> 866 867This function has been removed as of Perl v5.24. It was very similar to 868matching against S<C<qr/ ^ [[:print:]]+ $ /x>>, which you should convert 869to use instead. See L<perlrecharclass/POSIX Character Classes>. 870 871=item C<ispunct> 872 873This function has been removed as of Perl v5.24. It was very similar to 874matching against S<C<qr/ ^ [[:punct:]]+ $ /x>>, which you should convert 875to use instead. See L<perlrecharclass/POSIX Character Classes>. 876 877=item C<issignaling> 878 879 use POSIX ':nan_payload'; 880 issignaling($var, $payload) 881 882Return true if the argument is a I<signaling> NaN. Added in Perl v5.24. 883 884Note the API instability warning in L</setpayload>. 885 886See L</nan> for more discussion about C<NaN>. 887 888=item C<isspace> 889 890This function has been removed as of Perl v5.24. It was very similar to 891matching against S<C<qr/ ^ [[:space:]]+ $ /x>>, which you should convert 892to use instead. See L<perlrecharclass/POSIX Character Classes>. 893 894=item C<isupper> 895 896This function has been removed as of Perl v5.24. It was very similar to 897matching against S<C<qr/ ^ [[:upper:]]+ $ /x>>, which you should convert 898to use instead. See L<perlrecharclass/POSIX Character Classes>. 899 900=item C<isxdigit> 901 902This function has been removed as of Perl v5.24. It was very similar to 903matching against S<C<qr/ ^ [[:xdigit:]]+ $ /x>>, which you should 904convert to use instead. See L<perlrecharclass/POSIX Character Classes>. 905 906=item C<j0> 907 908=item C<j1> 909 910=item C<jn> 911 912=item C<y0> 913 914=item C<y1> 915 916=item C<yn> 917 918The Bessel function of the first kind of the order zero. 919 920=item C<kill> 921 922This is identical to Perl's builtin C<kill()> function for sending 923signals to processes (often to terminate them), see L<perlfunc/kill>. 924 925=item C<labs> 926 927Not implemented. (For returning absolute values of long integers.) 928C<labs()> is C-specific, see L<perlfunc/abs> instead. 929 930=item C<lchown> 931 932This is identical to the C function, except the order of arguments is 933consistent with Perl's builtin C<chown()> with the added restriction 934of only one path, not a list of paths. Does the same thing as the 935C<chown()> function but changes the owner of a symbolic link instead 936of the file the symbolic link points to. 937 938 POSIX::lchown($uid, $gid, $file_path); 939 940=item C<ldexp> 941 942This is identical to the C function C<ldexp()> 943for multiplying floating point numbers with powers of two. 944 945 $x_quadrupled = POSIX::ldexp($x, 2); 946 947=item C<ldiv> 948 949Not implemented. (For computing dividends of long integers.) 950C<ldiv()> is C-specific, use C</> and C<int()> instead. 951 952=item C<lgamma> 953 954The logarithm of the Gamma function [C99]. Added in Perl v5.22. 955 956See also L</tgamma>. 957 958=item C<log1p> 959 960Equivalent to S<C<log(1 + x)>>, but more stable results for small argument 961values [C99]. Added in Perl v5.22. 962 963=item C<log2> 964 965Logarithm base two [C99]. Added in Perl v5.22. 966 967See also L</expm1>. 968 969=item C<logb> 970 971Integer binary logarithm [C99]. Added in Perl v5.22. 972 973For example C<logb(20)> is 4, as a floating point number. 974 975See also L</ilogb>. 976 977=item C<link> 978 979This is identical to Perl's builtin C<link()> function 980for creating hard links into files, see L<perlfunc/link>. 981 982=item C<localeconv> 983 984Get numeric formatting information. Returns a reference to a hash 985containing the formatting values of the locale that currently underlies 986the program, regardless of whether or not it is called from within the 987scope of a S<C<use locale>>. Users of this function should also read 988L<perllocale>, which provides a comprehensive discussion of Perl locale 989handling, including 990L<a section devoted to this function|perllocale/The localeconv function>. 991Prior to Perl 5.28, or when operating in a non thread-safe environment, 992it should not be used in a threaded application unless it's certain that 993the underlying locale is C or POSIX. This is because it otherwise 994changes the locale, which globally affects all threads simultaneously. 995Windows platforms starting with Visual Studio 2005 are mostly 996thread-safe, but use of this function in those prior to Visual Studio 9972015 can have a race with a thread that has called 998L<perlapi/switch_to_global_locale>. 999 1000Here is how to query the database for the B<de> (Deutsch or German) locale. 1001 1002 my $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); 1003 print "Locale: \"$loc\"\n"; 1004 my $lconv = POSIX::localeconv(); 1005 foreach my $property (qw( 1006 decimal_point 1007 thousands_sep 1008 grouping 1009 int_curr_symbol 1010 currency_symbol 1011 mon_decimal_point 1012 mon_thousands_sep 1013 mon_grouping 1014 positive_sign 1015 negative_sign 1016 int_frac_digits 1017 frac_digits 1018 p_cs_precedes 1019 p_sep_by_space 1020 n_cs_precedes 1021 n_sep_by_space 1022 p_sign_posn 1023 n_sign_posn 1024 int_p_cs_precedes 1025 int_p_sep_by_space 1026 int_n_cs_precedes 1027 int_n_sep_by_space 1028 int_p_sign_posn 1029 int_n_sign_posn 1030 )) 1031 { 1032 printf qq(%s: "%s",\n), 1033 $property, $lconv->{$property}; 1034 } 1035 1036The members whose names begin with C<int_p_> and C<int_n_> were added by 1037POSIX.1-2008 and are only available on systems that support them. 1038 1039A value of -1 returned for numeric entries indicates that the field is 1040not applicable to the locale. This is rare except in the C and related 1041locales, which don't have most monetary values defined. It can also 1042happen, quirkily, in fields that are otherwise boolean to indicate that 1043the value is kind of neither true nor false. This happens in C<p_cs_precedes> 1044and C<int_p_cs_precedes> when the currency symbol neither precedes nor 1045succeeds a positive value but is infixed, by replacing the radix 1046character. 1047 1048Prior to Perl v5.37.7, empty string fields and numeric fields with value 1049-1 were omittted from the returned hash. 1050 1051=item C<localtime> 1052 1053This is identical to Perl's builtin C<localtime()> function for 1054converting seconds since the epoch to a date see L<perlfunc/localtime> except 1055that C<POSIX::localtime()> must be provided an explicit value (rather than 1056relying on an implicit C<$_>): 1057 1058 @localtime = POSIX::localtime(time); # good 1059 1060 @localtime = localtime(); # good 1061 1062 @localtime = POSIX::localtime(); # throws exception 1063 1064=item C<log> 1065 1066This is identical to Perl's builtin C<log()> function for returning the 1067natural (I<e>-based) logarithm of the numerical argument -- except that 1068C<POSIX::log()> must be provided with an explicit value (rather than relying 1069on an implicit C<$_>): 1070 1071 $log = POSIX::log(3); # good 1072 1073 $log = POSIX::log(); # throws exception 1074 1075See L<perlfunc/log>. 1076 1077=item C<log10> 1078 1079This is identical to the C function C<log10()>, 1080returning the 10-base logarithm of the numerical argument. 1081You can also use 1082 1083 sub log10 { log($_[0]) / log(10) } 1084 1085or 1086 1087 sub log10 { log($_[0]) / 2.30258509299405 } 1088 1089or 1090 1091 sub log10 { log($_[0]) * 0.434294481903252 } 1092 1093=item C<longjmp> 1094 1095Not implemented. C<longjmp()> is C-specific: use L<perlfunc/die> instead. 1096 1097=item C<lseek> 1098 1099Move the file's read/write position. This uses file descriptors such as 1100those obtained by calling C<POSIX::open>. 1101 1102 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 1103 $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET ); 1104 1105Returns C<undef> on failure. 1106 1107=item C<lrint> 1108 1109Depending on the current floating point rounding mode, rounds the 1110argument either toward nearest (like L</round>), toward zero (like 1111L</trunc>), downward (toward negative infinity), or upward (toward 1112positive infinity) [C99]. Added in Perl v5.22. 1113 1114For the rounding mode, see L</fegetround>. 1115 1116=item C<lround> 1117 1118Like L</round>, but as integer, as opposed to floating point [C99]. Added 1119in Perl v5.22. 1120 1121See also L</ceil>, L</floor>, L</trunc>. 1122 1123Owing to an oversight, this is not currently exported by default, or as part of 1124the C<:math_h_c99> export tag; importing it must therefore be done by explicit 1125name. 1126 1127=item C<malloc> 1128 1129Not implemented. C<malloc()> is C-specific. Perl does memory management transparently. 1130 1131=item C<mblen> 1132 1133This is the same as the C function C<mblen()> on unthreaded perls. On 1134threaded perls, it transparently (almost) substitutes the more 1135thread-safe L<C<mbrlen>(3)>, if available, instead of C<mblen>. 1136 1137Core Perl does not have any support for wide and multibyte locales, 1138except Unicode UTF-8 locales. This function, in conjunction with 1139L</mbtowc> and L</wctomb> may be used to roll your own decoding/encoding 1140of other types of multi-byte locales. 1141 1142Use C<undef> as the first parameter to this function to get the effect 1143of passing NULL as the first parameter to C<mblen>. This resets any 1144shift state to its initial value. The return value is undefined if 1145C<mbrlen> was substituted, so you should never rely on it. 1146 1147When the first parameter is a scalar containing a value that either is a 1148PV string or can be forced into one, the return value is the number of 1149bytes occupied by the first character of that string; or 0 if that first 1150character is the wide NUL character; or negative if there is an error. 1151This is based on the locale that currently underlies the program, 1152regardless of whether or not the function is called from Perl code that 1153is within the scope of S<C<use locale>>. Perl makes no attempt at 1154hiding from your code any differences in the C<errno> setting between 1155C<mblen> and C<mbrlen>. It does set C<errno> to 0 before calling them. 1156 1157The optional second parameter is ignored if it is larger than the 1158actual length of the first parameter string. 1159 1160=item C<mbtowc> 1161 1162This is the same as the C function C<mbtowc()> on unthreaded perls. On 1163threaded perls, it transparently (almost) substitutes the more 1164thread-safe L<C<mbrtowc>(3)>, if available, instead of C<mbtowc>. 1165 1166Core Perl does not have any support for wide and multibyte locales, 1167except Unicode UTF-8 locales. This function, in conjunction with 1168L</mblen> and L</wctomb> may be used to roll your own decoding/encoding 1169of other types of multi-byte locales. 1170 1171The first parameter is a scalar into which, upon success, the wide 1172character represented by the multi-byte string contained in the second 1173parameter is stored. The optional third parameter is ignored if it is 1174larger than the actual length of the second parameter string. 1175 1176Use C<undef> as the second parameter to this function to get the effect 1177of passing NULL as the second parameter to C<mbtowc>. This ignores the 1178first parameter, and resets any shift state to its initial value. The 1179return value is undefined if C<mbrtowc> was substituted, so you should 1180never rely on it. 1181 1182When the second parameter is a scalar containing a value that either is 1183a PV string or can be forced into one, the return value is the number of 1184bytes occupied by the first character of that string; or 0 if that first 1185character is the wide NUL character; or negative if there is an error. 1186This is based on the locale that currently underlies the program, 1187regardless of whether or not the function is called from Perl code that 1188is within the scope of S<C<use locale>>. Perl makes no attempt at 1189hiding from your code any differences in the C<errno> setting between 1190C<mbtowc> and C<mbrtowc>. It does set C<errno> to 0 before calling 1191them. 1192 1193=item C<memchr> 1194 1195Not implemented. C<memchr()> is C-specific, see L<perlfunc/index> instead. 1196 1197=item C<memcmp> 1198 1199Not implemented. C<memcmp()> is C-specific, use C<eq> instead, see L<perlop>. 1200 1201=item C<memcpy> 1202 1203Not implemented. C<memcpy()> is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. 1204 1205=item C<memmove> 1206 1207Not implemented. C<memmove()> is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. 1208 1209=item C<memset> 1210 1211Not implemented. C<memset()> is C-specific, use C<x> instead, see L<perlop>. 1212 1213=item C<mkdir> 1214 1215This is identical to Perl's builtin C<mkdir()> function 1216for creating directories, see L<perlfunc/mkdir>. 1217 1218=item C<mkfifo> 1219 1220This is similar to the C function C<mkfifo()> for creating 1221FIFO special files. 1222 1223 if (mkfifo($path, $mode)) { .... 1224 1225Returns C<undef> on failure. The C<$mode> is similar to the 1226mode of C<mkdir()>, see L<perlfunc/mkdir>, though for C<mkfifo> 1227you B<must> specify the C<$mode>. 1228 1229=item C<mktime> 1230 1231Convert date/time info to a calendar time. 1232 1233Synopsis: 1234 1235 mktime(sec, min, hour, mday, mon, year, wday = 0, 1236 yday = 0, isdst = -1) 1237 1238The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero, 1239I<i.e.>, January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The 1240year (C<year>) is given in years since 1900; I<i.e.>, the year 1995 is 95; the 1241year 2001 is 101. Consult your system's C<mktime()> manpage for details 1242about these and the other arguments. 1243 1244Calendar time for December 12, 1995, at 10:30 am. 1245 1246 $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); 1247 print "Date = ", POSIX::ctime($time_t); 1248 1249Returns C<undef> on failure. 1250 1251=item C<modf> 1252 1253Return the integral and fractional parts of a floating-point number. 1254 1255 ($fractional, $integral) = POSIX::modf( 3.14 ); 1256 1257See also L</round>. 1258 1259=item C<NaN> 1260 1261The not-a-number as a constant: 1262 1263 use POSIX qw(NaN); 1264 my $nan = NaN; 1265 1266See also L</nan>, C</isnan>, and L</fpclassify>. 1267 1268=item C<nan> 1269 1270 my $nan = nan(); 1271 1272Returns C<NaN>, not-a-number [C99]. Added in Perl v5.22. 1273 1274The returned NaN is always a I<quiet> NaN, as opposed to I<signaling>. 1275 1276With an argument, can be used to generate a NaN with I<payload>. 1277The argument is first interpreted as a floating point number, 1278but then any fractional parts are truncated (towards zero), 1279and the value is interpreted as an unsigned integer. 1280The bits of this integer are stored in the unused bits of the NaN. 1281 1282The result has a dual nature: it is a NaN, but it also carries 1283the integer inside it. The integer can be retrieved with L</getpayload>. 1284Note, though, that the payload is not propagated, not even on copies, 1285and definitely not in arithmetic operations. 1286 1287How many bits fit in the NaN depends on what kind of floating points 1288are being used, but on the most common platforms (64-bit IEEE 754, 1289or the x86 80-bit long doubles) there are 51 and 61 bits available, 1290respectively. (There would be 52 and 62, but the quiet/signaling 1291bit of NaNs takes away one.) However, because of the floating-point-to- 1292integer-and-back conversions, please test carefully whether you get back 1293what you put in. If your integers are only 32 bits wide, you probably 1294should not rely on more than 32 bits of payload. 1295 1296Whether a "signaling" NaN is in any way different from a "quiet" NaN, 1297depends on the platform. Also note that the payload of the default 1298NaN (no argument to nan()) is not necessarily zero, use C<setpayload> 1299to explicitly set the payload. On some platforms like the 32-bit x86, 1300(unless using the 80-bit long doubles) the signaling bit is not supported 1301at all. 1302 1303See also L</isnan>, L</NaN>, L</setpayload> and L</issignaling>. 1304 1305=item C<nearbyint> 1306 1307Returns the nearest integer to the argument, according to the current 1308rounding mode (see L</fegetround>) [C99]. Added in Perl v5.22. 1309 1310=item C<nextafter> 1311 1312Returns the next representable floating point number after C<x> in the 1313direction of C<y> [C99]. Added in Perl v5.22. 1314 1315 my $nextafter = POSIX::nextafter($x, $y); 1316 1317Like L</nexttoward>, but potentially less accurate. 1318 1319=item C<nexttoward> 1320 1321Returns the next representable floating point number after C<x> in the 1322direction of C<y> [C99]. Added in Perl v5.22. 1323 1324 my $nexttoward = POSIX::nexttoward($x, $y); 1325 1326Like L</nextafter>, but potentially more accurate. 1327 1328=item C<nice> 1329 1330This is similar to the C function C<nice()>, for changing 1331the scheduling preference of the current process. Positive 1332arguments mean a more polite process, negative values a more 1333needy process. Normal (non-root) user processes can only change towards 1334being more polite. 1335 1336Returns C<undef> on failure. 1337 1338=item C<offsetof> 1339 1340Not implemented. C<offsetof()> is C-specific, you probably want to see L<perlfunc/pack> instead. 1341 1342=item C<open> 1343 1344Open a file for reading for writing. This returns file descriptors, not 1345Perl filehandles. Use C<POSIX::close> to close the file. 1346 1347Open a file read-only with mode 0666. 1348 1349 $fd = POSIX::open( "foo" ); 1350 1351Open a file for read and write. 1352 1353 $fd = POSIX::open( "foo", &POSIX::O_RDWR ); 1354 1355Open a file for write, with truncation. 1356 1357 $fd = POSIX::open( 1358 "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC 1359 ); 1360 1361Create a new file with mode 0640. Set up the file for writing. 1362 1363 $fd = POSIX::open( 1364 "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 1365 ); 1366 1367Returns C<undef> on failure. 1368 1369See also L<perlfunc/sysopen>. 1370 1371=item C<opendir> 1372 1373Open a directory for reading. 1374 1375 $dir = POSIX::opendir( "/var" ); 1376 @files = POSIX::readdir( $dir ); 1377 POSIX::closedir( $dir ); 1378 1379Returns C<undef> on failure. 1380 1381=item C<pathconf> 1382 1383Retrieves the value of a configurable limit on a file or directory. 1384 1385The following will determine the maximum length of the longest allowable 1386pathname on the filesystem which holds C</var>. 1387 1388 $path_max = POSIX::pathconf( "/var", 1389 &POSIX::_PC_PATH_MAX ); 1390 1391Returns C<undef> on failure. 1392 1393=item C<pause> 1394 1395This is similar to the C function C<pause()>, which suspends 1396the execution of the current process until a signal is received. 1397 1398Returns C<undef> on failure. 1399 1400=item C<perror> 1401 1402This is identical to the C function C<perror()>, which outputs to the 1403standard error stream the specified message followed by C<": "> and the 1404current error string. Use the C<warn()> function and the C<$!> 1405variable instead, see L<perlfunc/warn> and L<perlvar/$ERRNO>. 1406 1407=item C<pipe> 1408 1409Create an interprocess channel. This returns file descriptors like those 1410returned by C<POSIX::open>. 1411 1412 my ($read, $write) = POSIX::pipe(); 1413 POSIX::write( $write, "hello", 5 ); 1414 POSIX::read( $read, $buf, 5 ); 1415 1416See also L<perlfunc/pipe>. 1417 1418=item C<pow> 1419 1420Computes C<$x> raised to the power C<$exponent>. 1421 1422 $ret = POSIX::pow( $x, $exponent ); 1423 1424You can also use the C<**> operator, see L<perlop>. 1425 1426=item C<printf> 1427 1428Formats and prints the specified arguments to C<STDOUT>. 1429See also L<perlfunc/printf>. 1430 1431=item C<putc> 1432 1433Not implemented. C<putc()> is C-specific, see L<perlfunc/print> instead. 1434 1435=item C<putchar> 1436 1437Not implemented. C<putchar()> is C-specific, see L<perlfunc/print> instead. 1438 1439=item C<puts> 1440 1441Not implemented. C<puts()> is C-specific, see L<perlfunc/print> instead. 1442 1443=item C<qsort> 1444 1445Not implemented. C<qsort()> is C-specific, see L<perlfunc/sort> instead. 1446 1447=item C<raise> 1448 1449Sends the specified signal to the current process. 1450See also L<perlfunc/kill> and the C<$$> in L<perlvar/$PID>. 1451 1452=item C<rand> 1453 1454Not implemented. C<rand()> is non-portable, see L<perlfunc/rand> instead. 1455 1456=item C<read> 1457 1458Read from a file. This uses file descriptors such as those obtained by 1459calling C<POSIX::open>. If the buffer C<$buf> is not large enough for the 1460read then Perl will extend it to make room for the request. 1461 1462 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 1463 $bytes = POSIX::read( $fd, $buf, 3 ); 1464 1465Returns C<undef> on failure. 1466 1467See also L<perlfunc/sysread>. 1468 1469=item C<readdir> 1470 1471This is identical to Perl's builtin C<readdir()> function 1472for reading directory entries, see L<perlfunc/readdir>. 1473 1474=item C<realloc> 1475 1476Not implemented. C<realloc()> is C-specific. Perl does memory management transparently. 1477 1478=item C<remainder> 1479 1480Given C<x> and C<y>, returns the value S<C<x - n*y>>, where C<n> is the integer 1481closest to C<x>/C<y> [C99]. Added in Perl v5.22. 1482 1483 my $remainder = POSIX::remainder($x, $y) 1484 1485See also L</remquo>. 1486 1487=item C<remove> 1488 1489Deletes a name from the filesystem. Calls L<perlfunc/unlink> for 1490files and L<perlfunc/rmdir> for directories. 1491 1492=item C<remquo> 1493 1494Like L</remainder> but also returns the low-order bits of the quotient (n) 1495[C99]. Added in Perl v5.22. 1496 1497(This is quite esoteric interface, mainly used to implement numerical 1498algorithms.) 1499 1500=item C<rename> 1501 1502This is identical to Perl's builtin C<rename()> function 1503for renaming files, see L<perlfunc/rename>. 1504 1505=item C<rewind> 1506 1507Seeks to the beginning of the file. 1508 1509=item C<rewinddir> 1510 1511This is identical to Perl's builtin C<rewinddir()> function for 1512rewinding directory entry streams, see L<perlfunc/rewinddir>. 1513 1514=item C<rint> 1515 1516Identical to L</lrint>. 1517 1518=item C<rmdir> 1519 1520This is identical to Perl's builtin C<rmdir()> function 1521for removing (empty) directories, see L<perlfunc/rmdir>. 1522 1523=item C<round> 1524 1525Returns the integer (but still as floating point) nearest to the 1526argument [C99]. Added in Perl v5.22. 1527 1528See also L</ceil>, L</floor>, L</lround>, L</modf>, and L</trunc>. 1529 1530=item C<scalbn> 1531 1532Returns S<C<x * 2**y>> [C99]. Added in Perl v5.22. 1533 1534See also L</frexp> and L</ldexp>. 1535 1536=item C<scanf> 1537 1538Not implemented. C<scanf()> is C-specific, use E<lt>E<gt> and regular expressions instead, 1539see L<perlre>. 1540 1541=item C<setgid> 1542 1543Sets the real group identifier and the effective group identifier for 1544this process. Similar to assigning a value to the Perl's builtin 1545C<$)> variable, see L<perlvar/$EGID>, except that the latter 1546will change only the real user identifier, and that the setgid() 1547uses only a single numeric argument, as opposed to a space-separated 1548list of numbers. 1549 1550=item C<setjmp> 1551 1552Not implemented. C<setjmp()> is C-specific: use C<eval {}> instead, 1553see L<perlfunc/eval>. 1554 1555=item C<setlocale> 1556 1557WARNING! Prior to Perl 5.28 or on a system that does not support 1558thread-safe locale operations, do NOT use this function in a 1559L<thread|threads>. The locale will change in all other threads at the 1560same time, and should your thread get paused by the operating system, 1561and another started, that thread will not have the locale it is 1562expecting. On some platforms, there can be a race leading to segfaults 1563if two threads call this function nearly simultaneously. This warning 1564does not apply on unthreaded builds, or on perls where 1565C<${^SAFE_LOCALES}> exists and is non-zero; namely Perl 5.28 and later 1566compiled to be locale-thread-safe. 1567 1568This function 1569modifies and queries the program's underlying locale. Users of this 1570function should read L<perllocale>, whch provides a comprehensive 1571discussion of Perl locale handling, knowledge of which is necessary to 1572properly use this function. It contains 1573L<a section devoted to this function|perllocale/The setlocale function>. 1574The discussion here is merely a summary reference for C<setlocale()>. 1575Note that Perl itself is almost entirely unaffected by the locale 1576except within the scope of S<C<"use locale">>. (Exceptions are listed 1577in L<perllocale/Not within the scope of "use locale">, and 1578locale-dependent functions within the POSIX module ARE always affected 1579by the current locale.) 1580 1581The following examples assume 1582 1583 use POSIX qw(setlocale LC_ALL LC_CTYPE); 1584 1585has been issued. 1586 1587The following will set the traditional UNIX system locale behavior 1588(the second argument C<"C">). 1589 1590 $loc = setlocale( LC_ALL, "C" ); 1591 1592The following will query the current C<LC_CTYPE> category. (No second 1593argument means 'query'.) 1594 1595 $loc = setlocale( LC_CTYPE ); 1596 1597The following will set the C<LC_CTYPE> behaviour according to the locale 1598environment variables (the second argument C<"">). 1599Please see your system's C<setlocale(3)> documentation for the locale 1600environment variables' meaning or consult L<perllocale>. 1601 1602 $loc = setlocale( LC_CTYPE, "" ); 1603 1604The following will set the C<LC_COLLATE> behaviour to Argentinian 1605Spanish. B<NOTE>: The naming and availability of locales depends on 1606your operating system. Please consult L<perllocale> for how to find 1607out which locales are available in your system. 1608 1609 $loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" ); 1610 1611=item C<setpayload> 1612 1613 use POSIX ':nan_payload'; 1614 setpayload($var, $payload); 1615 1616Sets the C<NaN> payload of var. Added in Perl v5.24. 1617 1618NOTE: the NaN payload APIs are based on the latest (as of June 2015) 1619proposed ISO C interfaces, but they are not yet a standard. Things 1620may change. 1621 1622See L</nan> for more discussion about C<NaN>. 1623 1624See also L</setpayloadsig>, L</isnan>, L</getpayload>, and L</issignaling>. 1625 1626=item C<setpayloadsig> 1627 1628 use POSIX ':nan_payload'; 1629 setpayloadsig($var, $payload); 1630 1631Like L</setpayload> but also makes the NaN I<signaling>. Added in Perl 1632v5.24. 1633 1634Depending on the platform the NaN may or may not behave differently. 1635 1636Note the API instability warning in L</setpayload>. 1637 1638Note that because how the floating point formats work out, on the most 1639common platforms signaling payload of zero is best avoided, 1640since it might end up being identical to C<+Inf>. 1641 1642See also L</nan>, L</isnan>, L</getpayload>, and L</issignaling>. 1643 1644=item C<setpgid> 1645 1646This is similar to the C function C<setpgid()> for 1647setting the process group identifier of the current process. 1648 1649Returns C<undef> on failure. 1650 1651=item C<setsid> 1652 1653This is identical to the C function C<setsid()> for 1654setting the session identifier of the current process. 1655 1656=item C<setuid> 1657 1658Sets the real user identifier and the effective user identifier for 1659this process. Similar to assigning a value to the Perl's builtin 1660C<$E<lt>> variable, see L<perlvar/$UID>, except that the latter 1661will change only the real user identifier. 1662 1663=item C<sigaction> 1664 1665Detailed signal management. This uses C<POSIX::SigAction> objects for 1666the C<action> and C<oldaction> arguments (the oldaction can also be 1667just a hash reference). Consult your system's C<sigaction> manpage 1668for details, see also L</POSIX::SigRt>. 1669 1670Synopsis: 1671 1672 sigaction(signal, action, oldaction = 0) 1673 1674Returns C<undef> on failure. The C<signal> must be a number (like 1675C<SIGHUP>), not a string (like C<"SIGHUP">), though Perl does try hard 1676to understand you. 1677 1678If you use the C<SA_SIGINFO> flag, the signal handler will in addition to 1679the first argument, the signal name, also receive a second argument, a 1680hash reference, inside which are the following keys with the following 1681semantics, as defined by POSIX/SUSv3: 1682 1683 signo the signal number 1684 errno the error number 1685 code if this is zero or less, the signal was sent by 1686 a user process and the uid and pid make sense, 1687 otherwise the signal was sent by the kernel 1688 1689The constants for specific C<code> values can be imported individually 1690or using the C<:signal_h_si_code> tag, since Perl v5.24. 1691 1692The following are also defined by POSIX/SUSv3, but unfortunately 1693not very widely implemented: 1694 1695 pid the process id generating the signal 1696 uid the uid of the process id generating the signal 1697 status exit value or signal for SIGCHLD 1698 band band event for SIGPOLL 1699 addr address of faulting instruction or memory 1700 reference for SIGILL, SIGFPE, SIGSEGV or SIGBUS 1701 1702A third argument is also passed to the handler, which contains a copy 1703of the raw binary contents of the C<siginfo> structure: if a system has 1704some non-POSIX fields, this third argument is where to C<unpack()> them 1705from. 1706 1707Note that not all C<siginfo> values make sense simultaneously (some are 1708valid only for certain signals, for example), and not all values make 1709sense from Perl perspective, you should to consult your system's 1710C<sigaction> and possibly also C<siginfo> documentation. 1711 1712=item C<siglongjmp> 1713 1714Not implemented. C<siglongjmp()> is C-specific: use L<perlfunc/die> instead. 1715 1716=item C<signbit> 1717 1718Returns zero for positive arguments, non-zero for negative arguments [C99]. 1719Added in Perl v5.22. 1720 1721=item C<sigpending> 1722 1723Examine signals that are blocked and pending. This uses C<POSIX::SigSet> 1724objects for the C<sigset> argument. Consult your system's C<sigpending> 1725manpage for details. 1726 1727Synopsis: 1728 1729 sigpending(sigset) 1730 1731Returns C<undef> on failure. 1732 1733=item C<sigprocmask> 1734 1735Change and/or examine calling process's signal mask. This uses 1736C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments. 1737Consult your system's C<sigprocmask> manpage for details. 1738 1739Synopsis: 1740 1741 sigprocmask(how, sigset, oldsigset = 0) 1742 1743Returns C<undef> on failure. 1744 1745Note that you can't reliably block or unblock a signal from its own signal 1746handler if you're using safe signals. Other signals can be blocked or unblocked 1747reliably. 1748 1749=item C<sigsetjmp> 1750 1751Not implemented. C<sigsetjmp()> is C-specific: use C<eval {}> instead, 1752see L<perlfunc/eval>. 1753 1754=item C<sigsuspend> 1755 1756Install a signal mask and suspend process until signal arrives. This uses 1757C<POSIX::SigSet> objects for the C<signal_mask> argument. Consult your 1758system's C<sigsuspend> manpage for details. 1759 1760Synopsis: 1761 1762 sigsuspend(signal_mask) 1763 1764Returns C<undef> on failure. 1765 1766=item C<sin> 1767 1768This is identical to Perl's builtin C<sin()> function, for returning the sine 1769of its numerical argument -- except that C<POSIX::sin()> must be provided with 1770an explicit value (rather than relying on an implicit C<$_>): 1771 1772 $sine = POSIX::sin(3); # good 1773 1774 $sine = POSIX::sin(); # throws exception 1775 1776See L<perlfunc/sin>; see also L<Math::Trig>. 1777 1778=item C<sinh> 1779 1780This is identical to the C function C<sinh()> 1781for returning the hyperbolic sine of the numerical argument. 1782See also L<Math::Trig>. 1783 1784=item C<sleep> 1785 1786This is functionally identical to Perl's builtin C<sleep()> function 1787for suspending the execution of the current for process for certain 1788number of seconds, see L<perlfunc/sleep>. There is one significant 1789difference, however: C<POSIX::sleep()> returns the number of 1790B<unslept> seconds, while the C<CORE::sleep()> returns the 1791number of slept seconds. 1792 1793=item C<sprintf> 1794 1795This is similar to Perl's builtin C<sprintf()> function 1796for returning a string that has the arguments formatted as requested, 1797see L<perlfunc/sprintf>. 1798 1799=item C<sqrt> 1800 1801This is identical to Perl's builtin C<sqrt()> function for returning the 1802square root of the numerical argument -- except that C<POSIX::sqrt()> 1803must be provided with an explicit value (rather than relying on an implicit C<$_>): 1804 1805 $square_root = POSIX::sqrt(3); # good 1806 1807 $square_root = POSIX::sqrt(); # throws exception 1808 1809See L<perlfunc/sqrt>. 1810 1811=item C<srand> 1812 1813Give a seed the pseudorandom number generator, see L<perlfunc/srand>. 1814 1815=item C<sscanf> 1816 1817Not implemented. C<sscanf()> is C-specific, use regular expressions instead, 1818see L<perlre>. 1819 1820=item C<stat> 1821 1822This is identical to Perl's builtin C<stat()> function 1823for returning information about files and directories. 1824 1825=item C<strcat> 1826 1827Not implemented. C<strcat()> is C-specific, use C<.=> instead, see L<perlop>. 1828 1829=item C<strchr> 1830 1831Not implemented. C<strchr()> is C-specific, see L<perlfunc/index> instead. 1832 1833=item C<strcmp> 1834 1835Not implemented. C<strcmp()> is C-specific, use C<eq> or C<cmp> instead, see L<perlop>. 1836 1837=item C<strcoll> 1838 1839This is identical to the C function C<strcoll()> 1840for collating (comparing) strings transformed using 1841the C<strxfrm()> function. Not really needed since 1842Perl can do this transparently, see L<perllocale>. 1843 1844Beware that in a UTF-8 locale, anything you pass to this function must 1845be in UTF-8; and when not in a UTF-8 locale, anything passed must not be 1846UTF-8 encoded. 1847 1848Note also that it doesn't make sense for a string to be encoded in one 1849locale (say, ISO-8859-6, Arabic) and to collate it based on another 1850(like ISO-8859-7, Greek). The results will be essentially meaningless. 1851 1852=item C<strcpy> 1853 1854Not implemented. C<strcpy()> is C-specific, use C<=> instead, see L<perlop>. 1855 1856=item C<strcspn> 1857 1858Not implemented. C<strcspn()> is C-specific, use regular expressions instead, 1859see L<perlre>. 1860 1861=item C<strerror> 1862 1863Returns the error string for the specified errno. 1864Identical to the string form of C<$!>, see L<perlvar/$ERRNO>. 1865 1866=item C<strftime> 1867 1868Convert date and time information to string based on the current 1869underlying locale of the program (except for any daylight savings time). 1870Returns the string. 1871 1872Synopsis: 1873 1874 strftime(fmt, sec, min, hour, mday, mon, year, 1875 wday = -1, yday = -1, isdst = -1) 1876 1877The month (C<mon>) begins at zero, 1878I<e.g.>, January is 0, not 1. The 1879year (C<year>) is given in years since 1900, I<e.g.>, the year 1995 is 95; the 1880year 2001 is 101. Consult your system's C<strftime()> manpage for details 1881about these and the other arguments. 1882 1883The C<wday>, C<yday>, and C<isdst> parameters are all ignored. 1884 1885If you want your code to be portable, your format (C<fmt>) argument 1886should use only the conversion specifiers defined by the ANSI C 1887standard (C99, to play safe). These are C<aAbBcdHIjmMpSUwWxXyYZ%>. 1888But even then, the B<results> of some of the conversion specifiers are 1889non-portable. For example, the specifiers C<aAbBcpZ> change according 1890to the locale settings of the user, and both how to set locales (the 1891locale names) and what output to expect are non-standard. 1892The specifier C<c> changes according to the timezone settings of the 1893user and the timezone computation rules of the operating system. 1894The C<Z> specifier is notoriously unportable since the names of 1895timezones are non-standard. Sticking to the numeric specifiers is the 1896safest route. 1897 1898The given arguments are made consistent as though by calling 1899C<mktime()> before calling your system's C<strftime()> function, 1900except that the C<isdst> value is not affected, so that the returned 1901value will always be as if the locale doesn't have daylight savings 1902time. 1903 1904The string for Tuesday, December 12, 1995 in the C<C> locale. 1905 1906 $str = POSIX::strftime( "%A, %B %d, %Y", 1907 0, 0, 0, 12, 11, 95, 2 ); 1908 print "$str\n"; 1909 1910=item C<strlen> 1911 1912Not implemented. C<strlen()> is C-specific, use C<length()> instead, see L<perlfunc/length>. 1913 1914=item C<strncat> 1915 1916Not implemented. C<strncat()> is C-specific, use C<.=> instead, see L<perlop>. 1917 1918=item C<strncmp> 1919 1920Not implemented. C<strncmp()> is C-specific, use C<eq> instead, see L<perlop>. 1921 1922=item C<strncpy> 1923 1924Not implemented. C<strncpy()> is C-specific, use C<=> instead, see L<perlop>. 1925 1926=item C<strpbrk> 1927 1928Not implemented. C<strpbrk()> is C-specific, use regular expressions instead, 1929see L<perlre>. 1930 1931=item C<strrchr> 1932 1933Not implemented. C<strrchr()> is C-specific, see L<perlfunc/rindex> instead. 1934 1935=item C<strspn> 1936 1937Not implemented. C<strspn()> is C-specific, use regular expressions instead, 1938see L<perlre>. 1939 1940=item C<strstr> 1941 1942This is identical to Perl's builtin C<index()> function, 1943see L<perlfunc/index>. 1944 1945=item C<strtod> 1946 1947String to double translation. Returns the parsed number and the number 1948of characters in the unparsed portion of the string. Truly 1949POSIX-compliant systems set C<$!> (C<$ERRNO>) to indicate a translation 1950error, so clear C<$!> before calling C<strtod>. However, non-POSIX systems 1951may not check for overflow, and therefore will never set C<$!>. 1952 1953C<strtod> respects any POSIX C<setlocale()> C<LC_NUMERIC> settings, 1954regardless of whether or not it is called from Perl code that is within 1955the scope of S<C<use locale>>. Prior to Perl 5.28, or when operating in 1956a non thread-safe environment, it should not be used in a threaded 1957application unless it's certain that the underlying locale is C 1958or POSIX. This is because it otherwise changes the locale, which 1959globally affects all threads simultaneously. 1960 1961To parse a string C<$str> as a floating point number use 1962 1963 $! = 0; 1964 ($num, $n_unparsed) = POSIX::strtod($str); 1965 1966The second returned item and C<$!> can be used to check for valid input: 1967 1968 if (($str eq '') || ($n_unparsed != 0) || $!) { 1969 die "Non-numeric input $str" . ($! ? ": $!\n" : "\n"); 1970 } 1971 1972When called in a scalar context C<strtod> returns the parsed number. 1973 1974=item C<strtok> 1975 1976Not implemented. C<strtok()> is C-specific, use regular expressions instead, see 1977L<perlre>, or L<perlfunc/split>. 1978 1979=item C<strtol> 1980 1981String to (long) integer translation. Returns the parsed number and 1982the number of characters in the unparsed portion of the string. Truly 1983POSIX-compliant systems set C<$!> (C<$ERRNO>) to indicate a translation 1984error, so clear C<$!> before calling C<strtol>. However, non-POSIX systems 1985may not check for overflow, and therefore will never set C<$!>. 1986 1987C<strtol> should respect any POSIX I<setlocale()> settings. 1988 1989To parse a string C<$str> as a number in some base C<$base> use 1990 1991 $! = 0; 1992 ($num, $n_unparsed) = POSIX::strtol($str, $base); 1993 1994The base should be zero or between 2 and 36, inclusive. When the base 1995is zero or omitted C<strtol> will use the string itself to determine the 1996base: a leading "0x" or "0X" means hexadecimal; a leading "0" means 1997octal; any other leading characters mean decimal. Thus, "1234" is 1998parsed as a decimal number, "01234" as an octal number, and "0x1234" 1999as a hexadecimal number. 2000 2001The second returned item and C<$!> can be used to check for valid input: 2002 2003 if (($str eq '') || ($n_unparsed != 0) || !$!) { 2004 die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; 2005 } 2006 2007When called in a scalar context C<strtol> returns the parsed number. 2008 2009=item C<strtold> 2010 2011Like L</strtod> but for long doubles. Defined only if the 2012system supports long doubles. 2013 2014=item C<strtoul> 2015 2016String to unsigned (long) integer translation. C<strtoul()> is identical 2017to C<strtol()> except that C<strtoul()> only parses unsigned integers. See 2018L</strtol> for details. 2019 2020Note: Some vendors supply C<strtod()> and C<strtol()> but not C<strtoul()>. 2021Other vendors that do supply C<strtoul()> parse "-1" as a valid value. 2022 2023=item C<strxfrm> 2024 2025String transformation. Returns the transformed string. 2026 2027 $dst = POSIX::strxfrm( $src ); 2028 2029Used with C<eq> or C<cmp> as an alternative to C<L</strcoll>>. 2030 2031Not really needed since Perl can do this transparently, see 2032L<perllocale>. 2033 2034Unlike the libc C<strxfrm>, this allows NUL characters in the input 2035C<$src>. 2036 2037It doesn't make sense for a string to be encoded in one locale (say, 2038ISO-8859-6, Arabic) and to collate it based on another (like ISO-8859-7, 2039Greek). Perl assumes that the current C<LC_CTYPE> locale correctly 2040represents the encoding of C<$src>, and ignores the value of 2041C<LC_COLLATE>. 2042 2043=item C<sysconf> 2044 2045Retrieves values of system configurable variables. 2046 2047The following will get the machine's clock speed. 2048 2049 $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK ); 2050 2051Returns C<undef> on failure. 2052 2053=item C<system> 2054 2055This is identical to Perl's builtin C<system()> function, see 2056L<perlfunc/system>. 2057 2058=item C<tan> 2059 2060This is identical to the C function C<tan()>, returning the 2061tangent of the numerical argument. See also L<Math::Trig>. 2062 2063=item C<tanh> 2064 2065This is identical to the C function C<tanh()>, returning the 2066hyperbolic tangent of the numerical argument. See also L<Math::Trig>. 2067 2068=item C<tcdrain> 2069 2070This is similar to the C function C<tcdrain()> for draining 2071the output queue of its argument stream. 2072 2073Returns C<undef> on failure. 2074 2075=item C<tcflow> 2076 2077This is similar to the C function C<tcflow()> for controlling 2078the flow of its argument stream. 2079 2080Returns C<undef> on failure. 2081 2082=item C<tcflush> 2083 2084This is similar to the C function C<tcflush()> for flushing 2085the I/O buffers of its argument stream. 2086 2087Returns C<undef> on failure. 2088 2089=item C<tcgetpgrp> 2090 2091This is identical to the C function C<tcgetpgrp()> for returning the 2092process group identifier of the foreground process group of the controlling 2093terminal. 2094 2095=item C<tcsendbreak> 2096 2097This is similar to the C function C<tcsendbreak()> for sending 2098a break on its argument stream. 2099 2100Returns C<undef> on failure. 2101 2102=item C<tcsetpgrp> 2103 2104This is similar to the C function C<tcsetpgrp()> for setting the 2105process group identifier of the foreground process group of the controlling 2106terminal. 2107 2108Returns C<undef> on failure. 2109 2110=item C<tgamma> 2111 2112The Gamma function [C99]. Added in Perl v5.22. 2113 2114See also L</lgamma>. 2115 2116=item C<time> 2117 2118This is identical to Perl's builtin C<time()> function 2119for returning the number of seconds since the epoch 2120(whatever it is for the system), see L<perlfunc/time>. 2121 2122=item C<times> 2123 2124The C<times()> function returns elapsed realtime since some point in the past 2125(such as system startup), user and system times for this process, and user 2126and system times used by child processes. All times are returned in clock 2127ticks. 2128 2129 ($realtime, $user, $system, $cuser, $csystem) 2130 = POSIX::times(); 2131 2132Note: Perl's builtin C<times()> function returns four values, measured in 2133seconds. 2134 2135=item C<tmpfile> 2136 2137Not implemented. Use method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>. 2138 2139=item C<tmpnam> 2140 2141For security reasons, which are probably detailed in your system's 2142documentation for the C library C<tmpnam()> function, this interface 2143is no longer available since Perl v5.26; instead use L<File::Temp>. 2144 2145=item C<tolower> 2146 2147This function has been removed as of Perl v5.26. 2148This is identical to the C function, except that it can apply to a single 2149character or to a whole string, and currently operates as if the locale 2150always is "C". Consider using the C<lc()> function, see L<perlfunc/lc>, 2151see L<perlfunc/lc>, or the equivalent C<\L> operator inside doublequotish 2152strings. 2153 2154=item C<toupper> 2155 2156This function has been removed as of Perl v5.26. 2157This is similar to the C function, except that it can apply to a single 2158character or to a whole string, and currently operates as if the locale 2159always is "C". Consider using the C<uc()> function, see L<perlfunc/uc>, 2160or the equivalent C<\U> operator inside doublequotish strings. 2161 2162=item C<trunc> 2163 2164Returns the integer toward zero from the argument [C99]. Added in Perl 2165v5.22. 2166 2167See also L</ceil>, L</floor>, and L</round>. 2168 2169=item C<ttyname> 2170 2171This is identical to the C function C<ttyname()> for returning the 2172name of the current terminal. 2173 2174=item C<tzname> 2175 2176Retrieves the time conversion information from the C<tzname> variable. 2177 2178 POSIX::tzset(); 2179 ($std, $dst) = POSIX::tzname(); 2180 2181=item C<tzset> 2182 2183This is identical to the C function C<tzset()> for setting 2184the current timezone based on the environment variable C<TZ>, 2185to be used by C<ctime()>, C<localtime()>, C<mktime()>, and C<strftime()> 2186functions. 2187 2188=item C<umask> 2189 2190This is identical to Perl's builtin C<umask()> function for setting (and 2191querying) the file creation permission mask -- except that C<POSIX::umask()> 2192must be provided with an explicit value (rather than relying on an implicit 2193C<$_>): 2194 2195 $current = umask(); # good 2196 2197 $now = POSIX::umask($current); # good 2198 2199 $now = POSIX::umask(); # throws exception 2200 2201See L<perlfunc/umask>. 2202 2203=item C<uname> 2204 2205Get name of current operating system. 2206 2207 ($sysname, $nodename, $release, $version, $machine) 2208 = POSIX::uname(); 2209 2210Note that the actual meanings of the various fields are not 2211that well standardized, do not expect any great portability. 2212The C<$sysname> might be the name of the operating system, 2213the C<$nodename> might be the name of the host, the C<$release> 2214might be the (major) release number of the operating system, 2215the C<$version> might be the (minor) release number of the 2216operating system, and the C<$machine> might be a hardware identifier. 2217Maybe. 2218 2219=item C<ungetc> 2220 2221Not implemented. Use method C<IO::Handle::ungetc()> instead. 2222 2223=item C<unlink> 2224 2225This is identical to Perl's builtin C<unlink()> function 2226for removing files, see L<perlfunc/unlink>. 2227 2228=item C<utime> 2229 2230This is identical to Perl's builtin C<utime()> function 2231for changing the time stamps of files and directories, 2232see L<perlfunc/utime>. 2233 2234=item C<vfprintf> 2235 2236Not implemented. C<vfprintf()> is C-specific, see L<perlfunc/printf> instead. 2237 2238=item C<vprintf> 2239 2240Not implemented. C<vprintf()> is C-specific, see L<perlfunc/printf> instead. 2241 2242=item C<vsprintf> 2243 2244Not implemented. C<vsprintf()> is C-specific, see L<perlfunc/sprintf> instead. 2245 2246=item C<wait> 2247 2248This is identical to Perl's builtin C<wait()> function, 2249see L<perlfunc/wait>. 2250 2251=item C<waitpid> 2252 2253Wait for a child process to change state. This is identical to Perl's 2254builtin C<waitpid()> function, see L<perlfunc/waitpid>. 2255 2256 $pid = POSIX::waitpid( -1, POSIX::WNOHANG ); 2257 print "status = ", ($? / 256), "\n"; 2258 2259See L</mblen>. 2260 2261=item C<wctomb> 2262 2263This is the same as the C function C<wctomb()> on unthreaded perls. On 2264threaded perls, it transparently (almost) substitutes the more 2265thread-safe L<C<wcrtomb>(3)>, if available, instead of C<wctomb>. 2266 2267Core Perl does not have any support for wide and multibyte locales, 2268except Unicode UTF-8 locales. This function, in conjunction with 2269L</mblen> and L</mbtowc> may be used to roll your own decoding/encoding 2270of other types of multi-byte locales. 2271 2272Use C<undef> as the first parameter to this function to get the effect 2273of passing NULL as the first parameter to C<wctomb>. This ignores the 2274second parameter, and resets any shift state to its initial value. The 2275return value is undefined if C<wcrtomb> was substituted, so you should 2276never rely on it. 2277 2278When the first parameter is a scalar, the code point contained in the 2279scalar second parameter is converted into a multi-byte string and stored 2280into the first parameter scalar. This is based on the locale that 2281currently underlies the program, regardless of whether or not the 2282function is called from Perl code that is within the scope of S<C<use 2283locale>>. The return value is the number of bytes stored; or negative 2284if the code point isn't representable in the current locale. Perl makes 2285no attempt at hiding from your code any differences in the C<errno> 2286setting between C<wctomb> and C<wcrtomb>. It does set C<errno> to 0 2287before calling them. 2288 2289=item C<write> 2290 2291Write to a file. This uses file descriptors such as those obtained by 2292calling C<POSIX::open>. 2293 2294 $fd = POSIX::open( "foo", &POSIX::O_WRONLY ); 2295 $buf = "hello"; 2296 $bytes = POSIX::write( $fd, $buf, 5 ); 2297 2298Returns C<undef> on failure. 2299 2300See also L<perlfunc/syswrite>. 2301 2302=back 2303 2304=head1 CLASSES 2305 2306=head2 C<POSIX::SigAction> 2307 2308=over 8 2309 2310=item C<new> 2311 2312Creates a new C<POSIX::SigAction> object which corresponds to the C 2313C<struct sigaction>. This object will be destroyed automatically when 2314it is no longer needed. The first parameter is the handler, a sub 2315reference. The second parameter is a C<POSIX::SigSet> object, it 2316defaults to the empty set. The third parameter contains the 2317C<sa_flags>, it defaults to 0. 2318 2319 $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); 2320 $sigaction = POSIX::SigAction->new( 2321 \&handler, $sigset, &POSIX::SA_NOCLDSTOP 2322 ); 2323 2324This C<POSIX::SigAction> object is intended for use with the C<POSIX::sigaction()> 2325function. 2326 2327=back 2328 2329=over 8 2330 2331=item C<handler> 2332 2333=item C<mask> 2334 2335=item C<flags> 2336 2337accessor functions to get/set the values of a SigAction object. 2338 2339 $sigset = $sigaction->mask; 2340 $sigaction->flags(&POSIX::SA_RESTART); 2341 2342=item C<safe> 2343 2344accessor function for the "safe signals" flag of a SigAction object; see 2345L<perlipc> for general information on safe (a.k.a. "deferred") signals. If 2346you wish to handle a signal safely, use this accessor to set the "safe" flag 2347in the C<POSIX::SigAction> object: 2348 2349 $sigaction->safe(1); 2350 2351You may also examine the "safe" flag on the output action object which is 2352filled in when given as the third parameter to C<POSIX::sigaction()>: 2353 2354 sigaction(SIGINT, $new_action, $old_action); 2355 if ($old_action->safe) { 2356 # previous SIGINT handler used safe signals 2357 } 2358 2359=back 2360 2361=head2 C<POSIX::SigRt> 2362 2363=over 8 2364 2365=item C<%SIGRT> 2366 2367A hash of the POSIX realtime signal handlers. It is an extension of 2368the standard C<%SIG>, the C<$POSIX::SIGRT{SIGRTMIN}> is roughly equivalent 2369to C<$SIG{SIGRTMIN}>, but the right POSIX moves (see below) are made with 2370the C<POSIX::SigSet> and C<POSIX::sigaction> instead of accessing the C<%SIG>. 2371 2372You can set the C<%POSIX::SIGRT> elements to set the POSIX realtime 2373signal handlers, use C<delete> and C<exists> on the elements, and use 2374C<scalar> on the C<%POSIX::SIGRT> to find out how many POSIX realtime 2375signals there are available S<C<(SIGRTMAX - SIGRTMIN + 1>>, the C<SIGRTMAX> is 2376a valid POSIX realtime signal). 2377 2378Setting the C<%SIGRT> elements is equivalent to calling this: 2379 2380 sub new { 2381 my ($rtsig, $handler, $flags) = @_; 2382 my $sigset = POSIX::SigSet($rtsig); 2383 my $sigact = POSIX::SigAction->new($handler,$sigset,$flags); 2384 sigaction($rtsig, $sigact); 2385 } 2386 2387The flags default to zero, if you want something different you can 2388either use C<local> on C<$POSIX::SigRt::SIGACTION_FLAGS>, or you can 2389derive from POSIX::SigRt and define your own C<new()> (the tied hash 2390STORE method of the C<%SIGRT> calls C<new($rtsig, $handler, $SIGACTION_FLAGS)>, 2391where the C<$rtsig> ranges from zero to S<C<SIGRTMAX - SIGRTMIN + 1)>>. 2392 2393Just as with any signal, you can use C<sigaction($rtsig, undef, $oa)> to 2394retrieve the installed signal handler (or, rather, the signal action). 2395 2396B<NOTE:> whether POSIX realtime signals really work in your system, or 2397whether Perl has been compiled so that it works with them, is outside 2398of this discussion. 2399 2400=item C<SIGRTMIN> 2401 2402Return the minimum POSIX realtime signal number available, or C<undef> 2403if no POSIX realtime signals are available. 2404 2405=item C<SIGRTMAX> 2406 2407Return the maximum POSIX realtime signal number available, or C<undef> 2408if no POSIX realtime signals are available. 2409 2410=back 2411 2412=head2 C<POSIX::SigSet> 2413 2414=over 8 2415 2416=item C<new> 2417 2418Create a new SigSet object. This object will be destroyed automatically 2419when it is no longer needed. Arguments may be supplied to initialize the 2420set. 2421 2422Create an empty set. 2423 2424 $sigset = POSIX::SigSet->new; 2425 2426Create a set with C<SIGUSR1>. 2427 2428 $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 ); 2429 2430Throws an error if any of the signals supplied cannot be added to the 2431set. 2432 2433=item C<addset> 2434 2435Add a signal to a SigSet object. 2436 2437 $sigset->addset( &POSIX::SIGUSR2 ); 2438 2439Returns C<undef> on failure. 2440 2441=item C<delset> 2442 2443Remove a signal from the SigSet object. 2444 2445 $sigset->delset( &POSIX::SIGUSR2 ); 2446 2447Returns C<undef> on failure. 2448 2449=item C<emptyset> 2450 2451Initialize the SigSet object to be empty. 2452 2453 $sigset->emptyset(); 2454 2455Returns C<undef> on failure. 2456 2457=item C<fillset> 2458 2459Initialize the SigSet object to include all signals. 2460 2461 $sigset->fillset(); 2462 2463Returns C<undef> on failure. 2464 2465=item C<ismember> 2466 2467Tests the SigSet object to see if it contains a specific signal. 2468 2469 if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ 2470 print "contains SIGUSR1\n"; 2471 } 2472 2473=back 2474 2475=head2 C<POSIX::Termios> 2476 2477=over 8 2478 2479=item C<new> 2480 2481Create a new Termios object. This object will be destroyed automatically 2482when it is no longer needed. A Termios object corresponds to the C<termios> 2483C struct. C<new()> mallocs a new one, C<getattr()> fills it from a file descriptor, 2484and C<setattr()> sets a file descriptor's parameters to match Termios' contents. 2485 2486 $termios = POSIX::Termios->new; 2487 2488=item C<getattr> 2489 2490Get terminal control attributes. 2491 2492Obtain the attributes for C<stdin>. 2493 2494 $termios->getattr( 0 ) # Recommended for clarity. 2495 $termios->getattr() 2496 2497Obtain the attributes for stdout. 2498 2499 $termios->getattr( 1 ) 2500 2501Returns C<undef> on failure. 2502 2503=item C<getcc> 2504 2505Retrieve a value from the C<c_cc> field of a C<termios> object. The C<c_cc> field is 2506an array so an index must be specified. 2507 2508 $c_cc[1] = $termios->getcc(1); 2509 2510=item C<getcflag> 2511 2512Retrieve the C<c_cflag> field of a C<termios> object. 2513 2514 $c_cflag = $termios->getcflag; 2515 2516=item C<getiflag> 2517 2518Retrieve the C<c_iflag> field of a C<termios> object. 2519 2520 $c_iflag = $termios->getiflag; 2521 2522=item C<getispeed> 2523 2524Retrieve the input baud rate. 2525 2526 $ispeed = $termios->getispeed; 2527 2528=item C<getlflag> 2529 2530Retrieve the C<c_lflag> field of a C<termios> object. 2531 2532 $c_lflag = $termios->getlflag; 2533 2534=item C<getoflag> 2535 2536Retrieve the C<c_oflag> field of a C<termios> object. 2537 2538 $c_oflag = $termios->getoflag; 2539 2540=item C<getospeed> 2541 2542Retrieve the output baud rate. 2543 2544 $ospeed = $termios->getospeed; 2545 2546=item C<setattr> 2547 2548Set terminal control attributes. 2549 2550Set attributes immediately for stdout. 2551 2552 $termios->setattr( 1, &POSIX::TCSANOW ); 2553 2554Returns C<undef> on failure. 2555 2556=item C<setcc> 2557 2558Set a value in the C<c_cc> field of a C<termios> object. The C<c_cc> field is an 2559array so an index must be specified. 2560 2561 $termios->setcc( &POSIX::VEOF, 1 ); 2562 2563=item C<setcflag> 2564 2565Set the C<c_cflag> field of a C<termios> object. 2566 2567 $termios->setcflag( $c_cflag | &POSIX::CLOCAL ); 2568 2569=item C<setiflag> 2570 2571Set the C<c_iflag> field of a C<termios> object. 2572 2573 $termios->setiflag( $c_iflag | &POSIX::BRKINT ); 2574 2575=item C<setispeed> 2576 2577Set the input baud rate. 2578 2579 $termios->setispeed( &POSIX::B9600 ); 2580 2581Returns C<undef> on failure. 2582 2583=item C<setlflag> 2584 2585Set the C<c_lflag> field of a C<termios> object. 2586 2587 $termios->setlflag( $c_lflag | &POSIX::ECHO ); 2588 2589=item C<setoflag> 2590 2591Set the C<c_oflag> field of a C<termios> object. 2592 2593 $termios->setoflag( $c_oflag | &POSIX::OPOST ); 2594 2595=item C<setospeed> 2596 2597Set the output baud rate. 2598 2599 $termios->setospeed( &POSIX::B9600 ); 2600 2601Returns C<undef> on failure. 2602 2603=item Baud rate values 2604 2605C<B38400> C<B75> C<B200> C<B134> C<B300> C<B1800> C<B150> C<B0> C<B19200> C<B1200> C<B9600> C<B600> C<B4800> C<B50> C<B2400> C<B110> 2606 2607=item Terminal interface values 2608 2609C<TCSADRAIN> C<TCSANOW> C<TCOON> C<TCIOFLUSH> C<TCOFLUSH> C<TCION> C<TCIFLUSH> C<TCSAFLUSH> C<TCIOFF> C<TCOOFF> 2610 2611=item C<c_cc> field values 2612 2613C<VEOF> C<VEOL> C<VERASE> C<VINTR> C<VKILL> C<VQUIT> C<VSUSP> C<VSTART> C<VSTOP> C<VMIN> C<VTIME> C<NCCS> 2614 2615=item C<c_cflag> field values 2616 2617C<CLOCAL> C<CREAD> C<CSIZE> C<CS5> C<CS6> C<CS7> C<CS8> C<CSTOPB> C<HUPCL> C<PARENB> C<PARODD> 2618 2619=item C<c_iflag> field values 2620 2621C<BRKINT> C<ICRNL> C<IGNBRK> C<IGNCR> C<IGNPAR> C<INLCR> C<INPCK> C<ISTRIP> C<IXOFF> C<IXON> C<PARMRK> 2622 2623=item C<c_lflag> field values 2624 2625C<ECHO> C<ECHOE> C<ECHOK> C<ECHONL> C<ICANON> C<IEXTEN> C<ISIG> C<NOFLSH> C<TOSTOP> 2626 2627=item C<c_oflag> field values 2628 2629C<OPOST> 2630 2631=back 2632 2633=head1 PATHNAME CONSTANTS 2634 2635=over 8 2636 2637=item Constants 2638 2639C<_PC_CHOWN_RESTRICTED> C<_PC_LINK_MAX> C<_PC_MAX_CANON> C<_PC_MAX_INPUT> C<_PC_NAME_MAX> 2640C<_PC_NO_TRUNC> C<_PC_PATH_MAX> C<_PC_PIPE_BUF> C<_PC_VDISABLE> 2641 2642=back 2643 2644=head1 POSIX CONSTANTS 2645 2646=over 8 2647 2648=item Constants 2649 2650C<_POSIX_ARG_MAX> C<_POSIX_CHILD_MAX> C<_POSIX_CHOWN_RESTRICTED> C<_POSIX_JOB_CONTROL> 2651C<_POSIX_LINK_MAX> C<_POSIX_MAX_CANON> C<_POSIX_MAX_INPUT> C<_POSIX_NAME_MAX> 2652C<_POSIX_NGROUPS_MAX> C<_POSIX_NO_TRUNC> C<_POSIX_OPEN_MAX> C<_POSIX_PATH_MAX> 2653C<_POSIX_PIPE_BUF> C<_POSIX_SAVED_IDS> C<_POSIX_SSIZE_MAX> C<_POSIX_STREAM_MAX> 2654C<_POSIX_TZNAME_MAX> C<_POSIX_VDISABLE> C<_POSIX_VERSION> 2655 2656=back 2657 2658=head1 RESOURCE CONSTANTS 2659 2660Imported with the C<:sys_resource_h> tag. 2661 2662=over 8 2663 2664=item Constants 2665 2666Added in Perl v5.28: 2667 2668C<PRIO_PROCESS> C<PRIO_PGRP> C<PRIO_USER> 2669 2670=back 2671 2672=head1 SYSTEM CONFIGURATION 2673 2674=over 8 2675 2676=item Constants 2677 2678C<_SC_ARG_MAX> C<_SC_CHILD_MAX> C<_SC_CLK_TCK> C<_SC_JOB_CONTROL> C<_SC_NGROUPS_MAX> 2679C<_SC_OPEN_MAX> C<_SC_PAGESIZE> C<_SC_SAVED_IDS> C<_SC_STREAM_MAX> C<_SC_TZNAME_MAX> 2680C<_SC_VERSION> 2681 2682=back 2683 2684=head1 ERRNO 2685 2686=over 8 2687 2688=item Constants 2689 2690C<E2BIG> C<EACCES> C<EADDRINUSE> C<EADDRNOTAVAIL> C<EAFNOSUPPORT> C<EAGAIN> C<EALREADY> C<EBADF> C<EBADMSG> 2691C<EBUSY> C<ECANCELED> C<ECHILD> C<ECONNABORTED> C<ECONNREFUSED> C<ECONNRESET> C<EDEADLK> C<EDESTADDRREQ> 2692C<EDOM> C<EDQUOT> C<EEXIST> C<EFAULT> C<EFBIG> C<EHOSTDOWN> C<EHOSTUNREACH> C<EIDRM> C<EILSEQ> C<EINPROGRESS> 2693C<EINTR> C<EINVAL> C<EIO> C<EISCONN> C<EISDIR> C<ELOOP> C<EMFILE> C<EMLINK> C<EMSGSIZE> C<ENAMETOOLONG> 2694C<ENETDOWN> C<ENETRESET> C<ENETUNREACH> C<ENFILE> C<ENOBUFS> C<ENODATA> C<ENODEV> C<ENOENT> C<ENOEXEC> 2695C<ENOLCK> C<ENOLINK> C<ENOMEM> C<ENOMSG> C<ENOPROTOOPT> C<ENOSPC> C<ENOSR> C<ENOSTR> C<ENOSYS> C<ENOTBLK> 2696C<ENOTCONN> C<ENOTDIR> C<ENOTEMPTY> C<ENOTRECOVERABLE> C<ENOTSOCK> C<ENOTSUP> C<ENOTTY> C<ENXIO> 2697C<EOPNOTSUPP> C<EOTHER> C<EOVERFLOW> C<EOWNERDEAD> C<EPERM> C<EPFNOSUPPORT> C<EPIPE> C<EPROCLIM> C<EPROTO> 2698C<EPROTONOSUPPORT> C<EPROTOTYPE> C<ERANGE> C<EREMOTE> C<ERESTART> C<EROFS> C<ESHUTDOWN> 2699C<ESOCKTNOSUPPORT> C<ESPIPE> C<ESRCH> C<ESTALE> C<ETIME> C<ETIMEDOUT> C<ETOOMANYREFS> C<ETXTBSY> C<EUSERS> 2700C<EWOULDBLOCK> C<EXDEV> 2701 2702=back 2703 2704=head1 FCNTL 2705 2706=over 8 2707 2708=item Constants 2709 2710C<FD_CLOEXEC> C<F_DUPFD> C<F_GETFD> C<F_GETFL> C<F_GETLK> C<F_OK> C<F_RDLCK> C<F_SETFD> C<F_SETFL> C<F_SETLK> 2711C<F_SETLKW> C<F_UNLCK> C<F_WRLCK> C<O_ACCMODE> C<O_APPEND> C<O_CREAT> C<O_EXCL> C<O_NOCTTY> C<O_NONBLOCK> 2712C<O_RDONLY> C<O_RDWR> C<O_TRUNC> C<O_WRONLY> 2713 2714=back 2715 2716=head1 FLOAT 2717 2718=over 8 2719 2720=item Constants 2721 2722C<DBL_DIG> C<DBL_EPSILON> C<DBL_MANT_DIG> C<DBL_MAX> C<DBL_MAX_10_EXP> C<DBL_MAX_EXP> C<DBL_MIN> 2723C<DBL_MIN_10_EXP> C<DBL_MIN_EXP> C<FLT_DIG> C<FLT_EPSILON> C<FLT_MANT_DIG> C<FLT_MAX> 2724C<FLT_MAX_10_EXP> C<FLT_MAX_EXP> C<FLT_MIN> C<FLT_MIN_10_EXP> C<FLT_MIN_EXP> C<FLT_RADIX> 2725C<FLT_ROUNDS> C<LDBL_DIG> C<LDBL_EPSILON> C<LDBL_MANT_DIG> C<LDBL_MAX> C<LDBL_MAX_10_EXP> 2726C<LDBL_MAX_EXP> C<LDBL_MIN> C<LDBL_MIN_10_EXP> C<LDBL_MIN_EXP> 2727 2728=back 2729 2730=head1 FLOATING-POINT ENVIRONMENT 2731 2732=over 8 2733 2734=item Constants 2735 2736C<FE_DOWNWARD> C<FE_TONEAREST> C<FE_TOWARDZERO> C<FE_UPWARD> 2737on systems that support them. 2738 2739=back 2740 2741=head1 LIMITS 2742 2743=over 8 2744 2745=item Constants 2746 2747C<ARG_MAX> C<CHAR_BIT> C<CHAR_MAX> C<CHAR_MIN> C<CHILD_MAX> C<INT_MAX> C<INT_MIN> C<LINK_MAX> C<LONG_MAX> 2748C<LONG_MIN> C<MAX_CANON> C<MAX_INPUT> C<MB_LEN_MAX> C<NAME_MAX> C<NGROUPS_MAX> C<OPEN_MAX> C<PATH_MAX> 2749C<PIPE_BUF> C<SCHAR_MAX> C<SCHAR_MIN> C<SHRT_MAX> C<SHRT_MIN> C<SSIZE_MAX> C<STREAM_MAX> C<TZNAME_MAX> 2750C<UCHAR_MAX> C<UINT_MAX> C<ULONG_MAX> C<USHRT_MAX> 2751 2752=back 2753 2754=head1 LOCALE 2755 2756=over 8 2757 2758=item Constants 2759 2760C<LC_ALL> C<LC_COLLATE> C<LC_CTYPE> C<LC_MONETARY> C<LC_NUMERIC> C<LC_TIME> C<LC_MESSAGES> 2761on systems that support them. 2762 2763=back 2764 2765=head1 MATH 2766 2767=over 8 2768 2769=item Constants 2770 2771C<HUGE_VAL> 2772 2773Added in Perl v5.22: 2774 2775C<FP_ILOGB0> C<FP_ILOGBNAN> C<FP_INFINITE> C<FP_NAN> C<FP_NORMAL> C<FP_SUBNORMAL> C<FP_ZERO> 2776C<INFINITY> C<NAN> C<Inf> C<NaN> 2777C<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> 2778C<M_PI_2> C<M_PI_4> C<M_SQRT1_2> C<M_SQRT2> 2779on systems with C99 support. 2780 2781=back 2782 2783=head1 SIGNAL 2784 2785=over 8 2786 2787=item Constants 2788 2789C<SA_NOCLDSTOP> C<SA_NOCLDWAIT> C<SA_NODEFER> C<SA_ONSTACK> C<SA_RESETHAND> C<SA_RESTART> 2790C<SA_SIGINFO> C<SIGABRT> C<SIGALRM> C<SIGCHLD> C<SIGCONT> C<SIGFPE> C<SIGHUP> C<SIGILL> C<SIGINT> 2791C<SIGKILL> C<SIGPIPE> C<SIGQUIT> C<SIGSEGV> C<SIGSTOP> C<SIGTERM> C<SIGTSTP> C<SIGTTIN> C<SIGTTOU> 2792C<SIGUSR1> C<SIGUSR2> C<SIG_BLOCK> C<SIG_DFL> C<SIG_ERR> C<SIG_IGN> C<SIG_SETMASK> 2793C<SIG_UNBLOCK> 2794 2795Added in Perl v5.24: 2796 2797C<ILL_ILLOPC> C<ILL_ILLOPN> C<ILL_ILLADR> C<ILL_ILLTRP> C<ILL_PRVOPC> C<ILL_PRVREG> C<ILL_COPROC> 2798C<ILL_BADSTK> C<FPE_INTDIV> C<FPE_INTOVF> C<FPE_FLTDIV> C<FPE_FLTOVF> C<FPE_FLTUND> C<FPE_FLTRES> 2799C<FPE_FLTINV> C<FPE_FLTSUB> C<SEGV_MAPERR> C<SEGV_ACCERR> C<BUS_ADRALN> C<BUS_ADRERR> 2800C<BUS_OBJERR> C<TRAP_BRKPT> C<TRAP_TRACE> C<CLD_EXITED> C<CLD_KILLED> C<CLD_DUMPED> C<CLD_TRAPPED> 2801C<CLD_STOPPED> C<CLD_CONTINUED> C<POLL_IN> C<POLL_OUT> C<POLL_MSG> C<POLL_ERR> C<POLL_PRI> 2802C<POLL_HUP> C<SI_USER> C<SI_QUEUE> C<SI_TIMER> C<SI_ASYNCIO> C<SI_MESGQ> 2803 2804=back 2805 2806=head1 STAT 2807 2808=over 8 2809 2810=item Constants 2811 2812C<S_IRGRP> C<S_IROTH> C<S_IRUSR> C<S_IRWXG> C<S_IRWXO> C<S_IRWXU> C<S_ISGID> C<S_ISUID> C<S_IWGRP> C<S_IWOTH> 2813C<S_IWUSR> C<S_IXGRP> C<S_IXOTH> C<S_IXUSR> 2814 2815=item Macros 2816 2817C<S_ISBLK> C<S_ISCHR> C<S_ISDIR> C<S_ISFIFO> C<S_ISLNK> C<S_ISREG> C<S_ISSOCK> 2818 2819=back 2820 2821=head1 STDLIB 2822 2823=over 8 2824 2825=item Constants 2826 2827C<EXIT_FAILURE> C<EXIT_SUCCESS> C<MB_CUR_MAX> C<RAND_MAX> 2828 2829=back 2830 2831=head1 STDIO 2832 2833=over 8 2834 2835=item Constants 2836 2837C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<TMP_MAX> 2838 2839=back 2840 2841=head1 TIME 2842 2843=over 8 2844 2845=item Constants 2846 2847C<CLK_TCK> C<CLOCKS_PER_SEC> 2848 2849=back 2850 2851=head1 UNISTD 2852 2853=over 8 2854 2855=item Constants 2856 2857C<R_OK> C<SEEK_CUR> C<SEEK_END> C<SEEK_SET> C<STDIN_FILENO> C<STDOUT_FILENO> C<STDERR_FILENO> C<W_OK> C<X_OK> 2858 2859=back 2860 2861=head1 WAIT 2862 2863=over 8 2864 2865=item Constants 2866 2867C<WNOHANG> C<WUNTRACED> 2868 2869=over 16 2870 2871=item C<WNOHANG> 2872 2873Do not suspend the calling process until a child process 2874changes state but instead return immediately. 2875 2876=item C<WUNTRACED> 2877 2878Catch stopped child processes. 2879 2880=back 2881 2882=item Macros 2883 2884C<WIFEXITED> C<WEXITSTATUS> C<WIFSIGNALED> C<WTERMSIG> C<WIFSTOPPED> C<WSTOPSIG> 2885 2886=over 16 2887 2888=item C<WIFEXITED> 2889 2890C<WIFEXITED(${^CHILD_ERROR_NATIVE})> returns true if the child process 2891exited normally (C<exit()> or by falling off the end of C<main()>) 2892 2893=item C<WEXITSTATUS> 2894 2895C<WEXITSTATUS(${^CHILD_ERROR_NATIVE})> returns the normal exit status of 2896the child process (only meaningful if C<WIFEXITED(${^CHILD_ERROR_NATIVE})> 2897is true) 2898 2899=item C<WIFSIGNALED> 2900 2901C<WIFSIGNALED(${^CHILD_ERROR_NATIVE})> returns true if the child process 2902terminated because of a signal 2903 2904=item C<WTERMSIG> 2905 2906C<WTERMSIG(${^CHILD_ERROR_NATIVE})> returns the signal the child process 2907terminated for (only meaningful if 2908C<WIFSIGNALED(${^CHILD_ERROR_NATIVE})> 2909is true) 2910 2911=item C<WIFSTOPPED> 2912 2913C<WIFSTOPPED(${^CHILD_ERROR_NATIVE})> returns true if the child process is 2914currently stopped (can happen only if you specified the WUNTRACED flag 2915to C<waitpid()>) 2916 2917=item C<WSTOPSIG> 2918 2919C<WSTOPSIG(${^CHILD_ERROR_NATIVE})> returns the signal the child process 2920was stopped for (only meaningful if 2921C<WIFSTOPPED(${^CHILD_ERROR_NATIVE})> 2922is true) 2923 2924=back 2925 2926=back 2927 2928=head1 WINSOCK 2929 2930(Windows only.) 2931 2932=over 8 2933 2934=item Constants 2935 2936Added in Perl v5.24: 2937 2938C<WSAEINTR> C<WSAEBADF> C<WSAEACCES> C<WSAEFAULT> C<WSAEINVAL> C<WSAEMFILE> C<WSAEWOULDBLOCK> 2939C<WSAEINPROGRESS> C<WSAEALREADY> C<WSAENOTSOCK> C<WSAEDESTADDRREQ> C<WSAEMSGSIZE> 2940C<WSAEPROTOTYPE> C<WSAENOPROTOOPT> C<WSAEPROTONOSUPPORT> C<WSAESOCKTNOSUPPORT> 2941C<WSAEOPNOTSUPP> C<WSAEPFNOSUPPORT> C<WSAEAFNOSUPPORT> C<WSAEADDRINUSE> 2942C<WSAEADDRNOTAVAIL> C<WSAENETDOWN> C<WSAENETUNREACH> C<WSAENETRESET> C<WSAECONNABORTED> 2943C<WSAECONNRESET> C<WSAENOBUFS> C<WSAEISCONN> C<WSAENOTCONN> C<WSAESHUTDOWN> 2944C<WSAETOOMANYREFS> C<WSAETIMEDOUT> C<WSAECONNREFUSED> C<WSAELOOP> C<WSAENAMETOOLONG> 2945C<WSAEHOSTDOWN> C<WSAEHOSTUNREACH> C<WSAENOTEMPTY> C<WSAEPROCLIM> C<WSAEUSERS> 2946C<WSAEDQUOT> C<WSAESTALE> C<WSAEREMOTE> C<WSAEDISCON> C<WSAENOMORE> C<WSAECANCELLED> 2947C<WSAEINVALIDPROCTABLE> C<WSAEINVALIDPROVIDER> C<WSAEPROVIDERFAILEDINIT> 2948C<WSAEREFUSED> 2949 2950=back 2951 2952