1POSIX(3pm)             Perl Programmers Reference Guide             POSIX(3pm)
2
3
4

NAME

6       POSIX - Perl interface to IEEE Std 1003.1
7

SYNOPSIS

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

DESCRIPTION

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       Everything is exported by default with the exception of any POSIX
26       functions with the same name as a built-in Perl function, such as
27       "abs", "alarm", "rmdir", "write", etc.., which will be exported only if
28       you ask for them explicitly.  This is an unfortunate backwards
29       compatibility feature.  You can stop the exporting by saying "use POSIX
30       ()" and then use the fully qualified names (ie. "POSIX::SEEK_END").
31
32       This document gives a condensed list of the features available in the
33       POSIX module.  Consult your operating system's manpages for general
34       information on most features.  Consult perlfunc for functions which are
35       noted as being identical to Perl's builtin functions.
36
37       The first section describes POSIX functions from the 1003.1
38       specification.  The second section describes some classes for signal
39       objects, TTY objects, and other miscellaneous objects.  The remaining
40       sections list various constants and macros in an organization which
41       roughly follows IEEE Std 1003.1b-1993.
42

NOTE

44       The POSIX module is probably the most complex Perl module supplied with
45       the standard distribution.  It incorporates autoloading, namespace
46       games, and dynamic loading of code that's in Perl, C, or both.  It's a
47       great source of wisdom.
48

CAVEATS

50       A few functions are not implemented because they are C specific.  If
51       you attempt to call these, they will print a message telling you that
52       they aren't implemented, and suggest using the Perl equivalent should
53       one exist.  For example, trying to access the setjmp() call will elicit
54       the message "setjmp() is C-specific: use eval {} instead".
55
56       Furthermore, some evil vendors will claim 1003.1 compliance, but in
57       fact are not so: they will not pass the PCTS (POSIX Compliance Test
58       Suites).  For example, one vendor may not define EDEADLK, or the
59       semantics of the errno values set by open(2) might not be quite right.
60       Perl does not attempt to verify POSIX compliance.  That means you can
61       currently successfully say "use POSIX",  and then later in your program
62       you find that your vendor has been lax and there's no usable ICANON
63       macro after all.  This could be construed to be a bug.
64

FUNCTIONS

66       _exit   This is identical to the C function "_exit()".  It exits the
67               program immediately which means among other things buffered I/O
68               is not flushed.
69
70               Note that when using threads and in Linux this is not a good
71               way to exit a thread because in Linux processes and threads are
72               kind of the same thing (Note: while this is the situation in
73               early 2003 there are projects under way to have threads with
74               more POSIXly semantics in Linux).  If you want not to return
75               from a thread, detach the thread.
76
77       abort   This is identical to the C function "abort()".  It terminates
78               the process with a "SIGABRT" signal unless caught by a signal
79               handler or if the handler does not return normally (it e.g.
80               does a "longjmp").
81
82       abs     This is identical to Perl's builtin "abs()" function, returning
83               the absolute value of its numerical argument.
84
85       access  Determines the accessibility of a file.
86
87                       if( POSIX::access( "/", &POSIX::R_OK ) ){
88                               print "have read permission\n";
89                       }
90
91               Returns "undef" on failure.  Note: do not use "access()" for
92               security purposes.  Between the "access()" call and the
93               operation you are preparing for the permissions might change: a
94               classic race condition.
95
96       acos    This is identical to the C function "acos()", returning the
97               arcus cosine of its numerical argument.  See also Math::Trig.
98
99       alarm   This is identical to Perl's builtin "alarm()" function, either
100               for arming or disarming the "SIGARLM" timer.
101
102       asctime This is identical to the C function "asctime()".  It returns a
103               string of the form
104
105                       "Fri Jun  2 18:22:13 2000\n\0"
106
107               and it is called thusly
108
109                       $asctime = asctime($sec, $min, $hour, $mday, $mon, $year,
110                                          $wday, $yday, $isdst);
111
112               The $mon is zero-based: January equals 0.  The $year is
113               1900-based: 2001 equals 101.  $wday and $yday default to zero
114               (and are usually ignored anyway), and $isdst defaults to -1.
115
116       asin    This is identical to the C function "asin()", returning the
117               arcus sine of its numerical argument.  See also Math::Trig.
118
119       assert  Unimplemented, but you can use "die" in perlfunc and the Carp
120               module to achieve similar things.
121
122       atan    This is identical to the C function "atan()", returning the
123               arcus tangent of its numerical argument.  See also Math::Trig.
124
125       atan2   This is identical to Perl's builtin "atan2()" function,
126               returning the arcus tangent defined by its two numerical
127               arguments, the y coordinate and the x coordinate.  See also
128               Math::Trig.
129
130       atexit  atexit() is C-specific: use "END {}" instead, see perlsub.
131
132       atof    atof() is C-specific.  Perl converts strings to numbers
133               transparently.  If you need to force a scalar to a number, add
134               a zero to it.
135
136       atoi    atoi() is C-specific.  Perl converts strings to numbers
137               transparently.  If you need to force a scalar to a number, add
138               a zero to it.  If you need to have just the integer part, see
139               "int" in perlfunc.
140
141       atol    atol() is C-specific.  Perl converts strings to numbers
142               transparently.  If you need to force a scalar to a number, add
143               a zero to it.  If you need to have just the integer part, see
144               "int" in perlfunc.
145
146       bsearch bsearch() not supplied.  For doing binary search on wordlists,
147               see Search::Dict.
148
149       calloc  calloc() is C-specific.  Perl does memory management
150               transparently.
151
152       ceil    This is identical to the C function "ceil()", returning the
153               smallest integer value greater than or equal to the given
154               numerical argument.
155
156       chdir   This is identical to Perl's builtin "chdir()" function,
157               allowing one to change the working (default) directory, see
158               "chdir" in perlfunc.
159
160       chmod   This is identical to Perl's builtin "chmod()" function,
161               allowing one to change file and directory permissions, see
162               "chmod" in perlfunc.
163
164       chown   This is identical to Perl's builtin "chown()" function,
165               allowing one to change file and directory owners and groups,
166               see "chown" in perlfunc.
167
168       clearerr
169               Use the method "IO::Handle::clearerr()" instead, to reset the
170               error state (if any) and EOF state (if any) of the given
171               stream.
172
173       clock   This is identical to the C function "clock()", returning the
174               amount of spent processor time in microseconds.
175
176       close   Close the file.  This uses file descriptors such as those
177               obtained by calling "POSIX::open".
178
179                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
180                       POSIX::close( $fd );
181
182               Returns "undef" on failure.
183
184               See also "close" in perlfunc.
185
186       closedir
187               This is identical to Perl's builtin "closedir()" function for
188               closing a directory handle, see "closedir" in perlfunc.
189
190       cos     This is identical to Perl's builtin "cos()" function, for
191               returning the cosine of its numerical argument, see "cos" in
192               perlfunc.  See also Math::Trig.
193
194       cosh    This is identical to the C function "cosh()", for returning the
195               hyperbolic cosine of its numeric argument.  See also
196               Math::Trig.
197
198       creat   Create a new file.  This returns a file descriptor like the
199               ones returned by "POSIX::open".  Use "POSIX::close" to close
200               the file.
201
202                       $fd = POSIX::creat( "foo", 0611 );
203                       POSIX::close( $fd );
204
205               See also "sysopen" in perlfunc and its "O_CREAT" flag.
206
207       ctermid Generates the path name for the controlling terminal.
208
209                       $path = POSIX::ctermid();
210
211       ctime   This is identical to the C function "ctime()" and equivalent to
212               "asctime(localtime(...))", see "asctime" and "localtime".
213
214       cuserid Get the login name of the owner of the current process.
215
216                       $name = POSIX::cuserid();
217
218       difftime
219               This is identical to the C function "difftime()", for returning
220               the time difference (in seconds) between two times (as returned
221               by "time()"), see "time".
222
223       div     div() is C-specific, use "int" in perlfunc on the usual "/"
224               division and the modulus "%".
225
226       dup     This is similar to the C function "dup()", for duplicating a
227               file descriptor.
228
229               This uses file descriptors such as those obtained by calling
230               "POSIX::open".
231
232               Returns "undef" on failure.
233
234       dup2    This is similar to the C function "dup2()", for duplicating a
235               file descriptor to an another known file descriptor.
236
237               This uses file descriptors such as those obtained by calling
238               "POSIX::open".
239
240               Returns "undef" on failure.
241
242       errno   Returns the value of errno.
243
244                       $errno = POSIX::errno();
245
246               This identical to the numerical values of the $!, see "$ERRNO"
247               in perlvar.
248
249       execl   execl() is C-specific, see "exec" in perlfunc.
250
251       execle  execle() is C-specific, see "exec" in perlfunc.
252
253       execlp  execlp() is C-specific, see "exec" in perlfunc.
254
255       execv   execv() is C-specific, see "exec" in perlfunc.
256
257       execve  execve() is C-specific, see "exec" in perlfunc.
258
259       execvp  execvp() is C-specific, see "exec" in perlfunc.
260
261       exit    This is identical to Perl's builtin "exit()" function for
262               exiting the program, see "exit" in perlfunc.
263
264       exp     This is identical to Perl's builtin "exp()" function for
265               returning the exponent (e-based) of the numerical argument, see
266               "exp" in perlfunc.
267
268       fabs    This is identical to Perl's builtin "abs()" function for
269               returning the absolute value of the numerical argument, see
270               "abs" in perlfunc.
271
272       fclose  Use method "IO::Handle::close()" instead, or see "close" in
273               perlfunc.
274
275       fcntl   This is identical to Perl's builtin "fcntl()" function, see
276               "fcntl" in perlfunc.
277
278       fdopen  Use method "IO::Handle::new_from_fd()" instead, or see "open"
279               in perlfunc.
280
281       feof    Use method "IO::Handle::eof()" instead, or see "eof" in
282               perlfunc.
283
284       ferror  Use method "IO::Handle::error()" instead.
285
286       fflush  Use method "IO::Handle::flush()" instead.  See also
287               "$OUTPUT_AUTOFLUSH" in perlvar.
288
289       fgetc   Use method "IO::Handle::getc()" instead, or see "read" in
290               perlfunc.
291
292       fgetpos Use method "IO::Seekable::getpos()" instead, or see "seek" in
293               L.
294
295       fgets   Use method "IO::Handle::gets()" instead.  Similar to <>, also
296               known as "readline" in perlfunc.
297
298       fileno  Use method "IO::Handle::fileno()" instead, or see "fileno" in
299               perlfunc.
300
301       floor   This is identical to the C function "floor()", returning the
302               largest integer value less than or equal to the numerical
303               argument.
304
305       fmod    This is identical to the C function "fmod()".
306
307                       $r = fmod($x, $y);
308
309               It returns the remainder "$r = $x - $n*$y", where "$n =
310               trunc($x/$y)".  The $r has the same sign as $x and magnitude
311               (absolute value) less than the magnitude of $y.
312
313       fopen   Use method "IO::File::open()" instead, or see "open" in
314               perlfunc.
315
316       fork    This is identical to Perl's builtin "fork()" function for
317               duplicating the current process, see "fork" in perlfunc and
318               perlfork if you are in Windows.
319
320       fpathconf
321               Retrieves the value of a configurable limit on a file or
322               directory.  This uses file descriptors such as those obtained
323               by calling "POSIX::open".
324
325               The following will determine the maximum length of the longest
326               allowable pathname on the filesystem which holds "/var/foo".
327
328                       $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY );
329                       $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX );
330
331               Returns "undef" on failure.
332
333       fprintf fprintf() is C-specific, see "printf" in perlfunc instead.
334
335       fputc   fputc() is C-specific, see "print" in perlfunc instead.
336
337       fputs   fputs() is C-specific, see "print" in perlfunc instead.
338
339       fread   fread() is C-specific, see "read" in perlfunc instead.
340
341       free    free() is C-specific.  Perl does memory management
342               transparently.
343
344       freopen freopen() is C-specific, see "open" in perlfunc instead.
345
346       frexp   Return the mantissa and exponent of a floating-point number.
347
348                       ($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
349
350       fscanf  fscanf() is C-specific, use <> and regular expressions instead.
351
352       fseek   Use method "IO::Seekable::seek()" instead, or see "seek" in
353               perlfunc.
354
355       fsetpos Use method "IO::Seekable::setpos()" instead, or seek "seek" in
356               perlfunc.
357
358       fstat   Get file status.  This uses file descriptors such as those
359               obtained by calling "POSIX::open".  The data returned is
360               identical to the data from Perl's builtin "stat" function.
361
362                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
363                       @stats = POSIX::fstat( $fd );
364
365       fsync   Use method "IO::Handle::sync()" instead.
366
367       ftell   Use method "IO::Seekable::tell()" instead, or see "tell" in
368               perlfunc.
369
370       fwrite  fwrite() is C-specific, see "print" in perlfunc instead.
371
372       getc    This is identical to Perl's builtin "getc()" function, see
373               "getc" in perlfunc.
374
375       getchar Returns one character from STDIN.  Identical to Perl's
376               "getc()", see "getc" in perlfunc.
377
378       getcwd  Returns the name of the current working directory.  See also
379               Cwd.
380
381       getegid Returns the effective group identifier.  Similar to Perl' s
382               builtin variable $(, see "$EGID" in perlvar.
383
384       getenv  Returns the value of the specified environment variable.  The
385               same information is available through the %ENV array.
386
387       geteuid Returns the effective user identifier.  Identical to Perl's
388               builtin $> variable, see "$EUID" in perlvar.
389
390       getgid  Returns the user's real group identifier.  Similar to Perl's
391               builtin variable $), see "$GID" in perlvar.
392
393       getgrgid
394               This is identical to Perl's builtin "getgrgid()" function for
395               returning group entries by group identifiers, see "getgrgid" in
396               perlfunc.
397
398       getgrnam
399               This is identical to Perl's builtin "getgrnam()" function for
400               returning group entries by group names, see "getgrnam" in
401               perlfunc.
402
403       getgroups
404               Returns the ids of the user's supplementary groups.  Similar to
405               Perl's builtin variable $), see "$GID" in perlvar.
406
407       getlogin
408               This is identical to Perl's builtin "getlogin()" function for
409               returning the user name associated with the current session,
410               see "getlogin" in perlfunc.
411
412       getpgrp This is identical to Perl's builtin "getpgrp()" function for
413               returning the process group identifier of the current process,
414               see "getpgrp" in perlfunc.
415
416       getpid  Returns the process identifier.  Identical to Perl's builtin
417               variable $$, see "$PID" in perlvar.
418
419       getppid This is identical to Perl's builtin "getppid()" function for
420               returning the process identifier of the parent process of the
421               current process , see "getppid" in perlfunc.
422
423       getpwnam
424               This is identical to Perl's builtin "getpwnam()" function for
425               returning user entries by user names, see "getpwnam" in
426               perlfunc.
427
428       getpwuid
429               This is identical to Perl's builtin "getpwuid()" function for
430               returning user entries by user identifiers, see "getpwuid" in
431               perlfunc.
432
433       gets    Returns one line from "STDIN", similar to <>, also known as the
434               "readline()" function, see "readline" in perlfunc.
435
436               NOTE: if you have C programs that still use "gets()", be very
437               afraid.  The "gets()" function is a source of endless grief
438               because it has no buffer overrun checks.  It should never be
439               used.  The "fgets()" function should be preferred instead.
440
441       getuid  Returns the user's identifier.  Identical to Perl's builtin $<
442               variable, see "$UID" in perlvar.
443
444       gmtime  This is identical to Perl's builtin "gmtime()" function for
445               converting seconds since the epoch to a date in Greenwich Mean
446               Time, see "gmtime" in perlfunc.
447
448       isalnum This is identical to the C function, except that it can apply
449               to a single character or to a whole string.  Note that locale
450               settings may affect what characters are considered "isalnum".
451               Does not work on Unicode characters code point 256 or higher.
452               Consider using regular expressions and the "/[[:alnum:]]/"
453               construct instead, or possibly the "/\w/" construct.
454
455       isalpha This is identical to the C function, except that it can apply
456               to a single character or to a whole string.  Note that locale
457               settings may affect what characters are considered "isalpha".
458               Does not work on Unicode characters code point 256 or higher.
459               Consider using regular expressions and the "/[[:alpha:]]/"
460               construct instead.
461
462       isatty  Returns a boolean indicating whether the specified filehandle
463               is connected to a tty.  Similar to the "-t" operator, see "-X"
464               in perlfunc.
465
466       iscntrl This is identical to the C function, except that it can apply
467               to a single character or to a whole string.  Note that locale
468               settings may affect what characters are considered "iscntrl".
469               Does not work on Unicode characters code point 256 or higher.
470               Consider using regular expressions and the "/[[:cntrl:]]/"
471               construct instead.
472
473       isdigit This is identical to the C function, except that it can apply
474               to a single character or to a whole string.  Note that locale
475               settings may affect what characters are considered "isdigit"
476               (unlikely, but still possible). Does not work on Unicode
477               characters code point 256 or higher.  Consider using regular
478               expressions and the "/[[:digit:]]/" construct instead, or the
479               "/\d/" construct.
480
481       isgraph This is identical to the C function, except that it can apply
482               to a single character or to a whole string.  Note that locale
483               settings may affect what characters are considered "isgraph".
484               Does not work on Unicode characters code point 256 or higher.
485               Consider using regular expressions and the "/[[:graph:]]/"
486               construct instead.
487
488       islower This is identical to the C function, except that it can apply
489               to a single character or to a whole string.  Note that locale
490               settings may affect what characters are considered "islower".
491               Does not work on Unicode characters code point 256 or higher.
492               Consider using regular expressions and the "/[[:lower:]]/"
493               construct instead.  Do not use "/[a-z]/".
494
495       isprint This is identical to the C function, except that it can apply
496               to a single character or to a whole string.  Note that locale
497               settings may affect what characters are considered "isprint".
498               Does not work on Unicode characters code point 256 or higher.
499               Consider using regular expressions and the "/[[:print:]]/"
500               construct instead.
501
502       ispunct This is identical to the C function, except that it can apply
503               to a single character or to a whole string.  Note that locale
504               settings may affect what characters are considered "ispunct".
505               Does not work on Unicode characters code point 256 or higher.
506               Consider using regular expressions and the "/[[:punct:]]/"
507               construct instead.
508
509       isspace This is identical to the C function, except that it can apply
510               to a single character or to a whole string.  Note that locale
511               settings may affect what characters are considered "isspace".
512               Does not work on Unicode characters code point 256 or higher.
513               Consider using regular expressions and the "/[[:space:]]/"
514               construct instead, or the "/\s/" construct.  (Note that "/\s/"
515               and "/[[:space:]]/" are slightly different in that
516               "/[[:space:]]/" can normally match a vertical tab, while "/\s/"
517               does not.)
518
519       isupper This is identical to the C function, except that it can apply
520               to a single character or to a whole string.  Note that locale
521               settings may affect what characters are considered "isupper".
522               Does not work on Unicode characters code point 256 or higher.
523               Consider using regular expressions and the "/[[:upper:]]/"
524               construct instead.  Do not use "/[A-Z]/".
525
526       isxdigit
527               This is identical to the C function, except that it can apply
528               to a single character or to a whole string.  Note that locale
529               settings may affect what characters are considered "isxdigit"
530               (unlikely, but still possible).  Does not work on Unicode
531               characters code point 256 or higher.  Consider using regular
532               expressions and the "/[[:xdigit:]]/" construct instead, or
533               simply "/[0-9a-f]/i".
534
535       kill    This is identical to Perl's builtin "kill()" function for
536               sending signals to processes (often to terminate them), see
537               "kill" in perlfunc.
538
539       labs    (For returning absolute values of long integers.)  labs() is
540               C-specific, see "abs" in perlfunc instead.
541
542       lchown  This is identical to the C function, except the order of
543               arguments is consistent with Perl's builtin "chown()" with the
544               added restriction of only one path, not an list of paths.  Does
545               the same thing as the "chown()" function but changes the owner
546               of a symbolic link instead of the file the symbolic link points
547               to.
548
549       ldexp   This is identical to the C function "ldexp()" for multiplying
550               floating point numbers with powers of two.
551
552                       $x_quadrupled = POSIX::ldexp($x, 2);
553
554       ldiv    (For computing dividends of long integers.)  ldiv() is
555               C-specific, use "/" and "int()" instead.
556
557       link    This is identical to Perl's builtin "link()" function for
558               creating hard links into files, see "link" in perlfunc.
559
560       localeconv
561               Get numeric formatting information.  Returns a reference to a
562               hash containing the current locale formatting values.
563
564               Here is how to query the database for the de (Deutsch or
565               German) locale.
566
567                       $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
568                       print "Locale = $loc\n";
569                       $lconv = POSIX::localeconv();
570                       print "decimal_point    = ", $lconv->{decimal_point},   "\n";
571                       print "thousands_sep    = ", $lconv->{thousands_sep},   "\n";
572                       print "grouping = ", $lconv->{grouping},        "\n";
573                       print "int_curr_symbol  = ", $lconv->{int_curr_symbol}, "\n";
574                       print "currency_symbol  = ", $lconv->{currency_symbol}, "\n";
575                       print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
576                       print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
577                       print "mon_grouping     = ", $lconv->{mon_grouping},    "\n";
578                       print "positive_sign    = ", $lconv->{positive_sign},   "\n";
579                       print "negative_sign    = ", $lconv->{negative_sign},   "\n";
580                       print "int_frac_digits  = ", $lconv->{int_frac_digits}, "\n";
581                       print "frac_digits      = ", $lconv->{frac_digits},     "\n";
582                       print "p_cs_precedes    = ", $lconv->{p_cs_precedes},   "\n";
583                       print "p_sep_by_space   = ", $lconv->{p_sep_by_space},  "\n";
584                       print "n_cs_precedes    = ", $lconv->{n_cs_precedes},   "\n";
585                       print "n_sep_by_space   = ", $lconv->{n_sep_by_space},  "\n";
586                       print "p_sign_posn      = ", $lconv->{p_sign_posn},     "\n";
587                       print "n_sign_posn      = ", $lconv->{n_sign_posn},     "\n";
588
589       localtime
590               This is identical to Perl's builtin "localtime()" function for
591               converting seconds since the epoch to a date see "localtime" in
592               perlfunc.
593
594       log     This is identical to Perl's builtin "log()" function, returning
595               the natural (e-based) logarithm of the numerical argument, see
596               "log" in perlfunc.
597
598       log10   This is identical to the C function "log10()", returning the
599               10-base logarithm of the numerical argument.  You can also use
600
601                   sub log10 { log($_[0]) / log(10) }
602
603               or
604
605                   sub log10 { log($_[0]) / 2.30258509299405 }
606
607               or
608
609                   sub log10 { log($_[0]) * 0.434294481903252 }
610
611       longjmp longjmp() is C-specific: use "die" in perlfunc instead.
612
613       lseek   Move the file's read/write position.  This uses file
614               descriptors such as those obtained by calling "POSIX::open".
615
616                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
617                       $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
618
619               Returns "undef" on failure.
620
621       malloc  malloc() is C-specific.  Perl does memory management
622               transparently.
623
624       mblen   This is identical to the C function "mblen()".  Perl does not
625               have any support for the wide and multibyte characters of the C
626               standards, so this might be a rather useless function.
627
628       mbstowcs
629               This is identical to the C function "mbstowcs()".  Perl does
630               not have any support for the wide and multibyte characters of
631               the C standards, so this might be a rather useless function.
632
633       mbtowc  This is identical to the C function "mbtowc()".  Perl does not
634               have any support for the wide and multibyte characters of the C
635               standards, so this might be a rather useless function.
636
637       memchr  memchr() is C-specific, see "index" in perlfunc instead.
638
639       memcmp  memcmp() is C-specific, use "eq" instead, see perlop.
640
641       memcpy  memcpy() is C-specific, use "=", see perlop, or see "substr" in
642               perlfunc.
643
644       memmove memmove() is C-specific, use "=", see perlop, or see "substr"
645               in perlfunc.
646
647       memset  memset() is C-specific, use "x" instead, see perlop.
648
649       mkdir   This is identical to Perl's builtin "mkdir()" function for
650               creating directories, see "mkdir" in perlfunc.
651
652       mkfifo  This is similar to the C function "mkfifo()" for creating FIFO
653               special files.
654
655                       if (mkfifo($path, $mode)) { ....
656
657               Returns "undef" on failure.  The $mode is similar to the mode
658               of "mkdir()", see "mkdir" in perlfunc, though for "mkfifo" you
659               must specify the $mode.
660
661       mktime  Convert date/time info to a calendar time.
662
663               Synopsis:
664
665                       mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1)
666
667               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
668               at zero.  I.e. January is 0, not 1; Sunday is 0, not 1; January
669               1st is 0, not 1.  The year ("year") is given in years since
670               1900.  I.e. The year 1995 is 95; the year 2001 is 101.  Consult
671               your system's "mktime()" manpage for details about these and
672               the other arguments.
673
674               Calendar time for December 12, 1995, at 10:30 am.
675
676                       $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
677                       print "Date = ", POSIX::ctime($time_t);
678
679               Returns "undef" on failure.
680
681       modf    Return the integral and fractional parts of a floating-point
682               number.
683
684                       ($fractional, $integral) = POSIX::modf( 3.14 );
685
686       nice    This is similar to the C function "nice()", for changing the
687               scheduling preference of the current process.  Positive
688               arguments mean more polite process, negative values more needy
689               process.  Normal user processes can only be more polite.
690
691               Returns "undef" on failure.
692
693       offsetof
694               offsetof() is C-specific, you probably want to see "pack" in
695               perlfunc instead.
696
697       open    Open a file for reading for writing.  This returns file
698               descriptors, not Perl filehandles.  Use "POSIX::close" to close
699               the file.
700
701               Open a file read-only with mode 0666.
702
703                       $fd = POSIX::open( "foo" );
704
705               Open a file for read and write.
706
707                       $fd = POSIX::open( "foo", &POSIX::O_RDWR );
708
709               Open a file for write, with truncation.
710
711                       $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
712
713               Create a new file with mode 0640.  Set up the file for writing.
714
715                       $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
716
717               Returns "undef" on failure.
718
719               See also "sysopen" in perlfunc.
720
721       opendir Open a directory for reading.
722
723                       $dir = POSIX::opendir( "/var" );
724                       @files = POSIX::readdir( $dir );
725                       POSIX::closedir( $dir );
726
727               Returns "undef" on failure.
728
729       pathconf
730               Retrieves the value of a configurable limit on a file or
731               directory.
732
733               The following will determine the maximum length of the longest
734               allowable pathname on the filesystem which holds "/var".
735
736                       $path_max = POSIX::pathconf( "/var", &POSIX::_PC_PATH_MAX );
737
738               Returns "undef" on failure.
739
740       pause   This is similar to the C function "pause()", which suspends the
741               execution of the current process until a signal is received.
742
743               Returns "undef" on failure.
744
745       perror  This is identical to the C function "perror()", which outputs
746               to the standard error stream the specified message followed by
747               ": " and the current error string.  Use the "warn()" function
748               and the $!  variable instead, see "warn" in perlfunc and
749               "$ERRNO" in perlvar.
750
751       pipe    Create an interprocess channel.  This returns file descriptors
752               like those returned by "POSIX::open".
753
754                       my ($read, $write) = POSIX::pipe();
755                       POSIX::write( $write, "hello", 5 );
756                       POSIX::read( $read, $buf, 5 );
757
758               See also "pipe" in perlfunc.
759
760       pow     Computes $x raised to the power $exponent.
761
762                       $ret = POSIX::pow( $x, $exponent );
763
764               You can also use the "**" operator, see perlop.
765
766       printf  Formats and prints the specified arguments to STDOUT.  See also
767               "printf" in perlfunc.
768
769       putc    putc() is C-specific, see "print" in perlfunc instead.
770
771       putchar putchar() is C-specific, see "print" in perlfunc instead.
772
773       puts    puts() is C-specific, see "print" in perlfunc instead.
774
775       qsort   qsort() is C-specific, see "sort" in perlfunc instead.
776
777       raise   Sends the specified signal to the current process.  See also
778               "kill" in perlfunc and the $$ in "$PID" in perlvar.
779
780       rand    "rand()" is non-portable, see "rand" in perlfunc instead.
781
782       read    Read from a file.  This uses file descriptors such as those
783               obtained by calling "POSIX::open".  If the buffer $buf is not
784               large enough for the read then Perl will extend it to make room
785               for the request.
786
787                       $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
788                       $bytes = POSIX::read( $fd, $buf, 3 );
789
790               Returns "undef" on failure.
791
792               See also "sysread" in perlfunc.
793
794       readdir This is identical to Perl's builtin "readdir()" function for
795               reading directory entries, see "readdir" in perlfunc.
796
797       realloc realloc() is C-specific.  Perl does memory management
798               transparently.
799
800       remove  This is identical to Perl's builtin "unlink()" function for
801               removing files, see "unlink" in perlfunc.
802
803       rename  This is identical to Perl's builtin "rename()" function for
804               renaming files, see "rename" in perlfunc.
805
806       rewind  Seeks to the beginning of the file.
807
808       rewinddir
809               This is identical to Perl's builtin "rewinddir()" function for
810               rewinding directory entry streams, see "rewinddir" in perlfunc.
811
812       rmdir   This is identical to Perl's builtin "rmdir()" function for
813               removing (empty) directories, see "rmdir" in perlfunc.
814
815       scanf   scanf() is C-specific, use <> and regular expressions instead,
816               see perlre.
817
818       setgid  Sets the real group identifier and the effective group
819               identifier for this process.  Similar to assigning a value to
820               the Perl's builtin $) variable, see "$EGID" in perlvar, except
821               that the latter will change only the real user identifier, and
822               that the setgid() uses only a single numeric argument, as
823               opposed to a space-separated list of numbers.
824
825       setjmp  "setjmp()" is C-specific: use "eval {}" instead, see "eval" in
826               perlfunc.
827
828       setlocale
829               Modifies and queries program's locale.  The following examples
830               assume
831
832                       use POSIX qw(setlocale LC_ALL LC_CTYPE);
833
834               has been issued.
835
836               The following will set the traditional UNIX system locale
837               behavior (the second argument "C").
838
839                       $loc = setlocale( LC_ALL, "C" );
840
841               The following will query the current LC_CTYPE category.  (No
842               second argument means 'query'.)
843
844                       $loc = setlocale( LC_CTYPE );
845
846               The following will set the LC_CTYPE behaviour according to the
847               locale environment variables (the second argument "").  Please
848               see your systems setlocale(3) documentation for the locale
849               environment variables' meaning or consult perllocale.
850
851                       $loc = setlocale( LC_CTYPE, "" );
852
853               The following will set the LC_COLLATE behaviour to Argentinian
854               Spanish. NOTE: The naming and availability of locales depends
855               on your operating system. Please consult perllocale for how to
856               find out which locales are available in your system.
857
858                       $loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" );
859
860       setpgid This is similar to the C function "setpgid()" for setting the
861               process group identifier of the current process.
862
863               Returns "undef" on failure.
864
865       setsid  This is identical to the C function "setsid()" for setting the
866               session identifier of the current process.
867
868       setuid  Sets the real user identifier and the effective user identifier
869               for this process.  Similar to assigning a value to the Perl's
870               builtin $< variable, see "$UID" in perlvar, except that the
871               latter will change only the real user identifier.
872
873       sigaction
874               Detailed signal management.  This uses "POSIX::SigAction"
875               objects for the "action" and "oldaction" arguments (the
876               oldaction can also be just a hash reference).  Consult your
877               system's "sigaction" manpage for details, see also
878               "POSIX::SigRt".
879
880               Synopsis:
881
882                       sigaction(signal, action, oldaction = 0)
883
884               Returns "undef" on failure.  The "signal" must be a number
885               (like SIGHUP), not a string (like "SIGHUP"), though Perl does
886               try hard to understand you.
887
888               If you use the SA_SIGINFO flag, the signal handler will in
889               addition to the first argument, the signal name, also receive a
890               second argument, a hash reference, inside which are the
891               following keys with the following semantics, as defined by
892               POSIX/SUSv3:
893
894                   signo       the signal number
895                   errno       the error number
896                   code        if this is zero or less, the signal was sent by
897                               a user process and the uid and pid make sense,
898                               otherwise the signal was sent by the kernel
899
900               The following are also defined by POSIX/SUSv3, but
901               unfortunately not very widely implemented:
902
903                   pid         the process id generating the signal
904                   uid         the uid of the process id generating the signal
905                   status      exit value or signal for SIGCHLD
906                   band        band event for SIGPOLL
907
908               A third argument is also passed to the handler, which contains
909               a copy of the raw binary contents of the siginfo structure: if
910               a system has some non-POSIX fields, this third argument is
911               where to unpack() them from.
912
913               Note that not all siginfo values make sense simultaneously
914               (some are valid only for certain signals, for example), and not
915               all values make sense from Perl perspective, you should to
916               consult your system's "sigaction" and possibly also "siginfo"
917               documentation.
918
919       siglongjmp
920               siglongjmp() is C-specific: use "die" in perlfunc instead.
921
922       sigpending
923               Examine signals that are blocked and pending.  This uses
924               "POSIX::SigSet" objects for the "sigset" argument.  Consult
925               your system's "sigpending" manpage for details.
926
927               Synopsis:
928
929                       sigpending(sigset)
930
931               Returns "undef" on failure.
932
933       sigprocmask
934               Change and/or examine calling process's signal mask.  This uses
935               "POSIX::SigSet" objects for the "sigset" and "oldsigset"
936               arguments.  Consult your system's "sigprocmask" manpage for
937               details.
938
939               Synopsis:
940
941                       sigprocmask(how, sigset, oldsigset = 0)
942
943               Returns "undef" on failure.
944
945       sigsetjmp
946               "sigsetjmp()" is C-specific: use "eval {}" instead, see "eval"
947               in perlfunc.
948
949       sigsuspend
950               Install a signal mask and suspend process until signal arrives.
951               This uses "POSIX::SigSet" objects for the "signal_mask"
952               argument.  Consult your system's "sigsuspend" manpage for
953               details.
954
955               Synopsis:
956
957                       sigsuspend(signal_mask)
958
959               Returns "undef" on failure.
960
961       sin     This is identical to Perl's builtin "sin()" function for
962               returning the sine of the numerical argument, see "sin" in
963               perlfunc.  See also Math::Trig.
964
965       sinh    This is identical to the C function "sinh()" for returning the
966               hyperbolic sine of the numerical argument.  See also
967               Math::Trig.
968
969       sleep   This is functionally identical to Perl's builtin "sleep()"
970               function for suspending the execution of the current for
971               process for certain number of seconds, see "sleep" in perlfunc.
972               There is one significant difference, however: "POSIX::sleep()"
973               returns the number of unslept seconds, while the
974               "CORE::sleep()" returns the number of slept seconds.
975
976       sprintf This is similar to Perl's builtin "sprintf()" function for
977               returning a string that has the arguments formatted as
978               requested, see "sprintf" in perlfunc.
979
980       sqrt    This is identical to Perl's builtin "sqrt()" function.  for
981               returning the square root of the numerical argument, see "sqrt"
982               in perlfunc.
983
984       srand   Give a seed the pseudorandom number generator, see "srand" in
985               perlfunc.
986
987       sscanf  sscanf() is C-specific, use regular expressions instead, see
988               perlre.
989
990       stat    This is identical to Perl's builtin "stat()" function for
991               returning information about files and directories.
992
993       strcat  strcat() is C-specific, use ".=" instead, see perlop.
994
995       strchr  strchr() is C-specific, see "index" in perlfunc instead.
996
997       strcmp  strcmp() is C-specific, use "eq" or "cmp" instead, see perlop.
998
999       strcoll This is identical to the C function "strcoll()" for collating
1000               (comparing) strings transformed using the "strxfrm()" function.
1001               Not really needed since Perl can do this transparently, see
1002               perllocale.
1003
1004       strcpy  strcpy() is C-specific, use "=" instead, see perlop.
1005
1006       strcspn strcspn() is C-specific, use regular expressions instead, see
1007               perlre.
1008
1009       strerror
1010               Returns the error string for the specified errno.  Identical to
1011               the string form of the $!, see "$ERRNO" in perlvar.
1012
1013       strftime
1014               Convert date and time information to string.  Returns the
1015               string.
1016
1017               Synopsis:
1018
1019                       strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
1020
1021               The month ("mon"), weekday ("wday"), and yearday ("yday") begin
1022               at zero.  I.e. January is 0, not 1; Sunday is 0, not 1; January
1023               1st is 0, not 1.  The year ("year") is given in years since
1024               1900.  I.e., the year 1995 is 95; the year 2001 is 101.
1025               Consult your system's "strftime()" manpage for details about
1026               these and the other arguments.
1027
1028               If you want your code to be portable, your format ("fmt")
1029               argument should use only the conversion specifiers defined by
1030               the ANSI C standard (C89, to play safe).  These are
1031               "aAbBcdHIjmMpSUwWxXyYZ%".  But even then, the results of some
1032               of the conversion specifiers are non-portable.  For example,
1033               the specifiers "aAbBcpZ" change according to the locale
1034               settings of the user, and both how to set locales (the locale
1035               names) and what output to expect are non-standard.  The
1036               specifier "c" changes according to the timezone settings of the
1037               user and the timezone computation rules of the operating
1038               system.  The "Z" specifier is notoriously unportable since the
1039               names of timezones are non-standard. Sticking to the numeric
1040               specifiers is the safest route.
1041
1042               The given arguments are made consistent as though by calling
1043               "mktime()" before calling your system's "strftime()" function,
1044               except that the "isdst" value is not affected.
1045
1046               The string for Tuesday, December 12, 1995.
1047
1048                       $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 );
1049                       print "$str\n";
1050
1051       strlen  strlen() is C-specific, use "length()" instead, see "length" in
1052               perlfunc.
1053
1054       strncat strncat() is C-specific, use ".=" instead, see perlop.
1055
1056       strncmp strncmp() is C-specific, use "eq" instead, see perlop.
1057
1058       strncpy strncpy() is C-specific, use "=" instead, see perlop.
1059
1060       strpbrk strpbrk() is C-specific, use regular expressions instead, see
1061               perlre.
1062
1063       strrchr strrchr() is C-specific, see "rindex" in perlfunc instead.
1064
1065       strspn  strspn() is C-specific, use regular expressions instead, see
1066               perlre.
1067
1068       strstr  This is identical to Perl's builtin "index()" function, see
1069               "index" in perlfunc.
1070
1071       strtod  String to double translation. Returns the parsed number and the
1072               number of characters in the unparsed portion of the string.
1073               Truly POSIX-compliant systems set $! ($ERRNO) to indicate a
1074               translation error, so clear $! before calling strtod.  However,
1075               non-POSIX systems may not check for overflow, and therefore
1076               will never set $!.
1077
1078               strtod should respect any POSIX setlocale() settings.
1079
1080               To parse a string $str as a floating point number use
1081
1082                   $! = 0;
1083                   ($num, $n_unparsed) = POSIX::strtod($str);
1084
1085               The second returned item and $! can be used to check for valid
1086               input:
1087
1088                   if (($str eq '') || ($n_unparsed != 0) || $!) {
1089                       die "Non-numeric input $str" . ($! ? ": $!\n" : "\n");
1090                   }
1091
1092               When called in a scalar context strtod returns the parsed
1093               number.
1094
1095       strtok  strtok() is C-specific, use regular expressions instead, see
1096               perlre, or "split" in perlfunc.
1097
1098       strtol  String to (long) integer translation.  Returns the parsed
1099               number and the number of characters in the unparsed portion of
1100               the string.  Truly POSIX-compliant systems set $! ($ERRNO) to
1101               indicate a translation error, so clear $! before calling
1102               strtol.  However, non-POSIX systems may not check for overflow,
1103               and therefore will never set $!.
1104
1105               strtol should respect any POSIX setlocale() settings.
1106
1107               To parse a string $str as a number in some base $base use
1108
1109                   $! = 0;
1110                   ($num, $n_unparsed) = POSIX::strtol($str, $base);
1111
1112               The base should be zero or between 2 and 36, inclusive.  When
1113               the base is zero or omitted strtol will use the string itself
1114               to determine the base: a leading "0x" or "0X" means
1115               hexadecimal; a leading "0" means octal; any other leading
1116               characters mean decimal.  Thus, "1234" is parsed as a decimal
1117               number, "01234" as an octal number, and "0x1234" as a
1118               hexadecimal number.
1119
1120               The second returned item and $! can be used to check for valid
1121               input:
1122
1123                   if (($str eq '') || ($n_unparsed != 0) || !$!) {
1124                       die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
1125                   }
1126
1127               When called in a scalar context strtol returns the parsed
1128               number.
1129
1130       strtoul String to unsigned (long) integer translation.  strtoul() is
1131               identical to strtol() except that strtoul() only parses
1132               unsigned integers.  See "strtol" for details.
1133
1134               Note: Some vendors supply strtod() and strtol() but not
1135               strtoul().  Other vendors that do supply strtoul() parse "-1"
1136               as a valid value.
1137
1138       strxfrm String transformation.  Returns the transformed string.
1139
1140                       $dst = POSIX::strxfrm( $src );
1141
1142               Used in conjunction with the "strcoll()" function, see
1143               "strcoll".
1144
1145               Not really needed since Perl can do this transparently, see
1146               perllocale.
1147
1148       sysconf Retrieves values of system configurable variables.
1149
1150               The following will get the machine's clock speed.
1151
1152                       $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
1153
1154               Returns "undef" on failure.
1155
1156       system  This is identical to Perl's builtin "system()" function, see
1157               "system" in perlfunc.
1158
1159       tan     This is identical to the C function "tan()", returning the
1160               tangent of the numerical argument.  See also Math::Trig.
1161
1162       tanh    This is identical to the C function "tanh()", returning the
1163               hyperbolic tangent of the numerical argument.   See also
1164               Math::Trig.
1165
1166       tcdrain This is similar to the C function "tcdrain()" for draining the
1167               output queue of its argument stream.
1168
1169               Returns "undef" on failure.
1170
1171       tcflow  This is similar to the C function "tcflow()" for controlling
1172               the flow of its argument stream.
1173
1174               Returns "undef" on failure.
1175
1176       tcflush This is similar to the C function "tcflush()" for flushing the
1177               I/O buffers of its argument stream.
1178
1179               Returns "undef" on failure.
1180
1181       tcgetpgrp
1182               This is identical to the C function "tcgetpgrp()" for returning
1183               the process group identifier of the foreground process group of
1184               the controlling terminal.
1185
1186       tcsendbreak
1187               This is similar to the C function "tcsendbreak()" for sending a
1188               break on its argument stream.
1189
1190               Returns "undef" on failure.
1191
1192       tcsetpgrp
1193               This is similar to the C function "tcsetpgrp()" for setting the
1194               process group identifier of the foreground process group of the
1195               controlling terminal.
1196
1197               Returns "undef" on failure.
1198
1199       time    This is identical to Perl's builtin "time()" function for
1200               returning the number of seconds since the epoch (whatever it is
1201               for the system), see "time" in perlfunc.
1202
1203       times   The times() function returns elapsed realtime since some point
1204               in the past (such as system startup), user and system times for
1205               this process, and user and system times used by child
1206               processes.  All times are returned in clock ticks.
1207
1208                   ($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
1209
1210               Note: Perl's builtin "times()" function returns four values,
1211               measured in seconds.
1212
1213       tmpfile Use method "IO::File::new_tmpfile()" instead, or see
1214               File::Temp.
1215
1216       tmpnam  Returns a name for a temporary file.
1217
1218                       $tmpfile = POSIX::tmpnam();
1219
1220               For security reasons, which are probably detailed in your
1221               system's documentation for the C library tmpnam() function,
1222               this interface should not be used; instead see File::Temp.
1223
1224       tolower This is identical to the C function, except that it can apply
1225               to a single character or to a whole string.  Consider using the
1226               "lc()" function, see "lc" in perlfunc, or the equivalent "\L"
1227               operator inside doublequotish strings.
1228
1229       toupper This is identical to the C function, except that it can apply
1230               to a single character or to a whole string.  Consider using the
1231               "uc()" function, see "uc" in perlfunc, or the equivalent "\U"
1232               operator inside doublequotish strings.
1233
1234       ttyname This is identical to the C function "ttyname()" for returning
1235               the name of the current terminal.
1236
1237       tzname  Retrieves the time conversion information from the "tzname"
1238               variable.
1239
1240                       POSIX::tzset();
1241                       ($std, $dst) = POSIX::tzname();
1242
1243       tzset   This is identical to the C function "tzset()" for setting the
1244               current timezone based on the environment variable "TZ", to be
1245               used by "ctime()", "localtime()", "mktime()", and "strftime()"
1246               functions.
1247
1248       umask   This is identical to Perl's builtin "umask()" function for
1249               setting (and querying) the file creation permission mask, see
1250               "umask" in perlfunc.
1251
1252       uname   Get name of current operating system.
1253
1254                       ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
1255
1256               Note that the actual meanings of the various fields are not
1257               that well standardized, do not expect any great portability.
1258               The $sysname might be the name of the operating system, the
1259               $nodename might be the name of the host, the $release might be
1260               the (major) release number of the operating system, the
1261               $version might be the (minor) release number of the operating
1262               system, and the $machine might be a hardware identifier.
1263               Maybe.
1264
1265       ungetc  Use method "IO::Handle::ungetc()" instead.
1266
1267       unlink  This is identical to Perl's builtin "unlink()" function for
1268               removing files, see "unlink" in perlfunc.
1269
1270       utime   This is identical to Perl's builtin "utime()" function for
1271               changing the time stamps of files and directories, see "utime"
1272               in perlfunc.
1273
1274       vfprintf
1275               vfprintf() is C-specific, see "printf" in perlfunc instead.
1276
1277       vprintf vprintf() is C-specific, see "printf" in perlfunc instead.
1278
1279       vsprintf
1280               vsprintf() is C-specific, see "sprintf" in perlfunc instead.
1281
1282       wait    This is identical to Perl's builtin "wait()" function, see
1283               "wait" in perlfunc.
1284
1285       waitpid Wait for a child process to change state.  This is identical to
1286               Perl's builtin "waitpid()" function, see "waitpid" in perlfunc.
1287
1288                       $pid = POSIX::waitpid( -1, POSIX::WNOHANG );
1289                       print "status = ", ($? / 256), "\n";
1290
1291       wcstombs
1292               This is identical to the C function "wcstombs()".  Perl does
1293               not have any support for the wide and multibyte characters of
1294               the C standards, so this might be a rather useless function.
1295
1296       wctomb  This is identical to the C function "wctomb()".  Perl does not
1297               have any support for the wide and multibyte characters of the C
1298               standards, so this might be a rather useless function.
1299
1300       write   Write to a file.  This uses file descriptors such as those
1301               obtained by calling "POSIX::open".
1302
1303                       $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
1304                       $buf = "hello";
1305                       $bytes = POSIX::write( $fd, $buf, 5 );
1306
1307               Returns "undef" on failure.
1308
1309               See also "syswrite" in perlfunc.
1310

CLASSES

1312   POSIX::SigAction
1313       new     Creates a new "POSIX::SigAction" object which corresponds to
1314               the C "struct sigaction".  This object will be destroyed
1315               automatically when it is no longer needed.  The first parameter
1316               is the handler, a sub reference.  The second parameter is a
1317               "POSIX::SigSet" object, it defaults to the empty set.  The
1318               third parameter contains the "sa_flags", it defaults to 0.
1319
1320                       $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
1321                       $sigaction = POSIX::SigAction->new( \&handler, $sigset, &POSIX::SA_NOCLDSTOP );
1322
1323               This "POSIX::SigAction" object is intended for use with the
1324               "POSIX::sigaction()" function.
1325
1326       handler
1327       mask
1328       flags   accessor functions to get/set the values of a SigAction object.
1329
1330                       $sigset = $sigaction->mask;
1331                       $sigaction->flags(&POSIX::SA_RESTART);
1332
1333       safe    accessor function for the "safe signals" flag of a SigAction
1334               object; see perlipc for general information on safe (a.k.a.
1335               "deferred") signals.  If you wish to handle a signal safely,
1336               use this accessor to set the "safe" flag in the
1337               "POSIX::SigAction" object:
1338
1339                       $sigaction->safe(1);
1340
1341               You may also examine the "safe" flag on the output action
1342               object which is filled in when given as the third parameter to
1343               "POSIX::sigaction()":
1344
1345                       sigaction(SIGINT, $new_action, $old_action);
1346                       if ($old_action->safe) {
1347                           # previous SIGINT handler used safe signals
1348                       }
1349
1350   POSIX::SigRt
1351       %SIGRT  A hash of the POSIX realtime signal handlers.  It is an
1352               extension of the standard %SIG, the $POSIX::SIGRT{SIGRTMIN} is
1353               roughly equivalent to $SIG{SIGRTMIN}, but the right POSIX moves
1354               (see below) are made with the POSIX::SigSet and
1355               POSIX::sigaction instead of accessing the %SIG.
1356
1357               You can set the %POSIX::SIGRT elements to set the POSIX
1358               realtime signal handlers, use "delete" and "exists" on the
1359               elements, and use "scalar" on the %POSIX::SIGRT to find out how
1360               many POSIX realtime signals there are available (SIGRTMAX -
1361               SIGRTMIN + 1, the SIGRTMAX is a valid POSIX realtime signal).
1362
1363               Setting the %SIGRT elements is equivalent to calling this:
1364
1365                 sub new {
1366                   my ($rtsig, $handler, $flags) = @_;
1367                   my $sigset = POSIX::SigSet($rtsig);
1368                   my $sigact = POSIX::SigAction->new($handler, $sigset, $flags);
1369                   sigaction($rtsig, $sigact);
1370                 }
1371
1372               The flags default to zero, if you want something different you
1373               can either use "local" on $POSIX::SigRt::SIGACTION_FLAGS, or
1374               you can derive from POSIX::SigRt and define your own "new()"
1375               (the tied hash STORE method of the %SIGRT calls "new($rtsig,
1376               $handler, $SIGACTION_FLAGS)", where the $rtsig ranges from zero
1377               to SIGRTMAX - SIGRTMIN + 1).
1378
1379               Just as with any signal, you can use sigaction($rtsig, undef,
1380               $oa) to retrieve the installed signal handler (or, rather, the
1381               signal action).
1382
1383               NOTE: whether POSIX realtime signals really work in your
1384               system, or whether Perl has been compiled so that it works with
1385               them, is outside of this discussion.
1386
1387       SIGRTMIN
1388               Return the minimum POSIX realtime signal number available, or
1389               "undef" if no POSIX realtime signals are available.
1390
1391       SIGRTMAX
1392               Return the maximum POSIX realtime signal number available, or
1393               "undef" if no POSIX realtime signals are available.
1394
1395   POSIX::SigSet
1396       new     Create a new SigSet object.  This object will be destroyed
1397               automatically when it is no longer needed.  Arguments may be
1398               supplied to initialize the set.
1399
1400               Create an empty set.
1401
1402                       $sigset = POSIX::SigSet->new;
1403
1404               Create a set with SIGUSR1.
1405
1406                       $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
1407
1408       addset  Add a signal to a SigSet object.
1409
1410                       $sigset->addset( &POSIX::SIGUSR2 );
1411
1412               Returns "undef" on failure.
1413
1414       delset  Remove a signal from the SigSet object.
1415
1416                       $sigset->delset( &POSIX::SIGUSR2 );
1417
1418               Returns "undef" on failure.
1419
1420       emptyset
1421               Initialize the SigSet object to be empty.
1422
1423                       $sigset->emptyset();
1424
1425               Returns "undef" on failure.
1426
1427       fillset Initialize the SigSet object to include all signals.
1428
1429                       $sigset->fillset();
1430
1431               Returns "undef" on failure.
1432
1433       ismember
1434               Tests the SigSet object to see if it contains a specific
1435               signal.
1436
1437                       if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
1438                               print "contains SIGUSR1\n";
1439                       }
1440
1441   POSIX::Termios
1442       new     Create a new Termios object.  This object will be destroyed
1443               automatically when it is no longer needed.  A Termios object
1444               corresponds to the termios C struct.  new() mallocs a new one,
1445               getattr() fills it from a file descriptor, and setattr() sets a
1446               file descriptor's parameters to match Termios' contents.
1447
1448                       $termios = POSIX::Termios->new;
1449
1450       getattr Get terminal control attributes.
1451
1452               Obtain the attributes for stdin.
1453
1454                       $termios->getattr( 0 ) # Recommended for clarity.
1455                       $termios->getattr()
1456
1457               Obtain the attributes for stdout.
1458
1459                       $termios->getattr( 1 )
1460
1461               Returns "undef" on failure.
1462
1463       getcc   Retrieve a value from the c_cc field of a termios object.  The
1464               c_cc field is an array so an index must be specified.
1465
1466                       $c_cc[1] = $termios->getcc(1);
1467
1468       getcflag
1469               Retrieve the c_cflag field of a termios object.
1470
1471                       $c_cflag = $termios->getcflag;
1472
1473       getiflag
1474               Retrieve the c_iflag field of a termios object.
1475
1476                       $c_iflag = $termios->getiflag;
1477
1478       getispeed
1479               Retrieve the input baud rate.
1480
1481                       $ispeed = $termios->getispeed;
1482
1483       getlflag
1484               Retrieve the c_lflag field of a termios object.
1485
1486                       $c_lflag = $termios->getlflag;
1487
1488       getoflag
1489               Retrieve the c_oflag field of a termios object.
1490
1491                       $c_oflag = $termios->getoflag;
1492
1493       getospeed
1494               Retrieve the output baud rate.
1495
1496                       $ospeed = $termios->getospeed;
1497
1498       setattr Set terminal control attributes.
1499
1500               Set attributes immediately for stdout.
1501
1502                       $termios->setattr( 1, &POSIX::TCSANOW );
1503
1504               Returns "undef" on failure.
1505
1506       setcc   Set a value in the c_cc field of a termios object.  The c_cc
1507               field is an array so an index must be specified.
1508
1509                       $termios->setcc( &POSIX::VEOF, 1 );
1510
1511       setcflag
1512               Set the c_cflag field of a termios object.
1513
1514                       $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
1515
1516       setiflag
1517               Set the c_iflag field of a termios object.
1518
1519                       $termios->setiflag( $c_iflag | &POSIX::BRKINT );
1520
1521       setispeed
1522               Set the input baud rate.
1523
1524                       $termios->setispeed( &POSIX::B9600 );
1525
1526               Returns "undef" on failure.
1527
1528       setlflag
1529               Set the c_lflag field of a termios object.
1530
1531                       $termios->setlflag( $c_lflag | &POSIX::ECHO );
1532
1533       setoflag
1534               Set the c_oflag field of a termios object.
1535
1536                       $termios->setoflag( $c_oflag | &POSIX::OPOST );
1537
1538       setospeed
1539               Set the output baud rate.
1540
1541                       $termios->setospeed( &POSIX::B9600 );
1542
1543               Returns "undef" on failure.
1544
1545       Baud rate values
1546               B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600
1547               B4800 B50 B2400 B110
1548
1549       Terminal interface values
1550               TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH
1551               TCSAFLUSH TCIOFF TCOOFF
1552
1553       c_cc field values
1554               VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN
1555               VTIME NCCS
1556
1557       c_cflag field values
1558               CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
1559
1560       c_iflag field values
1561               BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON
1562               PARMRK
1563
1564       c_lflag field values
1565               ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
1566
1567       c_oflag field values
1568               OPOST
1569

PATHNAME CONSTANTS

1571       Constants
1572               _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT
1573               _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF
1574               _PC_VDISABLE
1575

POSIX CONSTANTS

1577       Constants
1578               _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED
1579               _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON
1580               _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX
1581               _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF
1582               _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX
1583               _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION
1584

SYSTEM CONFIGURATION

1586       Constants
1587               _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
1588               _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
1589               _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
1590

ERRNO

1592       Constants
1593               E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN
1594               EALREADY EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED
1595               ECONNRESET EDEADLK EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG
1596               EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR EINVAL EIO EISCONN
1597               EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENETDOWN
1598               ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
1599               ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN
1600               ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
1601               EPFNOSUPPORT EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE
1602               EREMOTE ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH
1603               ESTALE ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV
1604

FCNTL

1606       Constants
1607               FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD
1608               F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND
1609               O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
1610               O_WRONLY
1611

FLOAT

1613       Constants
1614               DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP
1615               DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG
1616               FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
1617               FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS
1618               LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP
1619               LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP
1620

LIMITS

1622       Constants
1623               ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN
1624               LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX
1625               NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX
1626               SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX
1627               UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
1628

LOCALE

1630       Constants
1631               LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
1632

MATH

1634       Constants
1635               HUGE_VAL
1636

SIGNAL

1638       Constants
1639               SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND
1640               SA_RESTART SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE
1641               SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP
1642               SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIG_BLOCK
1643               SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
1644

STAT

1646       Constants
1647               S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID
1648               S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
1649
1650       Macros  S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
1651

STDLIB

1653       Constants
1654               EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
1655

STDIO

1657       Constants
1658               BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
1659

TIME

1661       Constants
1662               CLK_TCK CLOCKS_PER_SEC
1663

UNISTD

1665       Constants
1666               R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO
1667               STDERR_FILENO W_OK X_OK
1668

WAIT

1670       Constants
1671               WNOHANG WUNTRACED
1672
1673               WNOHANG         Do not suspend the calling process until a
1674                               child process changes state but instead return
1675                               immediately.
1676
1677               WUNTRACED       Catch stopped child processes.
1678
1679       Macros  WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
1680
1681               WIFEXITED       WIFEXITED($?) returns true if the child process
1682                               exited normally ("exit()" or by falling off the
1683                               end of "main()")
1684
1685               WEXITSTATUS     WEXITSTATUS($?) returns the normal exit status
1686                               of the child process (only meaningful if
1687                               WIFEXITED($?) is true)
1688
1689               WIFSIGNALED     WIFSIGNALED($?) returns true if the child
1690                               process terminated because of a signal
1691
1692               WTERMSIG        WTERMSIG($?) returns the signal the child
1693                               process terminated for (only meaningful if
1694                               WIFSIGNALED($?) is true)
1695
1696               WIFSTOPPED      WIFSTOPPED($?) returns true if the child
1697                               process is currently stopped (can happen only
1698                               if you specified the WUNTRACED flag to
1699                               waitpid())
1700
1701               WSTOPSIG        WSTOPSIG($?) returns the signal the child
1702                               process was stopped for (only meaningful if
1703                               WIFSTOPPED($?) is true)
1704
1705
1706
1707perl v5.12.4                      2011-06-20                        POSIX(3pm)
Impressum