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