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

CLASSES

1267       POSIX::SigAction
1268
1269       new     Creates a new "POSIX::SigAction" object which corresponds to
1270               the C "struct sigaction".  This object will be destroyed auto‐
1271               matically when it is no longer needed.  The first parameter is
1272               the fully-qualified name of a sub which is a signal-handler.
1273               The second parameter is a "POSIX::SigSet" object, it defaults
1274               to the empty set.  The third parameter contains the "sa_flags",
1275               it defaults to 0.
1276
1277                       $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
1278                       $sigaction = POSIX::SigAction->new( \&main::handler, $sigset, &POSIX::SA_NOCLDSTOP );
1279
1280               This "POSIX::SigAction" object is intended for use with the
1281               "POSIX::sigaction()" function.
1282
1283       handler
1284       mask
1285       flags   accessor functions to get/set the values of a SigAction object.
1286
1287                       $sigset = $sigaction->mask;
1288                       $sigaction->flags(&POSIX::SA_RESTART);
1289
1290       safe    accessor function for the "safe signals" flag of a SigAction
1291               object; see perlipc for general information on safe (a.k.a.
1292               "deferred") signals.  If you wish to handle a signal safely,
1293               use this accessor to set the "safe" flag in the "POSIX::SigAc‐
1294               tion" object:
1295
1296                       $sigaction->safe(1);
1297
1298               You may also examine the "safe" flag on the output action
1299               object which is filled in when given as the third parameter to
1300               "POSIX::sigaction()":
1301
1302                       sigaction(SIGINT, $new_action, $old_action);
1303                       if ($old_action->safe) {
1304                           # previous SIGINT handler used safe signals
1305                       }
1306
1307       POSIX::SigSet
1308
1309       new     Create a new SigSet object.  This object will be destroyed
1310               automatically when it is no longer needed.  Arguments may be
1311               supplied to initialize the set.
1312
1313               Create an empty set.
1314
1315                       $sigset = POSIX::SigSet->new;
1316
1317               Create a set with SIGUSR1.
1318
1319                       $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
1320
1321       addset  Add a signal to a SigSet object.
1322
1323                       $sigset->addset( &POSIX::SIGUSR2 );
1324
1325               Returns "undef" on failure.
1326
1327       delset  Remove a signal from the SigSet object.
1328
1329                       $sigset->delset( &POSIX::SIGUSR2 );
1330
1331               Returns "undef" on failure.
1332
1333       emptyset
1334               Initialize the SigSet object to be empty.
1335
1336                       $sigset->emptyset();
1337
1338               Returns "undef" on failure.
1339
1340       fillset Initialize the SigSet object to include all signals.
1341
1342                       $sigset->fillset();
1343
1344               Returns "undef" on failure.
1345
1346       ismember
1347               Tests the SigSet object to see if it contains a specific sig‐
1348               nal.
1349
1350                       if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
1351                               print "contains SIGUSR1\n";
1352                       }
1353
1354       POSIX::Termios
1355
1356       new     Create a new Termios object.  This object will be destroyed
1357               automatically when it is no longer needed.  A Termios object
1358               corresponds to the termios C struct.  new() mallocs a new one,
1359               getattr() fills it from a file descriptor, and setattr() sets a
1360               file descriptor's parameters to match Termios' contents.
1361
1362                       $termios = POSIX::Termios->new;
1363
1364       getattr Get terminal control attributes.
1365
1366               Obtain the attributes for stdin.
1367
1368                       $termios->getattr()
1369
1370               Obtain the attributes for stdout.
1371
1372                       $termios->getattr( 1 )
1373
1374               Returns "undef" on failure.
1375
1376       getcc   Retrieve a value from the c_cc field of a termios object.  The
1377               c_cc field is an array so an index must be specified.
1378
1379                       $c_cc[1] = $termios->getcc(1);
1380
1381       getcflag
1382               Retrieve the c_cflag field of a termios object.
1383
1384                       $c_cflag = $termios->getcflag;
1385
1386       getiflag
1387               Retrieve the c_iflag field of a termios object.
1388
1389                       $c_iflag = $termios->getiflag;
1390
1391       getispeed
1392               Retrieve the input baud rate.
1393
1394                       $ispeed = $termios->getispeed;
1395
1396       getlflag
1397               Retrieve the c_lflag field of a termios object.
1398
1399                       $c_lflag = $termios->getlflag;
1400
1401       getoflag
1402               Retrieve the c_oflag field of a termios object.
1403
1404                       $c_oflag = $termios->getoflag;
1405
1406       getospeed
1407               Retrieve the output baud rate.
1408
1409                       $ospeed = $termios->getospeed;
1410
1411       setattr Set terminal control attributes.
1412
1413               Set attributes immediately for stdout.
1414
1415                       $termios->setattr( 1, &POSIX::TCSANOW );
1416
1417               Returns "undef" on failure.
1418
1419       setcc   Set a value in the c_cc field of a termios object.  The c_cc
1420               field is an array so an index must be specified.
1421
1422                       $termios->setcc( &POSIX::VEOF, 1 );
1423
1424       setcflag
1425               Set the c_cflag field of a termios object.
1426
1427                       $termios->setcflag( $c_cflag ⎪ &POSIX::CLOCAL );
1428
1429       setiflag
1430               Set the c_iflag field of a termios object.
1431
1432                       $termios->setiflag( $c_iflag ⎪ &POSIX::BRKINT );
1433
1434       setispeed
1435               Set the input baud rate.
1436
1437                       $termios->setispeed( &POSIX::B9600 );
1438
1439               Returns "undef" on failure.
1440
1441       setlflag
1442               Set the c_lflag field of a termios object.
1443
1444                       $termios->setlflag( $c_lflag ⎪ &POSIX::ECHO );
1445
1446       setoflag
1447               Set the c_oflag field of a termios object.
1448
1449                       $termios->setoflag( $c_oflag ⎪ &POSIX::OPOST );
1450
1451       setospeed
1452               Set the output baud rate.
1453
1454                       $termios->setospeed( &POSIX::B9600 );
1455
1456               Returns "undef" on failure.
1457
1458       Baud rate values
1459               B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600
1460               B4800 B50 B2400 B110
1461
1462       Terminal interface values
1463               TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH
1464               TCSAFLUSH TCIOFF TCOOFF
1465
1466       c_cc field values
1467               VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN
1468               VTIME NCCS
1469
1470       c_cflag field values
1471               CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
1472
1473       c_iflag field values
1474               BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON
1475               PARMRK
1476
1477       c_lflag field values
1478               ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
1479
1480       c_oflag field values
1481               OPOST
1482

PATHNAME CONSTANTS

1484       Constants
1485               _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT
1486               _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF _PC_VDIS‐
1487               ABLE
1488

POSIX CONSTANTS

1490       Constants
1491               _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED
1492               _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON
1493               _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX
1494               _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF
1495               _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX
1496               _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION
1497

SYSTEM CONFIGURATION

1499       Constants
1500               _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
1501               _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
1502               _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
1503

ERRNO

1505       Constants
1506               E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EAL‐
1507               READY EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET
1508               EDEADLK EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN
1509               EHOSTUNREACH EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP
1510               EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUN‐
1511               REACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC ENOLCK ENOMEM ENO‐
1512               PROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR ENOTEMPTY ENOT‐
1513               SOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE EPROCLIM
1514               EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART EROFS ESHUT‐
1515               DOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
1516               ETXTBSY EUSERS EWOULDBLOCK EXDEV
1517

FCNTL

1519       Constants
1520               FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD
1521               F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND
1522               O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
1523               O_WRONLY
1524

FLOAT

1526       Constants
1527               DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP
1528               DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG
1529               FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
1530               FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS
1531               LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP
1532               LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP
1533

LIMITS

1535       Constants
1536               ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN
1537               LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX
1538               NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX
1539               SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX
1540               UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
1541

LOCALE

1543       Constants
1544               LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
1545

MATH

1547       Constants
1548               HUGE_VAL
1549

SIGNAL

1551       Constants
1552               SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND
1553               SA_RESTART SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE
1554               SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP
1555               SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIG_BLOCK
1556               SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
1557

STAT

1559       Constants
1560               S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID
1561               S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
1562
1563       Macros  S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
1564

STDLIB

1566       Constants
1567               EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
1568

STDIO

1570       Constants
1571               BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
1572

TIME

1574       Constants
1575               CLK_TCK CLOCKS_PER_SEC
1576

UNISTD

1578       Constants
1579               R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO
1580               STDERR_FILENO W_OK X_OK
1581

WAIT

1583       Constants
1584               WNOHANG WUNTRACED
1585
1586               WNOHANG         Do not suspend the calling process until a
1587                               child process changes state but instead return
1588                               immediately.
1589
1590               WUNTRACED       Catch stopped child processes.
1591
1592       Macros  WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
1593
1594               WIFEXITED       WIFEXITED($?) returns true if the child process
1595                               exited normally ("exit()" or by falling off the
1596                               end of "main()")
1597
1598               WEXITSTATUS     WEXITSTATUS($?) returns the normal exit status
1599                               of the child process (only meaningful if WIFEX‐
1600                               ITED($?) is true)
1601
1602               WIFSIGNALED     WIFSIGNALED($?) returns true if the child
1603                               process terminated because of a signal
1604
1605               WTERMSIG        WTERMSIG($?) returns the signal the child
1606                               process terminated for (only meaningful if
1607                               WIFSIGNALED($?) is true)
1608
1609               WIFSTOPPED      WIFSTOPPED($?) returns true if the child
1610                               process is currently stopped (can happen only
1611                               if you specified the WUNTRACED flag to wait‐
1612                               pid())
1613
1614               WSTOPSIG        WSTOPSIG($?) returns the signal the child
1615                               process was stopped for (only meaningful if
1616                               WIFSTOPPED($?) is true)
1617
1618
1619
1620perl v5.8.8                       2001-09-21                        POSIX(3pm)
Impressum