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 24I<Everything is exported by default> with the exception of any POSIX 25functions with the same name as a built-in Perl function, such as 26C<abs>, C<alarm>, C<rmdir>, C<write>, etc.., which will be exported 27only if you ask for them explicitly. This is an unfortunate backwards 28compatibility feature. You can stop the exporting by saying S<C<use 29POSIX ()>> and then use the fully qualified names (I<e.g.>, C<POSIX::SEEK_END>), 30or by giving an explicit import list. If you do neither, and opt for the 31default, S<C<use POSIX;>> has to import I<553 symbols>. 32 33This document gives a condensed list of the features available in the POSIX 34module. Consult your operating system's manpages for general information on 35most features. Consult L<perlfunc> for functions which are noted as being 36identical to Perl's builtin functions. 37 38The first section describes POSIX functions from the 1003.1 specification. 39The second section describes some classes for signal objects, TTY objects, 40and other miscellaneous objects. The remaining sections list various 41constants and macros in an organization which roughly follows IEEE Std 421003.1b-1993. 43 44=head1 CAVEATS 45 46A few functions are not implemented because they are C specific. If you 47attempt to call these, they will print a message telling you that they 48aren't implemented, and suggest using the Perl equivalent, should one 49exist. For example, trying to access the C<setjmp()> call will elicit the 50message "C<setjmp() is C-specific: use eval {} instead>". 51 52Furthermore, some evil vendors will claim 1003.1 compliance, but in fact 53are not so: they will not pass the PCTS (POSIX Compliance Test Suites). 54For example, one vendor may not define C<EDEADLK>, or the semantics of the 55errno values set by C<open(2)> might not be quite right. Perl does not 56attempt to verify POSIX compliance. That means you can currently 57successfully say "use POSIX", and then later in your program you find 58that your vendor has been lax and there's no usable C<ICANON> macro after 59all. This could be construed to be a bug. 60 61=head1 FUNCTIONS 62 63=over 8 64 65=item C<_exit> 66 67This is identical to the C function C<_exit()>. It exits the program 68immediately which means among other things buffered I/O is B<not> flushed. 69 70Note that when using threads and in Linux this is B<not> a good way to 71exit a thread because in Linux processes and threads are kind of the 72same thing (Note: while this is the situation in early 2003 there are 73projects under way to have threads with more POSIXly semantics in Linux). 74If you want not to return from a thread, detach the thread. 75 76=item C<abort> 77 78This is identical to the C function C<abort()>. It terminates the 79process with a C<SIGABRT> signal unless caught by a signal handler or 80if the handler does not return normally (it e.g. does a C<longjmp>). 81 82=item C<abs> 83 84This is identical to Perl's builtin C<abs()> function, returning 85the absolute value of its numerical argument. 86 87=item C<access> 88 89Determines the accessibility of a file. 90 91 if( POSIX::access( "/", &POSIX::R_OK ) ){ 92 print "have read permission\n"; 93 } 94 95Returns C<undef> on failure. Note: do not use C<access()> for 96security purposes. Between the C<access()> call and the operation 97you are preparing for the permissions might change: a classic 98I<race condition>. 99 100=item C<acos> 101 102This is identical to the C function C<acos()>, returning 103the arcus cosine of its numerical argument. See also L<Math::Trig>. 104 105=item C<alarm> 106 107This is identical to Perl's builtin C<alarm()> function, 108either for arming or disarming the C<SIGARLM> timer. 109 110=item C<asctime> 111 112This is identical to the C function C<asctime()>. It returns 113a string of the form 114 115 "Fri Jun 2 18:22:13 2000\n\0" 116 117and it is called thusly 118 119 $asctime = asctime($sec, $min, $hour, $mday, $mon, 120 $year, $wday, $yday, $isdst); 121 122The C<$mon> is zero-based: January equals C<0>. The C<$year> is 1231900-based: 2001 equals C<101>. C<$wday> and C<$yday> default to zero 124(and are usually ignored anyway), and C<$isdst> defaults to -1. 125 126=item C<asin> 127 128This is identical to the C function C<asin()>, returning 129the arcus sine of its numerical argument. See also L<Math::Trig>. 130 131=item C<assert> 132 133Unimplemented, but you can use L<perlfunc/die> and the L<Carp> module 134to achieve similar things. 135 136=item C<atan> 137 138This is identical to the C function C<atan()>, returning the 139arcus tangent of its numerical argument. See also L<Math::Trig>. 140 141=item C<atan2> 142 143This is identical to Perl's builtin C<atan2()> function, returning 144the arcus tangent defined by its two numerical arguments, the I<y> 145coordinate and the I<x> coordinate. See also L<Math::Trig>. 146 147=item C<atexit> 148 149C<atexit()> is C-specific: use C<END {}> instead, see L<perlmod>. 150 151=item C<atof> 152 153C<atof()> is C-specific. Perl converts strings to numbers transparently. 154If you need to force a scalar to a number, add a zero to it. 155 156=item C<atoi> 157 158C<atoi()> is C-specific. Perl converts strings to numbers transparently. 159If you need to force a scalar to a number, add a zero to it. 160If you need to have just the integer part, see L<perlfunc/int>. 161 162=item C<atol> 163 164C<atol()> is C-specific. Perl converts strings to numbers transparently. 165If you need to force a scalar to a number, add a zero to it. 166If you need to have just the integer part, see L<perlfunc/int>. 167 168=item C<bsearch> 169 170C<bsearch()> not supplied. For doing binary search on wordlists, 171see L<Search::Dict>. 172 173=item C<calloc> 174 175C<calloc()> is C-specific. Perl does memory management transparently. 176 177=item C<ceil> 178 179This is identical to the C function C<ceil()>, returning the smallest 180integer value greater than or equal to the given numerical argument. 181 182=item C<chdir> 183 184This is identical to Perl's builtin C<chdir()> function, allowing 185one to change the working (default) directory, see L<perlfunc/chdir>. 186 187=item C<chmod> 188 189This is identical to Perl's builtin C<chmod()> function, allowing 190one to change file and directory permissions, see L<perlfunc/chmod>. 191 192=item C<chown> 193 194This is identical to Perl's builtin C<chown()> function, allowing one 195to change file and directory owners and groups, see L<perlfunc/chown>. 196 197=item C<clearerr> 198 199Use the method C<IO::Handle::clearerr()> instead, to reset the error 200state (if any) and EOF state (if any) of the given stream. 201 202=item C<clock> 203 204This is identical to the C function C<clock()>, returning the 205amount of spent processor time in microseconds. 206 207=item C<close> 208 209Close the file. This uses file descriptors such as those obtained by calling 210C<POSIX::open>. 211 212 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 213 POSIX::close( $fd ); 214 215Returns C<undef> on failure. 216 217See also L<perlfunc/close>. 218 219=item C<closedir> 220 221This is identical to Perl's builtin C<closedir()> function for closing 222a directory handle, see L<perlfunc/closedir>. 223 224=item C<cos> 225 226This is identical to Perl's builtin C<cos()> function, for returning 227the cosine of its numerical argument, see L<perlfunc/cos>. 228See also L<Math::Trig>. 229 230=item C<cosh> 231 232This is identical to the C function C<cosh()>, for returning 233the hyperbolic cosine of its numeric argument. See also L<Math::Trig>. 234 235=item C<creat> 236 237Create a new file. This returns a file descriptor like the ones returned by 238C<POSIX::open>. Use C<POSIX::close> to close the file. 239 240 $fd = POSIX::creat( "foo", 0611 ); 241 POSIX::close( $fd ); 242 243See also L<perlfunc/sysopen> and its C<O_CREAT> flag. 244 245=item C<ctermid> 246 247Generates the path name for the controlling terminal. 248 249 $path = POSIX::ctermid(); 250 251=item C<ctime> 252 253This is identical to the C function C<ctime()> and equivalent 254to C<asctime(localtime(...))>, see L</asctime> and L</localtime>. 255 256=item C<cuserid> 257 258Get the login name of the owner of the current process. 259 260 $name = POSIX::cuserid(); 261 262=item C<difftime> 263 264This is identical to the C function C<difftime()>, for returning 265the time difference (in seconds) between two times (as returned 266by C<time()>), see L</time>. 267 268=item C<div> 269 270C<div()> is C-specific, use L<perlfunc/int> on the usual C</> division and 271the modulus C<%>. 272 273=item C<dup> 274 275This is similar to the C function C<dup()>, for duplicating a file 276descriptor. 277 278This uses file descriptors such as those obtained by calling 279C<POSIX::open>. 280 281Returns C<undef> on failure. 282 283=item C<dup2> 284 285This is similar to the C function C<dup2()>, for duplicating a file 286descriptor to an another known file descriptor. 287 288This uses file descriptors such as those obtained by calling 289C<POSIX::open>. 290 291Returns C<undef> on failure. 292 293=item C<errno> 294 295Returns the value of errno. 296 297 $errno = POSIX::errno(); 298 299This identical to the numerical values of the C<$!>, see L<perlvar/$ERRNO>. 300 301=item C<execl> 302 303C<execl()> is C-specific, see L<perlfunc/exec>. 304 305=item C<execle> 306 307C<execle()> is C-specific, see L<perlfunc/exec>. 308 309=item C<execlp> 310 311C<execlp()> is C-specific, see L<perlfunc/exec>. 312 313=item C<execv> 314 315C<execv()> is C-specific, see L<perlfunc/exec>. 316 317=item C<execve> 318 319C<execve()> is C-specific, see L<perlfunc/exec>. 320 321=item C<execvp> 322 323C<execvp()> is C-specific, see L<perlfunc/exec>. 324 325=item C<exit> 326 327This is identical to Perl's builtin C<exit()> function for exiting the 328program, see L<perlfunc/exit>. 329 330=item C<exp> 331 332This is identical to Perl's builtin C<exp()> function for 333returning the exponent (I<e>-based) of the numerical argument, 334see L<perlfunc/exp>. 335 336=item C<fabs> 337 338This is identical to Perl's builtin C<abs()> function for returning 339the absolute value of the numerical argument, see L<perlfunc/abs>. 340 341=item C<fclose> 342 343Use method C<IO::Handle::close()> instead, or see L<perlfunc/close>. 344 345=item C<fcntl> 346 347This is identical to Perl's builtin C<fcntl()> function, 348see L<perlfunc/fcntl>. 349 350=item C<fdopen> 351 352Use method C<IO::Handle::new_from_fd()> instead, or see L<perlfunc/open>. 353 354=item C<feof> 355 356Use method C<IO::Handle::eof()> instead, or see L<perlfunc/eof>. 357 358=item C<ferror> 359 360Use method C<IO::Handle::error()> instead. 361 362=item C<fflush> 363 364Use method C<IO::Handle::flush()> instead. 365See also C<L<perlvar/$OUTPUT_AUTOFLUSH>>. 366 367=item C<fgetc> 368 369Use method C<IO::Handle::getc()> instead, or see L<perlfunc/read>. 370 371=item C<fgetpos> 372 373Use method C<IO::Seekable::getpos()> instead, or see L<perlfunc/seek>. 374 375=item C<fgets> 376 377Use method C<IO::Handle::gets()> instead. Similar to E<lt>E<gt>, also known 378as L<perlfunc/readline>. 379 380=item C<fileno> 381 382Use method C<IO::Handle::fileno()> instead, or see L<perlfunc/fileno>. 383 384=item C<floor> 385 386This is identical to the C function C<floor()>, returning the largest 387integer value less than or equal to the numerical argument. 388 389=item C<fmod> 390 391This is identical to the C function C<fmod()>. 392 393 $r = fmod($x, $y); 394 395It returns the remainder C<$r = $x - $n*$y>, where C<$n = trunc($x/$y)>. 396The C<$r> has the same sign as C<$x> and magnitude (absolute value) 397less than the magnitude of C<$y>. 398 399=item C<fopen> 400 401Use method C<IO::File::open()> instead, or see L<perlfunc/open>. 402 403=item C<fork> 404 405This is identical to Perl's builtin C<fork()> function 406for duplicating the current process, see L<perlfunc/fork> 407and L<perlfork> if you are in Windows. 408 409=item C<fpathconf> 410 411Retrieves the value of a configurable limit on a file or directory. This 412uses file descriptors such as those obtained by calling C<POSIX::open>. 413 414The following will determine the maximum length of the longest allowable 415pathname on the filesystem which holds F</var/foo>. 416 417 $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY ); 418 $path_max = POSIX::fpathconf($fd, &POSIX::_PC_PATH_MAX); 419 420Returns C<undef> on failure. 421 422=item C<fprintf> 423 424C<fprintf()> is C-specific, see L<perlfunc/printf> instead. 425 426=item C<fputc> 427 428C<fputc()> is C-specific, see L<perlfunc/print> instead. 429 430=item C<fputs> 431 432C<fputs()> is C-specific, see L<perlfunc/print> instead. 433 434=item C<fread> 435 436C<fread()> is C-specific, see L<perlfunc/read> instead. 437 438=item C<free> 439 440C<free()> is C-specific. Perl does memory management transparently. 441 442=item C<freopen> 443 444C<freopen()> is C-specific, see L<perlfunc/open> instead. 445 446=item C<frexp> 447 448Return the mantissa and exponent of a floating-point number. 449 450 ($mantissa, $exponent) = POSIX::frexp( 1.234e56 ); 451 452=item C<fscanf> 453 454C<fscanf()> is C-specific, use E<lt>E<gt> and regular expressions instead. 455 456=item C<fseek> 457 458Use method C<IO::Seekable::seek()> instead, or see L<perlfunc/seek>. 459 460=item C<fsetpos> 461 462Use method C<IO::Seekable::setpos()> instead, or seek L<perlfunc/seek>. 463 464=item C<fstat> 465 466Get file status. This uses file descriptors such as those obtained by 467calling C<POSIX::open>. The data returned is identical to the data from 468Perl's builtin C<stat> function. 469 470 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 471 @stats = POSIX::fstat( $fd ); 472 473=item C<fsync> 474 475Use method C<IO::Handle::sync()> instead. 476 477=item C<ftell> 478 479Use method C<IO::Seekable::tell()> instead, or see L<perlfunc/tell>. 480 481=item C<fwrite> 482 483C<fwrite()> is C-specific, see L<perlfunc/print> instead. 484 485=item C<getc> 486 487This is identical to Perl's builtin C<getc()> function, 488see L<perlfunc/getc>. 489 490=item C<getchar> 491 492Returns one character from STDIN. Identical to Perl's C<getc()>, 493see L<perlfunc/getc>. 494 495=item C<getcwd> 496 497Returns the name of the current working directory. 498See also L<Cwd>. 499 500=item C<getegid> 501 502Returns the effective group identifier. Similar to Perl' s builtin 503variable C<$(>, see L<perlvar/$EGID>. 504 505=item C<getenv> 506 507Returns the value of the specified environment variable. 508The same information is available through the C<%ENV> array. 509 510=item C<geteuid> 511 512Returns the effective user identifier. Identical to Perl's builtin C<$E<gt>> 513variable, see L<perlvar/$EUID>. 514 515=item C<getgid> 516 517Returns the user's real group identifier. Similar to Perl's builtin 518variable C<$)>, see L<perlvar/$GID>. 519 520=item C<getgrgid> 521 522This is identical to Perl's builtin C<getgrgid()> function for 523returning group entries by group identifiers, see 524L<perlfunc/getgrgid>. 525 526=item C<getgrnam> 527 528This is identical to Perl's builtin C<getgrnam()> function for 529returning group entries by group names, see L<perlfunc/getgrnam>. 530 531=item C<getgroups> 532 533Returns the ids of the user's supplementary groups. Similar to Perl's 534builtin variable C<$)>, see L<perlvar/$GID>. 535 536=item C<getlogin> 537 538This is identical to Perl's builtin C<getlogin()> function for 539returning the user name associated with the current session, see 540L<perlfunc/getlogin>. 541 542=item C<getpgrp> 543 544This is identical to Perl's builtin C<getpgrp()> function for 545returning the process group identifier of the current process, see 546L<perlfunc/getpgrp>. 547 548=item C<getpid> 549 550Returns the process identifier. Identical to Perl's builtin 551variable C<$$>, see L<perlvar/$PID>. 552 553=item C<getppid> 554 555This is identical to Perl's builtin C<getppid()> function for 556returning the process identifier of the parent process of the current 557process , see L<perlfunc/getppid>. 558 559=item C<getpwnam> 560 561This is identical to Perl's builtin C<getpwnam()> function for 562returning user entries by user names, see L<perlfunc/getpwnam>. 563 564=item C<getpwuid> 565 566This is identical to Perl's builtin C<getpwuid()> function for 567returning user entries by user identifiers, see L<perlfunc/getpwuid>. 568 569=item C<gets> 570 571Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known 572as the C<readline()> function, see L<perlfunc/readline>. 573 574B<NOTE>: if you have C programs that still use C<gets()>, be very 575afraid. The C<gets()> function is a source of endless grief because 576it has no buffer overrun checks. It should B<never> be used. The 577C<fgets()> function should be preferred instead. 578 579=item C<getuid> 580 581Returns the user's identifier. Identical to Perl's builtin C<$E<lt>> variable, 582see L<perlvar/$UID>. 583 584=item C<gmtime> 585 586This is identical to Perl's builtin C<gmtime()> function for 587converting seconds since the epoch to a date in Greenwich Mean Time, 588see L<perlfunc/gmtime>. 589 590=item C<isalnum> 591 592Deprecated function whose use raises a warning, and which is slated to 593be removed in a future Perl version. It is very similar to matching 594against S<C<qr/ ^ [[:alnum:]]+ $ /x>>, which you should convert to use 595instead. The function is deprecated because 1) it doesn't handle UTF-8 596encoded strings properly; and 2) it returns C<TRUE> even if the input is 597the empty string. The function return is always based on the current 598locale, whereas using locale rules is optional with the regular 599expression, based on pragmas in effect and pattern modifiers (see 600L<perlre/Character set modifiers> and L<perlre/Which character set 601modifier is in effect?>). 602 603The function returns C<TRUE> if the input string is empty, or if the 604corresponding C function returns C<TRUE> for every byte in the string. 605 606You may want to use the C<L<E<sol>\wE<sol>|perlrecharclass/Word 607characters>> construct instead. 608 609=item C<isalpha> 610 611Deprecated function whose use raises a warning, and which is slated to 612be removed in a future Perl version. It is very similar to matching 613against S<C<qr/ ^ [[:alpha:]]+ $ /x>>, which you should convert to use 614instead. The function is deprecated because 1) it doesn't handle UTF-8 615encoded strings properly; and 2) it returns C<TRUE> even if the input is 616the empty string. The function return is always based on the current 617locale, whereas using locale rules is optional with the regular 618expression, based on pragmas in effect and pattern modifiers (see 619L<perlre/Character set modifiers> and L<perlre/Which character set 620modifier is in effect?>). 621 622The function returns C<TRUE> if the input string is empty, or if the 623corresponding C function returns C<TRUE> for every byte in the string. 624 625=item C<isatty> 626 627Returns a boolean indicating whether the specified filehandle is connected 628to a tty. Similar to the C<-t> operator, see L<perlfunc/-X>. 629 630=item C<iscntrl> 631 632Deprecated function whose use raises a warning, and which is slated to 633be removed in a future Perl version. It is very similar to matching 634against S<C<qr/ ^ [[:cntrl:]]+ $ /x>>, which you should convert to use 635instead. The function is deprecated because 1) it doesn't handle UTF-8 636encoded strings properly; and 2) it returns C<TRUE> even if the input is 637the empty string. The function return is always based on the current 638locale, whereas using locale rules is optional with the regular 639expression, based on pragmas in effect and pattern modifiers (see 640L<perlre/Character set modifiers> and L<perlre/Which character set 641modifier is in effect?>). 642 643The function returns C<TRUE> if the input string is empty, or if the 644corresponding C function returns C<TRUE> for every byte in the string. 645 646=item C<isdigit> 647 648Deprecated function whose use raises a warning, and which is slated to 649be removed in a future Perl version. It is very similar to matching 650against S<C<qr/ ^ [[:digit:]]+ $ /x>>, which you should convert to use 651instead. The function is deprecated because 1) it doesn't handle UTF-8 652encoded strings properly; and 2) it returns C<TRUE> even if the input is 653the empty string. The function return is always based on the current 654locale, whereas using locale rules is optional with the regular 655expression, based on pragmas in effect and pattern modifiers (see 656L<perlre/Character set modifiers> and L<perlre/Which character set 657modifier is in effect?>). 658 659The function returns C<TRUE> if the input string is empty, or if the 660corresponding C function returns C<TRUE> for every byte in the string. 661 662You may want to use the C<L<E<sol>\dE<sol>|perlrecharclass/Digits>> 663construct instead. 664 665=item C<isgraph> 666 667Deprecated function whose use raises a warning, and which is slated to 668be removed in a future Perl version. It is very similar to matching 669against S<C<qr/ ^ [[:graph:]]+ $ /x>>, which you should convert to use 670instead. The function is deprecated because 1) it doesn't handle UTF-8 671encoded strings properly; and 2) it returns C<TRUE> even if the input is 672the empty string. The function return is always based on the current 673locale, whereas using locale rules is optional with the regular 674expression, based on pragmas in effect and pattern modifiers (see 675L<perlre/Character set modifiers> and L<perlre/Which character set 676modifier is in effect?>). 677 678The function returns C<TRUE> if the input string is empty, or if the 679corresponding C function returns C<TRUE> for every byte in the string. 680 681=item C<islower> 682 683Deprecated function whose use raises a warning, and which is slated to 684be removed in a future Perl version. It is very similar to matching 685against S<C<qr/ ^ [[:lower:]]+ $ /x>>, which you should convert to use 686instead. The function is deprecated because 1) it doesn't handle UTF-8 687encoded strings properly; and 2) it returns C<TRUE> even if the input is 688the empty string. The function return is always based on the current 689locale, whereas using locale rules is optional with the regular 690expression, based on pragmas in effect and pattern modifiers (see 691L<perlre/Character set modifiers> and L<perlre/Which character set 692modifier is in effect?>). 693 694The function returns C<TRUE> if the input string is empty, or if the 695corresponding C function returns C<TRUE> for every byte in the string. 696 697Do B<not> use C</[a-z]/> unless you don't care about the current locale. 698 699=item C<isprint> 700 701Deprecated function whose use raises a warning, and which is slated to 702be removed in a future Perl version. It is very similar to matching 703against S<C<qr/ ^ [[:print:]]+ $ /x>>, which you should convert to use 704instead. The function is deprecated because 1) it doesn't handle UTF-8 705encoded strings properly; and 2) it returns C<TRUE> even if the input is 706the empty string. The function return is always based on the current 707locale, whereas using locale rules is optional with the regular 708expression, based on pragmas in effect and pattern modifiers (see 709L<perlre/Character set modifiers> and L<perlre/Which character set 710modifier is in effect?>). 711 712The function returns C<TRUE> if the input string is empty, or if the 713corresponding C function returns C<TRUE> for every byte in the string. 714 715=item C<ispunct> 716 717Deprecated function whose use raises a warning, and which is slated to 718be removed in a future Perl version. It is very similar to matching 719against S<C<qr/ ^ [[:punct:]]+ $ /x>>, which you should convert to use 720instead. The function is deprecated because 1) it doesn't handle UTF-8 721encoded strings properly; and 2) it returns C<TRUE> even if the input is 722the empty string. The function return is always based on the current 723locale, whereas using locale rules is optional with the regular 724expression, based on pragmas in effect and pattern modifiers (see 725L<perlre/Character set modifiers> and L<perlre/Which character set 726modifier is in effect?>). 727 728The function returns C<TRUE> if the input string is empty, or if the 729corresponding C function returns C<TRUE> for every byte in the string. 730 731=item C<isspace> 732 733Deprecated function whose use raises a warning, and which is slated to 734be removed in a future Perl version. It is very similar to matching 735against S<C<qr/ ^ [[:space:]]+ $ /x>>, which you should convert to use 736instead. The function is deprecated because 1) it doesn't handle UTF-8 737encoded strings properly; and 2) it returns C<TRUE> even if the input is 738the empty string. The function return is always based on the current 739locale, whereas using locale rules is optional with the regular 740expression, based on pragmas in effect and pattern modifiers (see 741L<perlre/Character set modifiers> and L<perlre/Which character set 742modifier is in effect?>). 743 744The function returns C<TRUE> if the input string is empty, or if the 745corresponding C function returns C<TRUE> for every byte in the string. 746 747You may want to use the C<L<E<sol>\sE<sol>|perlrecharclass/Whitespace>> 748construct instead. 749 750=item C<isupper> 751 752Deprecated function whose use raises a warning, and which is slated to 753be removed in a future Perl version. It is very similar to matching 754against S<C<qr/ ^ [[:upper:]]+ $ /x>>, which you should convert to use 755instead. The function is deprecated because 1) it doesn't handle UTF-8 756encoded strings properly; and 2) it returns C<TRUE> even if the input is 757the empty string. The function return is always based on the current 758locale, whereas using locale rules is optional with the regular 759expression, based on pragmas in effect and pattern modifiers (see 760L<perlre/Character set modifiers> and L<perlre/Which character set 761modifier is in effect?>). 762 763The function returns C<TRUE> if the input string is empty, or if the 764corresponding C function returns C<TRUE> for every byte in the string. 765 766Do B<not> use C</[A-Z]/> unless you don't care about the current locale. 767 768=item C<isxdigit> 769 770Deprecated function whose use raises a warning, and which is slated to 771be removed in a future Perl version. It is very similar to matching 772against S<C<qr/ ^ [[:xdigit:]]+ $ /x>>, which you should convert to use 773instead. The function is deprecated because 1) it doesn't handle UTF-8 774encoded strings properly; and 2) it returns C<TRUE> even if the input is 775the empty string. The function return is always based on the current 776locale, whereas using locale rules is optional with the regular 777expression, based on pragmas in effect and pattern modifiers (see 778L<perlre/Character set modifiers> and L<perlre/Which character set 779modifier is in effect?>). 780 781The function returns C<TRUE> if the input string is empty, or if the 782corresponding C function returns C<TRUE> for every byte in the string. 783 784=item C<kill> 785 786This is identical to Perl's builtin C<kill()> function for sending 787signals to processes (often to terminate them), see L<perlfunc/kill>. 788 789=item C<labs> 790 791(For returning absolute values of long integers.) 792C<labs()> is C-specific, see L<perlfunc/abs> instead. 793 794=item C<lchown> 795 796This is identical to the C function, except the order of arguments is 797consistent with Perl's builtin C<chown()> with the added restriction 798of only one path, not an list of paths. Does the same thing as the 799C<chown()> function but changes the owner of a symbolic link instead 800of the file the symbolic link points to. 801 802=item C<ldexp> 803 804This is identical to the C function C<ldexp()> 805for multiplying floating point numbers with powers of two. 806 807 $x_quadrupled = POSIX::ldexp($x, 2); 808 809=item C<ldiv> 810 811(For computing dividends of long integers.) 812C<ldiv()> is C-specific, use C</> and C<int()> instead. 813 814=item C<link> 815 816This is identical to Perl's builtin C<link()> function 817for creating hard links into files, see L<perlfunc/link>. 818 819=item C<localeconv> 820 821Get numeric formatting information. Returns a reference to a hash 822containing the current locale formatting values. Users of this function 823should also read L<perllocale>, which provides a comprehensive 824discussion of Perl locale handling, including 825L<a section devoted to this function|perllocale/The localeconv function>. 826 827Here is how to query the database for the B<de> (Deutsch or German) locale. 828 829 my $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); 830 print "Locale: \"$loc\"\n"; 831 my $lconv = POSIX::localeconv(); 832 foreach my $property (qw( 833 decimal_point 834 thousands_sep 835 grouping 836 int_curr_symbol 837 currency_symbol 838 mon_decimal_point 839 mon_thousands_sep 840 mon_grouping 841 positive_sign 842 negative_sign 843 int_frac_digits 844 frac_digits 845 p_cs_precedes 846 p_sep_by_space 847 n_cs_precedes 848 n_sep_by_space 849 p_sign_posn 850 n_sign_posn 851 int_p_cs_precedes 852 int_p_sep_by_space 853 int_n_cs_precedes 854 int_n_sep_by_space 855 int_p_sign_posn 856 int_n_sign_posn 857 )) 858 { 859 printf qq(%s: "%s",\n), 860 $property, $lconv->{$property}; 861 } 862 863=item C<localtime> 864 865This is identical to Perl's builtin C<localtime()> function for 866converting seconds since the epoch to a date see L<perlfunc/localtime>. 867 868=item C<log> 869 870This is identical to Perl's builtin C<log()> function, 871returning the natural (I<e>-based) logarithm of the numerical argument, 872see L<perlfunc/log>. 873 874=item C<log10> 875 876This is identical to the C function C<log10()>, 877returning the 10-base logarithm of the numerical argument. 878You can also use 879 880 sub log10 { log($_[0]) / log(10) } 881 882or 883 884 sub log10 { log($_[0]) / 2.30258509299405 } 885 886or 887 888 sub log10 { log($_[0]) * 0.434294481903252 } 889 890=item C<longjmp> 891 892C<longjmp()> is C-specific: use L<perlfunc/die> instead. 893 894=item C<lseek> 895 896Move the file's read/write position. This uses file descriptors such as 897those obtained by calling C<POSIX::open>. 898 899 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 900 $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET ); 901 902Returns C<undef> on failure. 903 904=item C<malloc> 905 906C<malloc()> is C-specific. Perl does memory management transparently. 907 908=item C<mblen> 909 910This is identical to the C function C<mblen()>. 911Perl does not have any support for the wide and multibyte 912characters of the C standards, so this might be a rather 913useless function. 914 915=item C<mbstowcs> 916 917This is identical to the C function C<mbstowcs()>. 918Perl does not have any support for the wide and multibyte 919characters of the C standards, so this might be a rather 920useless function. 921 922=item C<mbtowc> 923 924This is identical to the C function C<mbtowc()>. 925Perl does not have any support for the wide and multibyte 926characters of the C standards, so this might be a rather 927useless function. 928 929=item C<memchr> 930 931C<memchr()> is C-specific, see L<perlfunc/index> instead. 932 933=item C<memcmp> 934 935C<memcmp()> is C-specific, use C<eq> instead, see L<perlop>. 936 937=item C<memcpy> 938 939C<memcpy()> is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. 940 941=item C<memmove> 942 943C<memmove()> is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. 944 945=item C<memset> 946 947C<memset()> is C-specific, use C<x> instead, see L<perlop>. 948 949=item C<mkdir> 950 951This is identical to Perl's builtin C<mkdir()> function 952for creating directories, see L<perlfunc/mkdir>. 953 954=item C<mkfifo> 955 956This is similar to the C function C<mkfifo()> for creating 957FIFO special files. 958 959 if (mkfifo($path, $mode)) { .... 960 961Returns C<undef> on failure. The C<$mode> is similar to the 962mode of C<mkdir()>, see L<perlfunc/mkdir>, though for C<mkfifo> 963you B<must> specify the C<$mode>. 964 965=item C<mktime> 966 967Convert date/time info to a calendar time. 968 969Synopsis: 970 971 mktime(sec, min, hour, mday, mon, year, wday = 0, 972 yday = 0, isdst = -1) 973 974The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. 975I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The 976year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the 977year 2001 is 101. Consult your system's C<mktime()> manpage for details 978about these and the other arguments. 979 980Calendar time for December 12, 1995, at 10:30 am. 981 982 $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); 983 print "Date = ", POSIX::ctime($time_t); 984 985Returns C<undef> on failure. 986 987=item C<modf> 988 989Return the integral and fractional parts of a floating-point number. 990 991 ($fractional, $integral) = POSIX::modf( 3.14 ); 992 993=item C<nice> 994 995This is similar to the C function C<nice()>, for changing 996the scheduling preference of the current process. Positive 997arguments mean more polite process, negative values more 998needy process. Normal user processes can only be more polite. 999 1000Returns C<undef> on failure. 1001 1002=item C<offsetof> 1003 1004C<offsetof()> is C-specific, you probably want to see L<perlfunc/pack> instead. 1005 1006=item C<open> 1007 1008Open a file for reading for writing. This returns file descriptors, not 1009Perl filehandles. Use C<POSIX::close> to close the file. 1010 1011Open a file read-only with mode 0666. 1012 1013 $fd = POSIX::open( "foo" ); 1014 1015Open a file for read and write. 1016 1017 $fd = POSIX::open( "foo", &POSIX::O_RDWR ); 1018 1019Open a file for write, with truncation. 1020 1021 $fd = POSIX::open( 1022 "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC 1023 ); 1024 1025Create a new file with mode 0640. Set up the file for writing. 1026 1027 $fd = POSIX::open( 1028 "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 1029 ); 1030 1031Returns C<undef> on failure. 1032 1033See also L<perlfunc/sysopen>. 1034 1035=item C<opendir> 1036 1037Open a directory for reading. 1038 1039 $dir = POSIX::opendir( "/var" ); 1040 @files = POSIX::readdir( $dir ); 1041 POSIX::closedir( $dir ); 1042 1043Returns C<undef> on failure. 1044 1045=item C<pathconf> 1046 1047Retrieves the value of a configurable limit on a file or directory. 1048 1049The following will determine the maximum length of the longest allowable 1050pathname on the filesystem which holds C</var>. 1051 1052 $path_max = POSIX::pathconf( "/var", 1053 &POSIX::_PC_PATH_MAX ); 1054 1055Returns C<undef> on failure. 1056 1057=item C<pause> 1058 1059This is similar to the C function C<pause()>, which suspends 1060the execution of the current process until a signal is received. 1061 1062Returns C<undef> on failure. 1063 1064=item C<perror> 1065 1066This is identical to the C function C<perror()>, which outputs to the 1067standard error stream the specified message followed by C<": "> and the 1068current error string. Use the C<warn()> function and the C<$!> 1069variable instead, see L<perlfunc/warn> and L<perlvar/$ERRNO>. 1070 1071=item C<pipe> 1072 1073Create an interprocess channel. This returns file descriptors like those 1074returned by C<POSIX::open>. 1075 1076 my ($read, $write) = POSIX::pipe(); 1077 POSIX::write( $write, "hello", 5 ); 1078 POSIX::read( $read, $buf, 5 ); 1079 1080See also L<perlfunc/pipe>. 1081 1082=item C<pow> 1083 1084Computes C<$x> raised to the power C<$exponent>. 1085 1086 $ret = POSIX::pow( $x, $exponent ); 1087 1088You can also use the C<**> operator, see L<perlop>. 1089 1090=item C<printf> 1091 1092Formats and prints the specified arguments to STDOUT. 1093See also L<perlfunc/printf>. 1094 1095=item C<putc> 1096 1097C<putc()> is C-specific, see L<perlfunc/print> instead. 1098 1099=item C<putchar> 1100 1101C<putchar()> is C-specific, see L<perlfunc/print> instead. 1102 1103=item C<puts> 1104 1105C<puts()> is C-specific, see L<perlfunc/print> instead. 1106 1107=item C<qsort> 1108 1109C<qsort()> is C-specific, see L<perlfunc/sort> instead. 1110 1111=item C<raise> 1112 1113Sends the specified signal to the current process. 1114See also L<perlfunc/kill> and the C<$$> in L<perlvar/$PID>. 1115 1116=item C<rand> 1117 1118C<rand()> is non-portable, see L<perlfunc/rand> instead. 1119 1120=item C<read> 1121 1122Read from a file. This uses file descriptors such as those obtained by 1123calling C<POSIX::open>. If the buffer C<$buf> is not large enough for the 1124read then Perl will extend it to make room for the request. 1125 1126 $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); 1127 $bytes = POSIX::read( $fd, $buf, 3 ); 1128 1129Returns C<undef> on failure. 1130 1131See also L<perlfunc/sysread>. 1132 1133=item C<readdir> 1134 1135This is identical to Perl's builtin C<readdir()> function 1136for reading directory entries, see L<perlfunc/readdir>. 1137 1138=item C<realloc> 1139 1140C<realloc()> is C-specific. Perl does memory management transparently. 1141 1142=item C<remove> 1143 1144This is identical to Perl's builtin C<unlink()> function 1145for removing files, see L<perlfunc/unlink>. 1146 1147=item C<rename> 1148 1149This is identical to Perl's builtin C<rename()> function 1150for renaming files, see L<perlfunc/rename>. 1151 1152=item C<rewind> 1153 1154Seeks to the beginning of the file. 1155 1156=item C<rewinddir> 1157 1158This is identical to Perl's builtin C<rewinddir()> function for 1159rewinding directory entry streams, see L<perlfunc/rewinddir>. 1160 1161=item C<rmdir> 1162 1163This is identical to Perl's builtin C<rmdir()> function 1164for removing (empty) directories, see L<perlfunc/rmdir>. 1165 1166=item C<scanf> 1167 1168C<scanf()> is C-specific, use E<lt>E<gt> and regular expressions instead, 1169see L<perlre>. 1170 1171=item C<setgid> 1172 1173Sets the real group identifier and the effective group identifier for 1174this process. Similar to assigning a value to the Perl's builtin 1175C<$)> variable, see L<perlvar/$EGID>, except that the latter 1176will change only the real user identifier, and that the setgid() 1177uses only a single numeric argument, as opposed to a space-separated 1178list of numbers. 1179 1180=item C<setjmp> 1181 1182C<setjmp()> is C-specific: use C<eval {}> instead, 1183see L<perlfunc/eval>. 1184 1185=item C<setlocale> 1186 1187Modifies and queries the program's underlying locale. Users of this 1188function should read L<perllocale>, whch provides a comprehensive 1189discussion of Perl locale handling, knowledge of which is necessary to 1190properly use this function. It contains 1191L<a section devoted to this function|perllocale/The setlocale function>. 1192The discussion here is merely a summary reference for C<setlocale()>. 1193Note that Perl itself is almost entirely unaffected by the locale 1194except within the scope of S<C<"use locale">>. (Exceptions are listed 1195in L<perllocale/Not within the scope of any "use locale" variant>.) 1196 1197The following examples assume 1198 1199 use POSIX qw(setlocale LC_ALL LC_CTYPE); 1200 1201has been issued. 1202 1203The following will set the traditional UNIX system locale behavior 1204(the second argument C<"C">). 1205 1206 $loc = setlocale( LC_ALL, "C" ); 1207 1208The following will query the current C<LC_CTYPE> category. (No second 1209argument means 'query'.) 1210 1211 $loc = setlocale( LC_CTYPE ); 1212 1213The following will set the C<LC_CTYPE> behaviour according to the locale 1214environment variables (the second argument C<"">). 1215Please see your system's C<setlocale(3)> documentation for the locale 1216environment variables' meaning or consult L<perllocale>. 1217 1218 $loc = setlocale( LC_CTYPE, "" ); 1219 1220The following will set the C<LC_COLLATE> behaviour to Argentinian 1221Spanish. B<NOTE>: The naming and availability of locales depends on 1222your operating system. Please consult L<perllocale> for how to find 1223out which locales are available in your system. 1224 1225 $loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" ); 1226 1227=item C<setpgid> 1228 1229This is similar to the C function C<setpgid()> for 1230setting the process group identifier of the current process. 1231 1232Returns C<undef> on failure. 1233 1234=item C<setsid> 1235 1236This is identical to the C function C<setsid()> for 1237setting the session identifier of the current process. 1238 1239=item C<setuid> 1240 1241Sets the real user identifier and the effective user identifier for 1242this process. Similar to assigning a value to the Perl's builtin 1243C<$E<lt>> variable, see L<perlvar/$UID>, except that the latter 1244will change only the real user identifier. 1245 1246=item C<sigaction> 1247 1248Detailed signal management. This uses C<POSIX::SigAction> objects for 1249the C<action> and C<oldaction> arguments (the oldaction can also be 1250just a hash reference). Consult your system's C<sigaction> manpage 1251for details, see also C<POSIX::SigRt>. 1252 1253Synopsis: 1254 1255 sigaction(signal, action, oldaction = 0) 1256 1257Returns C<undef> on failure. The C<signal> must be a number (like 1258C<SIGHUP>), not a string (like C<"SIGHUP">), though Perl does try hard 1259to understand you. 1260 1261If you use the C<SA_SIGINFO> flag, the signal handler will in addition to 1262the first argument, the signal name, also receive a second argument, a 1263hash reference, inside which are the following keys with the following 1264semantics, as defined by POSIX/SUSv3: 1265 1266 signo the signal number 1267 errno the error number 1268 code if this is zero or less, the signal was sent by 1269 a user process and the uid and pid make sense, 1270 otherwise the signal was sent by the kernel 1271 1272The following are also defined by POSIX/SUSv3, but unfortunately 1273not very widely implemented: 1274 1275 pid the process id generating the signal 1276 uid the uid of the process id generating the signal 1277 status exit value or signal for SIGCHLD 1278 band band event for SIGPOLL 1279 1280A third argument is also passed to the handler, which contains a copy 1281of the raw binary contents of the C<siginfo> structure: if a system has 1282some non-POSIX fields, this third argument is where to C<unpack()> them 1283from. 1284 1285Note that not all C<siginfo> values make sense simultaneously (some are 1286valid only for certain signals, for example), and not all values make 1287sense from Perl perspective, you should to consult your system's 1288C<sigaction> and possibly also C<siginfo> documentation. 1289 1290=item C<siglongjmp> 1291 1292C<siglongjmp()> is C-specific: use L<perlfunc/die> instead. 1293 1294=item C<sigpending> 1295 1296Examine signals that are blocked and pending. This uses C<POSIX::SigSet> 1297objects for the C<sigset> argument. Consult your system's C<sigpending> 1298manpage for details. 1299 1300Synopsis: 1301 1302 sigpending(sigset) 1303 1304Returns C<undef> on failure. 1305 1306=item C<sigprocmask> 1307 1308Change and/or examine calling process's signal mask. This uses 1309C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments. 1310Consult your system's C<sigprocmask> manpage for details. 1311 1312Synopsis: 1313 1314 sigprocmask(how, sigset, oldsigset = 0) 1315 1316Returns C<undef> on failure. 1317 1318Note that you can't reliably block or unblock a signal from its own signal 1319handler if you're using safe signals. Other signals can be blocked or unblocked 1320reliably. 1321 1322=item C<sigsetjmp> 1323 1324C<sigsetjmp()> is C-specific: use C<eval {}> instead, 1325see L<perlfunc/eval>. 1326 1327=item C<sigsuspend> 1328 1329Install a signal mask and suspend process until signal arrives. This uses 1330C<POSIX::SigSet> objects for the C<signal_mask> argument. Consult your 1331system's C<sigsuspend> manpage for details. 1332 1333Synopsis: 1334 1335 sigsuspend(signal_mask) 1336 1337Returns C<undef> on failure. 1338 1339=item C<sin> 1340 1341This is identical to Perl's builtin C<sin()> function 1342for returning the sine of the numerical argument, 1343see L<perlfunc/sin>. See also L<Math::Trig>. 1344 1345=item C<sinh> 1346 1347This is identical to the C function C<sinh()> 1348for returning the hyperbolic sine of the numerical argument. 1349See also L<Math::Trig>. 1350 1351=item C<sleep> 1352 1353This is functionally identical to Perl's builtin C<sleep()> function 1354for suspending the execution of the current for process for certain 1355number of seconds, see L<perlfunc/sleep>. There is one significant 1356difference, however: C<POSIX::sleep()> returns the number of 1357B<unslept> seconds, while the C<CORE::sleep()> returns the 1358number of slept seconds. 1359 1360=item C<sprintf> 1361 1362This is similar to Perl's builtin C<sprintf()> function 1363for returning a string that has the arguments formatted as requested, 1364see L<perlfunc/sprintf>. 1365 1366=item C<sqrt> 1367 1368This is identical to Perl's builtin C<sqrt()> function. 1369for returning the square root of the numerical argument, 1370see L<perlfunc/sqrt>. 1371 1372=item C<srand> 1373 1374Give a seed the pseudorandom number generator, see L<perlfunc/srand>. 1375 1376=item C<sscanf> 1377 1378C<sscanf()> is C-specific, use regular expressions instead, 1379see L<perlre>. 1380 1381=item C<stat> 1382 1383This is identical to Perl's builtin C<stat()> function 1384for returning information about files and directories. 1385 1386=item C<strcat> 1387 1388C<strcat()> is C-specific, use C<.=> instead, see L<perlop>. 1389 1390=item C<strchr> 1391 1392C<strchr()> is C-specific, see L<perlfunc/index> instead. 1393 1394=item C<strcmp> 1395 1396C<strcmp()> is C-specific, use C<eq> or C<cmp> instead, see L<perlop>. 1397 1398=item C<strcoll> 1399 1400This is identical to the C function C<strcoll()> 1401for collating (comparing) strings transformed using 1402the C<strxfrm()> function. Not really needed since 1403Perl can do this transparently, see L<perllocale>. 1404 1405=item C<strcpy> 1406 1407C<strcpy()> is C-specific, use C<=> instead, see L<perlop>. 1408 1409=item C<strcspn> 1410 1411C<strcspn()> is C-specific, use regular expressions instead, 1412see L<perlre>. 1413 1414=item C<strerror> 1415 1416Returns the error string for the specified errno. 1417Identical to the string form of the C<$!>, see L<perlvar/$ERRNO>. 1418 1419=item C<strftime> 1420 1421Convert date and time information to string. Returns the string. 1422 1423Synopsis: 1424 1425 strftime(fmt, sec, min, hour, mday, mon, year, 1426 wday = -1, yday = -1, isdst = -1) 1427 1428The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. 1429I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The 1430year (C<year>) is given in years since 1900. I.e., the year 1995 is 95; the 1431year 2001 is 101. Consult your system's C<strftime()> manpage for details 1432about these and the other arguments. 1433 1434If you want your code to be portable, your format (C<fmt>) argument 1435should use only the conversion specifiers defined by the ANSI C 1436standard (C89, to play safe). These are C<aAbBcdHIjmMpSUwWxXyYZ%>. 1437But even then, the B<results> of some of the conversion specifiers are 1438non-portable. For example, the specifiers C<aAbBcpZ> change according 1439to the locale settings of the user, and both how to set locales (the 1440locale names) and what output to expect are non-standard. 1441The specifier C<c> changes according to the timezone settings of the 1442user and the timezone computation rules of the operating system. 1443The C<Z> specifier is notoriously unportable since the names of 1444timezones are non-standard. Sticking to the numeric specifiers is the 1445safest route. 1446 1447The given arguments are made consistent as though by calling 1448C<mktime()> before calling your system's C<strftime()> function, 1449except that the C<isdst> value is not affected. 1450 1451The string for Tuesday, December 12, 1995. 1452 1453 $str = POSIX::strftime( "%A, %B %d, %Y", 1454 0, 0, 0, 12, 11, 95, 2 ); 1455 print "$str\n"; 1456 1457=item C<strlen> 1458 1459C<strlen()> is C-specific, use C<length()> instead, see L<perlfunc/length>. 1460 1461=item C<strncat> 1462 1463C<strncat()> is C-specific, use C<.=> instead, see L<perlop>. 1464 1465=item C<strncmp> 1466 1467C<strncmp()> is C-specific, use C<eq> instead, see L<perlop>. 1468 1469=item C<strncpy> 1470 1471C<strncpy()> is C-specific, use C<=> instead, see L<perlop>. 1472 1473=item C<strpbrk> 1474 1475C<strpbrk()> is C-specific, use regular expressions instead, 1476see L<perlre>. 1477 1478=item C<strrchr> 1479 1480C<strrchr()> is C-specific, see L<perlfunc/rindex> instead. 1481 1482=item C<strspn> 1483 1484C<strspn()> is C-specific, use regular expressions instead, 1485see L<perlre>. 1486 1487=item C<strstr> 1488 1489This is identical to Perl's builtin C<index()> function, 1490see L<perlfunc/index>. 1491 1492=item C<strtod> 1493 1494String to double translation. Returns the parsed number and the number 1495of characters in the unparsed portion of the string. Truly 1496POSIX-compliant systems set C<$!> (C<$ERRNO>) to indicate a translation 1497error, so clear C<$!> before calling strtod. However, non-POSIX systems 1498may not check for overflow, and therefore will never set C<$!>. 1499 1500strtod respects any POSIX I<setlocale()> C<LC_TIME> settings, 1501regardless of whether or not it is called from Perl code that is within 1502the scope of S<C<use locale>>. 1503 1504To parse a string C<$str> as a floating point number use 1505 1506 $! = 0; 1507 ($num, $n_unparsed) = POSIX::strtod($str); 1508 1509The second returned item and C<$!> can be used to check for valid input: 1510 1511 if (($str eq '') || ($n_unparsed != 0) || $!) { 1512 die "Non-numeric input $str" . ($! ? ": $!\n" : "\n"); 1513 } 1514 1515When called in a scalar context strtod returns the parsed number. 1516 1517=item C<strtok> 1518 1519C<strtok()> is C-specific, use regular expressions instead, see 1520L<perlre>, or L<perlfunc/split>. 1521 1522=item C<strtol> 1523 1524String to (long) integer translation. Returns the parsed number and 1525the number of characters in the unparsed portion of the string. Truly 1526POSIX-compliant systems set C<$!> (C<$ERRNO>) to indicate a translation 1527error, so clear C<$!> before calling C<strtol>. However, non-POSIX systems 1528may not check for overflow, and therefore will never set C<$!>. 1529 1530C<strtol> should respect any POSIX I<setlocale()> settings. 1531 1532To parse a string C<$str> as a number in some base C<$base> use 1533 1534 $! = 0; 1535 ($num, $n_unparsed) = POSIX::strtol($str, $base); 1536 1537The base should be zero or between 2 and 36, inclusive. When the base 1538is zero or omitted strtol will use the string itself to determine the 1539base: a leading "0x" or "0X" means hexadecimal; a leading "0" means 1540octal; any other leading characters mean decimal. Thus, "1234" is 1541parsed as a decimal number, "01234" as an octal number, and "0x1234" 1542as a hexadecimal number. 1543 1544The second returned item and C<$!> can be used to check for valid input: 1545 1546 if (($str eq '') || ($n_unparsed != 0) || !$!) { 1547 die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; 1548 } 1549 1550When called in a scalar context strtol returns the parsed number. 1551 1552=item C<strtoul> 1553 1554String to unsigned (long) integer translation. C<strtoul()> is identical 1555to C<strtol()> except that C<strtoul()> only parses unsigned integers. See 1556L</strtol> for details. 1557 1558Note: Some vendors supply C<strtod()> and C<strtol()> but not C<strtoul()>. 1559Other vendors that do supply C<strtoul()> parse "-1" as a valid value. 1560 1561=item C<strxfrm> 1562 1563String transformation. Returns the transformed string. 1564 1565 $dst = POSIX::strxfrm( $src ); 1566 1567Used in conjunction with the C<strcoll()> function, see L</strcoll>. 1568 1569Not really needed since Perl can do this transparently, see 1570L<perllocale>. 1571 1572=item C<sysconf> 1573 1574Retrieves values of system configurable variables. 1575 1576The following will get the machine's clock speed. 1577 1578 $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK ); 1579 1580Returns C<undef> on failure. 1581 1582=item C<system> 1583 1584This is identical to Perl's builtin C<system()> function, see 1585L<perlfunc/system>. 1586 1587=item C<tan> 1588 1589This is identical to the C function C<tan()>, returning the 1590tangent of the numerical argument. See also L<Math::Trig>. 1591 1592=item C<tanh> 1593 1594This is identical to the C function C<tanh()>, returning the 1595hyperbolic tangent of the numerical argument. See also L<Math::Trig>. 1596 1597=item C<tcdrain> 1598 1599This is similar to the C function C<tcdrain()> for draining 1600the output queue of its argument stream. 1601 1602Returns C<undef> on failure. 1603 1604=item C<tcflow> 1605 1606This is similar to the C function C<tcflow()> for controlling 1607the flow of its argument stream. 1608 1609Returns C<undef> on failure. 1610 1611=item C<tcflush> 1612 1613This is similar to the C function C<tcflush()> for flushing 1614the I/O buffers of its argument stream. 1615 1616Returns C<undef> on failure. 1617 1618=item C<tcgetpgrp> 1619 1620This is identical to the C function C<tcgetpgrp()> for returning the 1621process group identifier of the foreground process group of the controlling 1622terminal. 1623 1624=item C<tcsendbreak> 1625 1626This is similar to the C function C<tcsendbreak()> for sending 1627a break on its argument stream. 1628 1629Returns C<undef> on failure. 1630 1631=item C<tcsetpgrp> 1632 1633This is similar to the C function C<tcsetpgrp()> for setting the 1634process group identifier of the foreground process group of the controlling 1635terminal. 1636 1637Returns C<undef> on failure. 1638 1639=item C<time> 1640 1641This is identical to Perl's builtin C<time()> function 1642for returning the number of seconds since the epoch 1643(whatever it is for the system), see L<perlfunc/time>. 1644 1645=item C<times> 1646 1647The C<times()> function returns elapsed realtime since some point in the past 1648(such as system startup), user and system times for this process, and user 1649and system times used by child processes. All times are returned in clock 1650ticks. 1651 1652 ($realtime, $user, $system, $cuser, $csystem) 1653 = POSIX::times(); 1654 1655Note: Perl's builtin C<times()> function returns four values, measured in 1656seconds. 1657 1658=item C<tmpfile> 1659 1660Use method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>. 1661 1662=item C<tmpnam> 1663 1664Returns a name for a temporary file. 1665 1666 $tmpfile = POSIX::tmpnam(); 1667 1668For security reasons, which are probably detailed in your system's 1669documentation for the C library C<tmpnam()> function, this interface 1670should not be used; instead see L<File::Temp>. 1671 1672=item C<tolower> 1673 1674This is identical to the C function, except that it can apply to a single 1675character or to a whole string. Consider using the C<lc()> function, 1676see L<perlfunc/lc>, or the equivalent C<\L> operator inside doublequotish 1677strings. 1678 1679=item C<toupper> 1680 1681This is identical to the C function, except that it can apply to a single 1682character or to a whole string. Consider using the C<uc()> function, 1683see L<perlfunc/uc>, or the equivalent C<\U> operator inside doublequotish 1684strings. 1685 1686=item C<ttyname> 1687 1688This is identical to the C function C<ttyname()> for returning the 1689name of the current terminal. 1690 1691=item C<tzname> 1692 1693Retrieves the time conversion information from the C<tzname> variable. 1694 1695 POSIX::tzset(); 1696 ($std, $dst) = POSIX::tzname(); 1697 1698=item C<tzset> 1699 1700This is identical to the C function C<tzset()> for setting 1701the current timezone based on the environment variable C<TZ>, 1702to be used by C<ctime()>, C<localtime()>, C<mktime()>, and C<strftime()> 1703functions. 1704 1705=item C<umask> 1706 1707This is identical to Perl's builtin C<umask()> function 1708for setting (and querying) the file creation permission mask, 1709see L<perlfunc/umask>. 1710 1711=item C<uname> 1712 1713Get name of current operating system. 1714 1715 ($sysname, $nodename, $release, $version, $machine) 1716 = POSIX::uname(); 1717 1718Note that the actual meanings of the various fields are not 1719that well standardized, do not expect any great portability. 1720The C<$sysname> might be the name of the operating system, 1721the C<$nodename> might be the name of the host, the C<$release> 1722might be the (major) release number of the operating system, 1723the C<$version> might be the (minor) release number of the 1724operating system, and the C<$machine> might be a hardware identifier. 1725Maybe. 1726 1727=item C<ungetc> 1728 1729Use method C<IO::Handle::ungetc()> instead. 1730 1731=item C<unlink> 1732 1733This is identical to Perl's builtin C<unlink()> function 1734for removing files, see L<perlfunc/unlink>. 1735 1736=item C<utime> 1737 1738This is identical to Perl's builtin C<utime()> function 1739for changing the time stamps of files and directories, 1740see L<perlfunc/utime>. 1741 1742=item C<vfprintf> 1743 1744C<vfprintf()> is C-specific, see L<perlfunc/printf> instead. 1745 1746=item C<vprintf> 1747 1748C<vprintf()> is C-specific, see L<perlfunc/printf> instead. 1749 1750=item C<vsprintf> 1751 1752C<vsprintf()> is C-specific, see L<perlfunc/sprintf> instead. 1753 1754=item C<wait> 1755 1756This is identical to Perl's builtin C<wait()> function, 1757see L<perlfunc/wait>. 1758 1759=item C<waitpid> 1760 1761Wait for a child process to change state. This is identical to Perl's 1762builtin C<waitpid()> function, see L<perlfunc/waitpid>. 1763 1764 $pid = POSIX::waitpid( -1, POSIX::WNOHANG ); 1765 print "status = ", ($? / 256), "\n"; 1766 1767=item C<wcstombs> 1768 1769This is identical to the C function C<wcstombs()>. 1770Perl does not have any support for the wide and multibyte 1771characters of the C standards, so this might be a rather 1772useless function. 1773 1774=item C<wctomb> 1775 1776This is identical to the C function C<wctomb()>. 1777Perl does not have any support for the wide and multibyte 1778characters of the C standards, so this might be a rather 1779useless function. 1780 1781=item C<write> 1782 1783Write to a file. This uses file descriptors such as those obtained by 1784calling C<POSIX::open>. 1785 1786 $fd = POSIX::open( "foo", &POSIX::O_WRONLY ); 1787 $buf = "hello"; 1788 $bytes = POSIX::write( $fd, $buf, 5 ); 1789 1790Returns C<undef> on failure. 1791 1792See also L<perlfunc/syswrite>. 1793 1794=back 1795 1796=head1 CLASSES 1797 1798=head2 C<POSIX::SigAction> 1799 1800=over 8 1801 1802=item C<new> 1803 1804Creates a new C<POSIX::SigAction> object which corresponds to the C 1805C<struct sigaction>. This object will be destroyed automatically when 1806it is no longer needed. The first parameter is the handler, a sub 1807reference. The second parameter is a C<POSIX::SigSet> object, it 1808defaults to the empty set. The third parameter contains the 1809C<sa_flags>, it defaults to 0. 1810 1811 $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); 1812 $sigaction = POSIX::SigAction->new( 1813 \&handler, $sigset, &POSIX::SA_NOCLDSTOP 1814 ); 1815 1816This C<POSIX::SigAction> object is intended for use with the C<POSIX::sigaction()> 1817function. 1818 1819=back 1820 1821=over 8 1822 1823=item C<handler> 1824 1825=item C<mask> 1826 1827=item C<flags> 1828 1829accessor functions to get/set the values of a SigAction object. 1830 1831 $sigset = $sigaction->mask; 1832 $sigaction->flags(&POSIX::SA_RESTART); 1833 1834=item C<safe> 1835 1836accessor function for the "safe signals" flag of a SigAction object; see 1837L<perlipc> for general information on safe (a.k.a. "deferred") signals. If 1838you wish to handle a signal safely, use this accessor to set the "safe" flag 1839in the C<POSIX::SigAction> object: 1840 1841 $sigaction->safe(1); 1842 1843You may also examine the "safe" flag on the output action object which is 1844filled in when given as the third parameter to C<POSIX::sigaction()>: 1845 1846 sigaction(SIGINT, $new_action, $old_action); 1847 if ($old_action->safe) { 1848 # previous SIGINT handler used safe signals 1849 } 1850 1851=back 1852 1853=head2 C<POSIX::SigRt> 1854 1855=over 8 1856 1857=item C<%SIGRT> 1858 1859A hash of the POSIX realtime signal handlers. It is an extension of 1860the standard C<%SIG>, the C<$POSIX::SIGRT{SIGRTMIN}> is roughly equivalent 1861to C<$SIG{SIGRTMIN}>, but the right POSIX moves (see below) are made with 1862the C<POSIX::SigSet> and C<POSIX::sigaction> instead of accessing the C<%SIG>. 1863 1864You can set the C<%POSIX::SIGRT> elements to set the POSIX realtime 1865signal handlers, use C<delete> and C<exists> on the elements, and use 1866C<scalar> on the C<%POSIX::SIGRT> to find out how many POSIX realtime 1867signals there are available S<C<(SIGRTMAX - SIGRTMIN + 1>>, the C<SIGRTMAX> is 1868a valid POSIX realtime signal). 1869 1870Setting the C<%SIGRT> elements is equivalent to calling this: 1871 1872 sub new { 1873 my ($rtsig, $handler, $flags) = @_; 1874 my $sigset = POSIX::SigSet($rtsig); 1875 my $sigact = POSIX::SigAction->new($handler,$sigset,$flags); 1876 sigaction($rtsig, $sigact); 1877 } 1878 1879The flags default to zero, if you want something different you can 1880either use C<local> on C<$POSIX::SigRt::SIGACTION_FLAGS>, or you can 1881derive from POSIX::SigRt and define your own C<new()> (the tied hash 1882STORE method of the C<%SIGRT> calls C<new($rtsig, $handler, $SIGACTION_FLAGS)>, 1883where the C<$rtsig> ranges from zero to S<C<SIGRTMAX - SIGRTMIN + 1)>>. 1884 1885Just as with any signal, you can use C<sigaction($rtsig, undef, $oa)> to 1886retrieve the installed signal handler (or, rather, the signal action). 1887 1888B<NOTE:> whether POSIX realtime signals really work in your system, or 1889whether Perl has been compiled so that it works with them, is outside 1890of this discussion. 1891 1892=item C<SIGRTMIN> 1893 1894Return the minimum POSIX realtime signal number available, or C<undef> 1895if no POSIX realtime signals are available. 1896 1897=item C<SIGRTMAX> 1898 1899Return the maximum POSIX realtime signal number available, or C<undef> 1900if no POSIX realtime signals are available. 1901 1902=back 1903 1904=head2 C<POSIX::SigSet> 1905 1906=over 8 1907 1908=item C<new> 1909 1910Create a new SigSet object. This object will be destroyed automatically 1911when it is no longer needed. Arguments may be supplied to initialize the 1912set. 1913 1914Create an empty set. 1915 1916 $sigset = POSIX::SigSet->new; 1917 1918Create a set with C<SIGUSR1>. 1919 1920 $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 ); 1921 1922=item C<addset> 1923 1924Add a signal to a SigSet object. 1925 1926 $sigset->addset( &POSIX::SIGUSR2 ); 1927 1928Returns C<undef> on failure. 1929 1930=item C<delset> 1931 1932Remove a signal from the SigSet object. 1933 1934 $sigset->delset( &POSIX::SIGUSR2 ); 1935 1936Returns C<undef> on failure. 1937 1938=item C<emptyset> 1939 1940Initialize the SigSet object to be empty. 1941 1942 $sigset->emptyset(); 1943 1944Returns C<undef> on failure. 1945 1946=item C<fillset> 1947 1948Initialize the SigSet object to include all signals. 1949 1950 $sigset->fillset(); 1951 1952Returns C<undef> on failure. 1953 1954=item C<ismember> 1955 1956Tests the SigSet object to see if it contains a specific signal. 1957 1958 if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ 1959 print "contains SIGUSR1\n"; 1960 } 1961 1962=back 1963 1964=head2 C<POSIX::Termios> 1965 1966=over 8 1967 1968=item C<new> 1969 1970Create a new Termios object. This object will be destroyed automatically 1971when it is no longer needed. A Termios object corresponds to the termios 1972C struct. C<new()> mallocs a new one, C<getattr()> fills it from a file descriptor, 1973and C<setattr()> sets a file descriptor's parameters to match Termios' contents. 1974 1975 $termios = POSIX::Termios->new; 1976 1977=item C<getattr> 1978 1979Get terminal control attributes. 1980 1981Obtain the attributes for stdin. 1982 1983 $termios->getattr( 0 ) # Recommended for clarity. 1984 $termios->getattr() 1985 1986Obtain the attributes for stdout. 1987 1988 $termios->getattr( 1 ) 1989 1990Returns C<undef> on failure. 1991 1992=item C<getcc> 1993 1994Retrieve a value from the c_cc field of a termios object. The c_cc field is 1995an array so an index must be specified. 1996 1997 $c_cc[1] = $termios->getcc(1); 1998 1999=item C<getcflag> 2000 2001Retrieve the c_cflag field of a termios object. 2002 2003 $c_cflag = $termios->getcflag; 2004 2005=item C<getiflag> 2006 2007Retrieve the c_iflag field of a termios object. 2008 2009 $c_iflag = $termios->getiflag; 2010 2011=item C<getispeed> 2012 2013Retrieve the input baud rate. 2014 2015 $ispeed = $termios->getispeed; 2016 2017=item C<getlflag> 2018 2019Retrieve the c_lflag field of a termios object. 2020 2021 $c_lflag = $termios->getlflag; 2022 2023=item C<getoflag> 2024 2025Retrieve the c_oflag field of a termios object. 2026 2027 $c_oflag = $termios->getoflag; 2028 2029=item C<getospeed> 2030 2031Retrieve the output baud rate. 2032 2033 $ospeed = $termios->getospeed; 2034 2035=item C<setattr> 2036 2037Set terminal control attributes. 2038 2039Set attributes immediately for stdout. 2040 2041 $termios->setattr( 1, &POSIX::TCSANOW ); 2042 2043Returns C<undef> on failure. 2044 2045=item C<setcc> 2046 2047Set a value in the c_cc field of a termios object. The c_cc field is an 2048array so an index must be specified. 2049 2050 $termios->setcc( &POSIX::VEOF, 1 ); 2051 2052=item C<setcflag> 2053 2054Set the c_cflag field of a termios object. 2055 2056 $termios->setcflag( $c_cflag | &POSIX::CLOCAL ); 2057 2058=item C<setiflag> 2059 2060Set the c_iflag field of a termios object. 2061 2062 $termios->setiflag( $c_iflag | &POSIX::BRKINT ); 2063 2064=item C<setispeed> 2065 2066Set the input baud rate. 2067 2068 $termios->setispeed( &POSIX::B9600 ); 2069 2070Returns C<undef> on failure. 2071 2072=item C<setlflag> 2073 2074Set the c_lflag field of a termios object. 2075 2076 $termios->setlflag( $c_lflag | &POSIX::ECHO ); 2077 2078=item C<setoflag> 2079 2080Set the c_oflag field of a termios object. 2081 2082 $termios->setoflag( $c_oflag | &POSIX::OPOST ); 2083 2084=item C<setospeed> 2085 2086Set the output baud rate. 2087 2088 $termios->setospeed( &POSIX::B9600 ); 2089 2090Returns C<undef> on failure. 2091 2092=item Baud rate values 2093 2094C<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> 2095 2096=item Terminal interface values 2097 2098C<TCSADRAIN> C<TCSANOW> C<TCOON> C<TCIOFLUSH> C<TCOFLUSH> C<TCION> C<TCIFLUSH> C<TCSAFLUSH> C<TCIOFF> C<TCOOFF> 2099 2100=item C<c_cc> field values 2101 2102C<VEOF> C<VEOL> C<VERASE> C<VINTR> C<VKILL> C<VQUIT> C<VSUSP> C<VSTART> C<VSTOP> C<VMIN> C<VTIME> C<NCCS> 2103 2104=item C<c_cflag> field values 2105 2106C<CLOCAL> C<CREAD> C<CSIZE> C<CS5> C<CS6> C<CS7> C<CS8> C<CSTOPB> C<HUPCL> C<PARENB> C<PARODD> 2107 2108=item C<c_iflag> field values 2109 2110C<BRKINT> C<ICRNL> C<IGNBRK> C<IGNCR> C<IGNPAR> C<INLCR> C<INPCK> C<ISTRIP> C<IXOFF> C<IXON> C<PARMRK> 2111 2112=item C<c_lflag> field values 2113 2114C<ECHO> C<ECHOE> C<ECHOK> C<ECHONL> C<ICANON> C<IEXTEN> C<ISIG> C<NOFLSH> C<TOSTOP> 2115 2116=item C<c_oflag> field values 2117 2118C<OPOST> 2119 2120=back 2121 2122=head1 PATHNAME CONSTANTS 2123 2124=over 8 2125 2126=item Constants 2127 2128C<_PC_CHOWN_RESTRICTED> C<_PC_LINK_MAX> C<_PC_MAX_CANON> C<_PC_MAX_INPUT> C<_PC_NAME_MAX> 2129C<_PC_NO_TRUNC> C<_PC_PATH_MAX> C<_PC_PIPE_BUF> C<_PC_VDISABLE> 2130 2131=back 2132 2133=head1 POSIX CONSTANTS 2134 2135=over 8 2136 2137=item Constants 2138 2139C<_POSIX_ARG_MAX> C<_POSIX_CHILD_MAX> C<_POSIX_CHOWN_RESTRICTED> C<_POSIX_JOB_CONTROL> 2140C<_POSIX_LINK_MAX> C<_POSIX_MAX_CANON> C<_POSIX_MAX_INPUT> C<_POSIX_NAME_MAX> 2141C<_POSIX_NGROUPS_MAX> C<_POSIX_NO_TRUNC> C<_POSIX_OPEN_MAX> C<_POSIX_PATH_MAX> 2142C<_POSIX_PIPE_BUF> C<_POSIX_SAVED_IDS> C<_POSIX_SSIZE_MAX> C<_POSIX_STREAM_MAX> 2143C<_POSIX_TZNAME_MAX> C<_POSIX_VDISABLE> C<_POSIX_VERSION> 2144 2145=back 2146 2147=head1 SYSTEM CONFIGURATION 2148 2149=over 8 2150 2151=item Constants 2152 2153C<_SC_ARG_MAX> C<_SC_CHILD_MAX> C<_SC_CLK_TCK> C<_SC_JOB_CONTROL> C<_SC_NGROUPS_MAX> 2154C<_SC_OPEN_MAX> C<_SC_PAGESIZE> C<_SC_SAVED_IDS> C<_SC_STREAM_MAX> C<_SC_TZNAME_MAX> 2155C<_SC_VERSION> 2156 2157=back 2158 2159=head1 ERRNO 2160 2161=over 8 2162 2163=item Constants 2164 2165C<E2BIG> C<EACCES> C<EADDRINUSE> C<EADDRNOTAVAIL> C<EAFNOSUPPORT> C<EAGAIN> C<EALREADY> C<EBADF> C<EBADMSG> 2166C<EBUSY> C<ECANCELED> C<ECHILD> C<ECONNABORTED> C<ECONNREFUSED> C<ECONNRESET> C<EDEADLK> C<EDESTADDRREQ> 2167C<EDOM> C<EDQUOT> C<EEXIST> C<EFAULT> C<EFBIG> C<EHOSTDOWN> C<EHOSTUNREACH> C<EIDRM> C<EILSEQ> C<EINPROGRESS> 2168C<EINTR> C<EINVAL> C<EIO> C<EISCONN> C<EISDIR> C<ELOOP> C<EMFILE> C<EMLINK> C<EMSGSIZE> C<ENAMETOOLONG> 2169C<ENETDOWN> C<ENETRESET> C<ENETUNREACH> C<ENFILE> C<ENOBUFS> C<ENODATA> C<ENODEV> C<ENOENT> C<ENOEXEC> 2170C<ENOLCK> C<ENOLINK> C<ENOMEM> C<ENOMSG> C<ENOPROTOOPT> C<ENOSPC> C<ENOSR> C<ENOSTR> C<ENOSYS> C<ENOTBLK> 2171C<ENOTCONN> C<ENOTDIR> C<ENOTEMPTY> C<ENOTRECOVERABLE> C<ENOTSOCK> C<ENOTSUP> C<ENOTTY> C<ENXIO> 2172C<EOPNOTSUPP> C<EOTHER> C<EOVERFLOW> C<EOWNERDEAD> C<EPERM> C<EPFNOSUPPORT> C<EPIPE> C<EPROCLIM> C<EPROTO> 2173C<EPROTONOSUPPORT> C<EPROTOTYPE> C<ERANGE> C<EREMOTE> C<ERESTART> C<EROFS> C<ESHUTDOWN> 2174C<ESOCKTNOSUPPORT> C<ESPIPE> C<ESRCH> C<ESTALE> C<ETIME> C<ETIMEDOUT> C<ETOOMANYREFS> C<ETXTBSY> C<EUSERS> 2175C<EWOULDBLOCK> C<EXDEV> 2176 2177=back 2178 2179=head1 FCNTL 2180 2181=over 8 2182 2183=item Constants 2184 2185C<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> 2186C<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> 2187C<O_RDONLY> C<O_RDWR> C<O_TRUNC> C<O_WRONLY> 2188 2189=back 2190 2191=head1 FLOAT 2192 2193=over 8 2194 2195=item Constants 2196 2197C<DBL_DIG> C<DBL_EPSILON> C<DBL_MANT_DIG> C<DBL_MAX> C<DBL_MAX_10_EXP> C<DBL_MAX_EXP> C<DBL_MIN> 2198C<DBL_MIN_10_EXP> C<DBL_MIN_EXP> C<FLT_DIG> C<FLT_EPSILON> C<FLT_MANT_DIG> C<FLT_MAX> 2199C<FLT_MAX_10_EXP> C<FLT_MAX_EXP> C<FLT_MIN> C<FLT_MIN_10_EXP> C<FLT_MIN_EXP> C<FLT_RADIX> 2200C<FLT_ROUNDS> C<LDBL_DIG> C<LDBL_EPSILON> C<LDBL_MANT_DIG> C<LDBL_MAX> C<LDBL_MAX_10_EXP> 2201C<LDBL_MAX_EXP> C<LDBL_MIN> C<LDBL_MIN_10_EXP> C<LDBL_MIN_EXP> 2202 2203=back 2204 2205=head1 LIMITS 2206 2207=over 8 2208 2209=item Constants 2210 2211C<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> 2212C<LONG_MIN> C<MAX_CANON> C<MAX_INPUT> C<MB_LEN_MAX> C<NAME_MAX> C<NGROUPS_MAX> C<OPEN_MAX> C<PATH_MAX> 2213C<PIPE_BUF> C<SCHAR_MAX> C<SCHAR_MIN> C<SHRT_MAX> C<SHRT_MIN> C<SSIZE_MAX> C<STREAM_MAX> C<TZNAME_MAX> 2214C<UCHAR_MAX> C<UINT_MAX> C<ULONG_MAX> C<USHRT_MAX> 2215 2216=back 2217 2218=head1 LOCALE 2219 2220=over 8 2221 2222=item Constants 2223 2224C<LC_ALL> C<LC_COLLATE> C<LC_CTYPE> C<LC_MONETARY> C<LC_NUMERIC> C<LC_TIME> 2225 2226=back 2227 2228=head1 MATH 2229 2230=over 8 2231 2232=item Constants 2233 2234C<HUGE_VAL> 2235 2236=back 2237 2238=head1 SIGNAL 2239 2240=over 8 2241 2242=item Constants 2243 2244C<SA_NOCLDSTOP> C<SA_NOCLDWAIT> C<SA_NODEFER> C<SA_ONSTACK> C<SA_RESETHAND> C<SA_RESTART> 2245C<SA_SIGINFO> C<SIGABRT> C<SIGALRM> C<SIGCHLD> C<SIGCONT> C<SIGFPE> C<SIGHUP> C<SIGILL> C<SIGINT> 2246C<SIGKILL> C<SIGPIPE> C<SIGQUIT> C<SIGSEGV> C<SIGSTOP> C<SIGTERM> C<SIGTSTP> C<SIGTTIN> C<SIGTTOU> 2247C<SIGUSR1> C<SIGUSR2> C<SIG_BLOCK> C<SIG_DFL> C<SIG_ERR> C<SIG_IGN> C<SIG_SETMASK> 2248C<SIG_UNBLOCK> 2249 2250=back 2251 2252=head1 STAT 2253 2254=over 8 2255 2256=item Constants 2257 2258C<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> 2259C<S_IWUSR> C<S_IXGRP> C<S_IXOTH> C<S_IXUSR> 2260 2261=item Macros 2262 2263C<S_ISBLK> C<S_ISCHR> C<S_ISDIR> C<S_ISFIFO> C<S_ISREG> 2264 2265=back 2266 2267=head1 STDLIB 2268 2269=over 8 2270 2271=item Constants 2272 2273C<EXIT_FAILURE> C<EXIT_SUCCESS> C<MB_CUR_MAX> C<RAND_MAX> 2274 2275=back 2276 2277=head1 STDIO 2278 2279=over 8 2280 2281=item Constants 2282 2283C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<L_tmpname> C<TMP_MAX> 2284 2285=back 2286 2287=head1 TIME 2288 2289=over 8 2290 2291=item Constants 2292 2293C<CLK_TCK> C<CLOCKS_PER_SEC> 2294 2295=back 2296 2297=head1 UNISTD 2298 2299=over 8 2300 2301=item Constants 2302 2303C<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> 2304 2305=back 2306 2307=head1 WAIT 2308 2309=over 8 2310 2311=item Constants 2312 2313C<WNOHANG> C<WUNTRACED> 2314 2315=over 16 2316 2317=item C<WNOHANG> 2318 2319Do not suspend the calling process until a child process 2320changes state but instead return immediately. 2321 2322=item C<WUNTRACED> 2323 2324Catch stopped child processes. 2325 2326=back 2327 2328=item Macros 2329 2330C<WIFEXITED> C<WEXITSTATUS> C<WIFSIGNALED> C<WTERMSIG> C<WIFSTOPPED> C<WSTOPSIG> 2331 2332=over 16 2333 2334=item C<WIFEXITED> 2335 2336C<WIFEXITED(${^CHILD_ERROR_NATIVE})> returns true if the child process 2337exited normally (C<exit()> or by falling off the end of C<main()>) 2338 2339=item C<WEXITSTATUS> 2340 2341C<WEXITSTATUS(${^CHILD_ERROR_NATIVE})> returns the normal exit status of 2342the child process (only meaningful if C<WIFEXITED(${^CHILD_ERROR_NATIVE})> 2343is true) 2344 2345=item C<WIFSIGNALED> 2346 2347C<WIFSIGNALED(${^CHILD_ERROR_NATIVE})> returns true if the child process 2348terminated because of a signal 2349 2350=item C<WTERMSIG> 2351 2352C<WTERMSIG(${^CHILD_ERROR_NATIVE})> returns the signal the child process 2353terminated for (only meaningful if 2354C<WIFSIGNALED(${^CHILD_ERROR_NATIVE})> 2355is true) 2356 2357=item C<WIFSTOPPED> 2358 2359C<WIFSTOPPED(${^CHILD_ERROR_NATIVE})> returns true if the child process is 2360currently stopped (can happen only if you specified the WUNTRACED flag 2361to C<waitpid()>) 2362 2363=item C<WSTOPSIG> 2364 2365C<WSTOPSIG(${^CHILD_ERROR_NATIVE})> returns the signal the child process 2366was stopped for (only meaningful if 2367C<WIFSTOPPED(${^CHILD_ERROR_NATIVE})> 2368is true) 2369 2370=back 2371 2372=back 2373 2374