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