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