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