POSIX
- NAME
- SYNOPSIS
- DESCRIPTION
- CAVEATS
- FUNCTIONS
- CLASSES
- PATHNAME CONSTANTS
- POSIX CONSTANTS
- SYSTEM CONFIGURATION
- ERRNO
- FCNTL
- FLOAT
- LIMITS
- LOCALE
- MATH
- SIGNAL
- STAT
- STDLIB
- STDIO
- TIME
- UNISTD
- WAIT
NAME
POSIX - Perl interface to IEEE Std 1003.1
SYNOPSIS
use POSIX ();
use POSIX qw(setsid);
use POSIX qw(:errno_h :fcntl_h);
printf "EINTR is %d\n", EINTR;
$sess_id = POSIX::setsid();
$fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
# note: that's a filedescriptor, *NOT* a filehandle
DESCRIPTION
The POSIX module permits you to access all (or nearly all) the standard POSIX 1003.1 identifiers. Many of these identifiers have been given Perl-ish interfaces.
Everything is exported by default with the exception of any POSIX functions with the same name as a built-in Perl function, such as abs, alarm, rmdir, write, etc.., which will be exported only if you ask for them explicitly. This is an unfortunate backwards compatibility feature. You can stop the exporting by saying use
POSIX () and then use the fully qualified names (e.g., POSIX::SEEK_END ), or by giving an explicit import list. If you do neither, and opt for the default, use POSIX; has to import 553 symbols.
This document gives a condensed list of the features available in the POSIX module. Consult your operating system's manpages for general information on most features. Consult perlfunc for functions which are noted as being identical to Perl's builtin functions.
The first section describes POSIX functions from the 1003.1 specification. The second section describes some classes for signal objects, TTY objects, and other miscellaneous objects. The remaining sections list various constants and macros in an organization which roughly follows IEEE Std 1003.1b-1993.
CAVEATS
A few functions are not implemented because they are C specific. If you attempt to call these, they will print a message telling you that they aren't implemented, and suggest using the Perl equivalent, should one exist. For example, trying to access the setjmp() call will elicit the message "setjmp() is C-specific: use eval {} instead ".
Furthermore, some evil vendors will claim 1003.1 compliance, but in fact are not so: they will not pass the PCTS (POSIX Compliance Test Suites). For example, one vendor may not define EDEADLK , or the semantics of the errno values set by open(2) might not be quite right. Perl does not attempt to verify POSIX compliance. That means you can currently successfully say "use POSIX", and then later in your program you find that your vendor has been lax and there's no usable ICANON macro after all. This could be construed to be a bug.
FUNCTIONS
-
_exitThis is identical to the C function
_exit(). It exits the program immediately which means among other things buffered I/O is not flushed.Note that when using threads and in Linux this is not a good way to exit a thread because in Linux processes and threads are kind of the same thing (Note: while this is the situation in early 2003 there are projects under way to have threads with more POSIXly semantics in Linux). If you want not to return from a thread, detach the thread.
-
abortThis is identical to the C function
abort(). It terminates the process with aSIGABRTsignal unless caught by a signal handler or if the handler does not return normally (it e.g. does alongjmp). -
absThis is identical to Perl's builtin
abs()function, returning the absolute value of its numerical argument. -
accessDetermines the accessibility of a file.
if( POSIX::access( "/", &POSIX::R_OK ) ){ print "have read permission\n"; }Returns
undefon failure. Note: do not useaccess()for security purposes. Between theaccess()call and the operation you are preparing for the permissions might change: a classic race condition. -
acosThis is identical to the C function
acos(), returning the arcus cosine of its numerical argument. See also Math::Trig. -
alarmThis is identical to Perl's builtin
alarm()function, either for arming or disarming theSIGARLMtimer. -
asctimeThis is identical to the C function
asctime(). It returns a string of the form"Fri Jun 2 18:22:13 2000\n\0"
and it is called thusly
$asctime = asctime($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
The
$monis zero-based: January equals0. The$yearis 1900-based: 2001 equals101.$wdayand$ydaydefault to zero (and are usually ignored anyway), and$isdstdefaults to -1. -
asinThis is identical to the C function
asin(), returning the arcus sine of its numerical argument. See also Math::Trig. -
assertUnimplemented, but you can use die and the Carp module to achieve similar things.
-
atanThis is identical to the C function
atan(), returning the arcus tangent of its numerical argument. See also Math::Trig. -
atan2This is identical to Perl's builtin
atan2()function, returning the arcus tangent defined by its two numerical arguments, the y coordinate and the x coordinate. See also Math::Trig. -
atexitatexit()is C-specific: useEND {}instead, see perlmod. -
atofatof()is C-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. -
atoiatoi()is C-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. If you need to have just the integer part, see int. -
atolatol()is C-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. If you need to have just the integer part, see int. -
bsearchbsearch()not supplied. For doing binary search on wordlists, see Search::Dict. -
calloccalloc()is C-specific. Perl does memory management transparently. -
ceilThis is identical to the C function
ceil(), returning the smallest integer value greater than or equal to the given numerical argument. -
chdirThis is identical to Perl's builtin
chdir()function, allowing one to change the working (default) directory, see chdir. -
chmodThis is identical to Perl's builtin
chmod()function, allowing one to change file and directory permissions, see chmod. -
chownThis is identical to Perl's builtin
chown()function, allowing one to change file and directory owners and groups, see chown. -
clearerrUse the method
IO::Handle::clearerr()instead, to reset the error state (if any) and EOF state (if any) of the given stream. -
clockThis is identical to the C function
clock(), returning the amount of spent processor time in microseconds. -
closeClose the file. This uses file descriptors such as those obtained by calling
POSIX::open.$fd = POSIX::open( "foo", &POSIX::O_RDONLY ); POSIX::close( $fd );
Returns
undefon failure.See also close.
-
closedirThis is identical to Perl's builtin
closedir()function for closing a directory handle, see closedir. -
cosThis is identical to Perl's builtin
cos()function, for returning the cosine of its numerical argument, see cos. See also Math::Trig. -
coshThis is identical to the C function
cosh(), for returning the hyperbolic cosine of its numeric argument. See also Math::Trig. -
creatCreate a new file. This returns a file descriptor like the ones returned by
POSIX::open. UsePOSIX::closeto close the file.$fd = POSIX::creat( "foo", 0611 ); POSIX::close( $fd );
See also sysopen and its
O_CREATflag. -
ctermidGenerates the path name for the controlling terminal.
$path = POSIX::ctermid();
-
ctimeThis is identical to the C function
ctime()and equivalent toasctime(localtime(...)), see asctime and localtime. -
cuseridGet the login name of the owner of the current process.
$name = POSIX::cuserid();
-
difftimeThis is identical to the C function
difftime(), for returning the time difference (in seconds) between two times (as returned bytime()), see time. -
divdiv()is C-specific, use int on the usual/division and the modulus%. -
dupThis is similar to the C function
dup(), for duplicating a file descriptor.This uses file descriptors such as those obtained by calling
POSIX::open.Returns
undefon failure. -
dup2This is similar to the C function
dup2(), for duplicating a file descriptor to an another known file descriptor.This uses file descriptors such as those obtained by calling
POSIX::open.Returns
undefon failure. -
errnoReturns the value of errno.
$errno = POSIX::errno();
This identical to the numerical values of the
$!, see $ERRNO in perlvar. -
execlexecl()is C-specific, see exec. -
execleexecle()is C-specific, see exec. -
execlpexeclp()is C-specific, see exec. -
execvexecv()is C-specific, see exec. -
execveexecve()is C-specific, see exec. -
execvpexecvp()is C-specific, see exec. -
exitThis is identical to Perl's builtin
exit()function for exiting the program, see exit. -
expThis is identical to Perl's builtin
exp()function for returning the exponent (e-based) of the numerical argument, see exp. -
fabsThis is identical to Perl's builtin
abs()function for returning the absolute value of the numerical argument, see abs. -
fcloseUse method
IO::Handle::close()instead, or see close. -
fcntlThis is identical to Perl's builtin
fcntl()function, see fcntl. -
fdopenUse method
IO::Handle::new_from_fd()instead, or see open. -
feofUse method
IO::Handle::eof()instead, or see eof. -
ferrorUse method
IO::Handle::error()instead. -
fflushUse method
IO::Handle::flush()instead. See also$OUTPUT_AUTOFLUSH in perlvar. -
fgetcUse method
IO::Handle::getc()instead, or see read. -
fgetposUse method
IO::Seekable::getpos()instead, or see seek. -
fgetsUse method
IO::Handle::gets()instead. Similar to <>, also known as readline. -
filenoUse method
IO::Handle::fileno()instead, or see fileno. -
floorThis is identical to the C function
floor(), returning the largest integer value less than or equal to the numerical argument. -
fmodThis is identical to the C function
fmod().$r = fmod($x, $y);
It returns the remainder
$r = $x - $n*$y, where$n = trunc($x/$y). The$rhas the same sign as$xand magnitude (absolute value) less than the magnitude of$y. -
fopenUse method
IO::File::open()instead, or see open. -
forkThis is identical to Perl's builtin
fork()function for duplicating the current process, see fork and perlfork if you are in Windows. -
fpathconfRetrieves the value of a configurable limit on a file or directory. This uses file descriptors such as those obtained by calling
POSIX::open.The following will determine the maximum length of the longest allowable pathname on the filesystem which holds /var/foo.
$fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY ); $path_max = POSIX::fpathconf($fd, &POSIX::_PC_PATH_MAX);
Returns
undefon failure. -
fprintffprintf()is C-specific, see printf instead. -
fputcfputc()is C-specific, see print instead. -
fputsfputs()is C-specific, see print instead. -
freadfread()is C-specific, see read instead. -
freefree()is C-specific. Perl does memory management transparently. -
freopenfreopen()is C-specific, see open instead. -
frexpReturn the mantissa and exponent of a floating-point number.
($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
-
fscanffscanf()is C-specific, use <> and regular expressions instead. -
fseekUse method
IO::Seekable::seek()instead, or see seek. -
fsetposUse method
IO::Seekable::setpos()instead, or seek seek. -
fstatGet file status. This uses file descriptors such as those obtained by calling
POSIX::open. The data returned is identical to the data from Perl's builtinstatfunction.$fd = POSIX::open( "foo", &POSIX::O_RDONLY ); @stats = POSIX::fstat( $fd );
-
fsyncUse method
IO::Handle::sync()instead. -
ftellUse method
IO::Seekable::tell()instead, or see tell. -
fwritefwrite()is C-specific, see print instead. -
getcThis is identical to Perl's builtin
getc()function, see getc. -
getcharReturns one character from STDIN. Identical to Perl's
getc(), see getc. -
getcwdReturns the name of the current working directory. See also Cwd.
-
getegidReturns the effective group identifier. Similar to Perl' s builtin variable
$(, see $EGID in perlvar. -
getenvReturns the value of the specified environment variable. The same information is available through the
%ENVarray. -
geteuidReturns the effective user identifier. Identical to Perl's builtin
$>variable, see $EUID in perlvar. -
getgidReturns the user's real group identifier. Similar to Perl's builtin variable
$), see $GID in perlvar. -
getgrgidThis is identical to Perl's builtin
getgrgid()function for returning group entries by group identifiers, see getgrgid. -
getgrnamThis is identical to Perl's builtin
getgrnam()function for returning group entries by group names, see getgrnam. -
getgroupsReturns the ids of the user's supplementary groups. Similar to Perl's builtin variable
$), see $GID in perlvar. -
getloginThis is identical to Perl's builtin
getlogin()function for returning the user name associated with the current session, see getlogin. -
getpgrpThis is identical to Perl's builtin
getpgrp()function for returning the process group identifier of the current process, see getpgrp. -
getpidReturns the process identifier. Identical to Perl's builtin variable
$$, see $PID in perlvar. -
getppidThis is identical to Perl's builtin
getppid()function for returning the process identifier of the parent process of the current process , see getppid. -
getpwnamThis is identical to Perl's builtin
getpwnam()function for returning user entries by user names, see getpwnam. -
getpwuidThis is identical to Perl's builtin
getpwuid()function for returning user entries by user identifiers, see getpwuid. -
getsReturns one line from
STDIN, similar to <>, also known as thereadline()function, see readline.NOTE: if you have C programs that still use
gets(), be very afraid. Thegets()function is a source of endless grief because it has no buffer overrun checks. It should never be used. Thefgets()function should be preferred instead. -
getuidReturns the user's identifier. Identical to Perl's builtin
$<variable, see $UID in perlvar. -
gmtimeThis is identical to Perl's builtin
gmtime()function for converting seconds since the epoch to a date in Greenwich Mean Time, see gmtime. -
isalnumDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:alnum:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string.You may want to use the
/\w/construct instead. -
isalphaDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:alpha:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
isattyReturns a boolean indicating whether the specified filehandle is connected to a tty. Similar to the
-toperator, see -X. -
iscntrlDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:cntrl:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
isdigitDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:digit:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string.You may want to use the
/\d/construct instead. -
isgraphDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:graph:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
islowerDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:lower:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string.Do not use
/[a-z]/unless you don't care about the current locale. -
isprintDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:print:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
ispunctDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:punct:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
isspaceDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:space:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string.You may want to use the
/\s/construct instead. -
isupperDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:upper:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string.Do not use
/[A-Z]/unless you don't care about the current locale. -
isxdigitDeprecated function whose use raises a warning, and which is slated to be removed in a future Perl version. It is very similar to matching against
qr/ ^ [[:xdigit:]]+ $ /x, which you should convert to use instead. The function is deprecated because 1) it doesn't handle UTF-8 encoded strings properly; and 2) it returnsTRUEeven if the input is the empty string. The function return is always based on the current locale, whereas using locale rules is optional with the regular expression, based on pragmas in effect and pattern modifiers (see Character set modifiers in perlre and Which character set modifier is in effect? in perlre).The function returns
TRUEif the input string is empty, or if the corresponding C function returnsTRUEfor every byte in the string. -
killThis is identical to Perl's builtin
kill()function for sending signals to processes (often to terminate them), see kill. -
labs(For returning absolute values of long integers.)
labs()is C-specific, see abs instead. -
lchownThis is identical to the C function, except the order of arguments is consistent with Perl's builtin
chown()with the added restriction of only one path, not an list of paths. Does the same thing as thechown()function but changes the owner of a symbolic link instead of the file the symbolic link points to. -
ldexpThis is identical to the C function
ldexp()for multiplying floating point numbers with powers of two.$x_quadrupled = POSIX::ldexp($x, 2);
-
ldiv(For computing dividends of long integers.)
ldiv()is C-specific, use/andint()instead. -
linkThis is identical to Perl's builtin
link()function for creating hard links into files, see link. -
localeconvGet numeric formatting information. Returns a reference to a hash containing the current locale formatting values. Users of this function should also read perllocale, which provides a comprehensive discussion of Perl locale handling, including a section devoted to this function.
Here is how to query the database for the de (Deutsch or German) locale.
my $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); print "Locale: \"$loc\"\n"; my $lconv = POSIX::localeconv(); foreach my $property (qw( decimal_point thousands_sep grouping int_curr_symbol currency_symbol mon_decimal_point mon_thousands_sep mon_grouping positive_sign negative_sign int_frac_digits frac_digits p_cs_precedes p_sep_by_space n_cs_precedes n_sep_by_space p_sign_posn n_sign_posn )) { printf qq(%s: "%s",\n), $property, $lconv->{$property}; } -
localtimeThis is identical to Perl's builtin
localtime()function for converting seconds since the epoch to a date see localtime. -
logThis is identical to Perl's builtin
log()function, returning the natural (e-based) logarithm of the numerical argument, see log. -
log10This is identical to the C function
log10(), returning the 10-base logarithm of the numerical argument. You can also usesub log10 { log($_[0]) / log(10) }or
sub log10 { log($_[0]) / 2.30258509299405 }or
sub log10 { log($_[0]) * 0.434294481903252 } -
longjmplongjmp()is C-specific: use die instead. -
lseekMove the file's read/write position. This uses file descriptors such as those obtained by calling
POSIX::open.$fd = POSIX::open( "foo", &POSIX::O_RDONLY ); $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
Returns
undefon failure. -
mallocmalloc()is C-specific. Perl does memory management transparently. -
mblenThis is identical to the C function
mblen(). Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. -
mbstowcsThis is identical to the C function
mbstowcs(). Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. -
mbtowcThis is identical to the C function
mbtowc(). Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. -
memchrmemchr()is C-specific, see index instead. -
memcmpmemcmp()is C-specific, useeqinstead, see perlop. -
memcpy -
memmove -
memsetmemset()is C-specific, usexinstead, see perlop. -
mkdirThis is identical to Perl's builtin
mkdir()function for creating directories, see mkdir. -
mkfifoThis is similar to the C function
mkfifo()for creating FIFO special files.if (mkfifo($path, $mode)) { ....Returns
undefon failure. The$modeis similar to the mode ofmkdir(), see mkdir, though formkfifoyou must specify the$mode. -
mktimeConvert date/time info to a calendar time.
Synopsis:
mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1)The month (
mon), weekday (wday), and yearday (yday) begin at zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The year (year) is given in years since 1900. I.e. The year 1995 is 95; the year 2001 is 101. Consult your system'smktime()manpage for details about these and the other arguments.Calendar time for December 12, 1995, at 10:30 am.
$time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); print "Date = ", POSIX::ctime($time_t);
Returns
undefon failure. -
modfReturn the integral and fractional parts of a floating-point number.
($fractional, $integral) = POSIX::modf( 3.14 );
-
niceThis is similar to the C function
nice(), for changing the scheduling preference of the current process. Positive arguments mean more polite process, negative values more needy process. Normal user processes can only be more polite.Returns
undefon failure. -
offsetofoffsetof()is C-specific, you probably want to see pack instead. -
openOpen a file for reading for writing. This returns file descriptors, not Perl filehandles. Use
POSIX::closeto close the file.Open a file read-only with mode 0666.
$fd = POSIX::open( "foo" );
Open a file for read and write.
$fd = POSIX::open( "foo", &POSIX::O_RDWR );
Open a file for write, with truncation.
$fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
Create a new file with mode 0640. Set up the file for writing.
$fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
Returns
undefon failure.See also sysopen.
-
opendirOpen a directory for reading.
$dir = POSIX::opendir( "/var" ); @files = POSIX::readdir( $dir ); POSIX::closedir( $dir );
Returns
undefon failure. -
pathconfRetrieves the value of a configurable limit on a file or directory.
The following will determine the maximum length of the longest allowable pathname on the filesystem which holds
/var.$path_max = POSIX::pathconf( "/var", &POSIX::_PC_PATH_MAX );
Returns
undefon failure. -
pauseThis is similar to the C function
pause(), which suspends the execution of the current process until a signal is received.Returns
undefon failure. -
perrorThis is identical to the C function
perror(), which outputs to the standard error stream the specified message followed by": "and the current error string. Use thewarn()function and the$!variable instead, see warn and $ERRNO in perlvar. -
pipeCreate an interprocess channel. This returns file descriptors like those returned by
POSIX::open.my ($read, $write) = POSIX::pipe(); POSIX::write( $write, "hello", 5 ); POSIX::read( $read, $buf, 5 );
See also pipe.
-
powComputes
$xraised to the power$exponent.$ret = POSIX::pow( $x, $exponent );
You can also use the
**operator, see perlop. -
printfFormats and prints the specified arguments to STDOUT. See also printf.
-
putcputc()is C-specific, see print instead. -
putcharputchar()is C-specific, see print instead. -
putsputs()is C-specific, see print instead. -
qsortqsort()is C-specific, see sort instead. -
raiseSends the specified signal to the current process. See also kill and the
$$in $PID in perlvar. -
rand -
readRead from a file. This uses file descriptors such as those obtained by calling
POSIX::open. If the buffer$bufis not large enough for the read then Perl will extend it to make room for the request.$fd = POSIX::open( "foo", &POSIX::O_RDONLY ); $bytes = POSIX::read( $fd, $buf, 3 );
Returns
undefon failure.See also sysread.
-
readdirThis is identical to Perl's builtin
readdir()function for reading directory entries, see readdir. -
reallocrealloc()is C-specific. Perl does memory management transparently. -
removeThis is identical to Perl's builtin
unlink()function for removing files, see unlink. -
renameThis is identical to Perl's builtin
rename()function for renaming files, see rename. -
rewindSeeks to the beginning of the file.
-
rewinddirThis is identical to Perl's builtin
rewinddir()function for rewinding directory entry streams, see rewinddir. -
rmdirThis is identical to Perl's builtin
rmdir()function for removing (empty) directories, see rmdir. -
scanfscanf()is C-specific, use <> and regular expressions instead, see perlre. -
setgidSets the real group identifier and the effective group identifier for this process. Similar to assigning a value to the Perl's builtin
$)variable, see $EGID in perlvar, except that the latter will change only the real user identifier, and that the setgid() uses only a single numeric argument, as opposed to a space-separated list of numbers. -
setjmp -
setlocaleModifies and queries the program's underlying locale. Users of this function should read perllocale, whch provides a comprehensive discussion of Perl locale handling, knowledge of which is necessary to properly use this function. It contains a section devoted to this function. The discussion here is merely a summary reference for
setlocale(). Note that Perl itself is almost entirely unaffected by the locale except within the scope of"use locale". (Exceptions are listed in Not within the scope of any use locale variant in perllocale.)The following examples assume
use POSIX qw(setlocale LC_ALL LC_CTYPE);
has been issued.
The following will set the traditional UNIX system locale behavior (the second argument
"C").$loc = setlocale( LC_ALL, "C" );
The following will query the current
LC_CTYPEcategory. (No second argument means 'query'.)$loc = setlocale( LC_CTYPE );
The following will set the
LC_CTYPEbehaviour according to the locale environment variables (the second argument""). Please see your system'ssetlocale(3)documentation for the locale environment variables' meaning or consult perllocale.$loc = setlocale( LC_CTYPE, "" );
The following will set the
LC_COLLATEbehaviour to Argentinian Spanish. NOTE: The naming and availability of locales depends on your operating system. Please consult perllocale for how to find out which locales are available in your system.$loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" );
-
setpgidThis is similar to the C function
setpgid()for setting the process group identifier of the current process.Returns
undefon failure. -
setsidThis is identical to the C function
setsid()for setting the session identifier of the current process. -
setuidSets the real user identifier and the effective user identifier for this process. Similar to assigning a value to the Perl's builtin
$<variable, see $UID in perlvar, except that the latter will change only the real user identifier. -
sigactionDetailed signal management. This uses
POSIX::SigActionobjects for theactionandoldactionarguments (the oldaction can also be just a hash reference). Consult your system'ssigactionmanpage for details, see alsoPOSIX::SigRt.Synopsis:
sigaction(signal, action, oldaction = 0)
Returns
undefon failure. Thesignalmust be a number (likeSIGHUP), not a string (like"SIGHUP"), though Perl does try hard to understand you.If you use the
SA_SIGINFOflag, the signal handler will in addition to the first argument, the signal name, also receive a second argument, a hash reference, inside which are the following keys with the following semantics, as defined by POSIX/SUSv3:signo the signal number errno the error number code if this is zero or less, the signal was sent by a user process and the uid and pid make sense, otherwise the signal was sent by the kernelThe following are also defined by POSIX/SUSv3, but unfortunately not very widely implemented:
pid the process id generating the signal uid the uid of the process id generating the signal status exit value or signal for SIGCHLD band band event for SIGPOLL
A third argument is also passed to the handler, which contains a copy of the raw binary contents of the
siginfostructure: if a system has some non-POSIX fields, this third argument is where tounpack()them from.Note that not all
siginfovalues make sense simultaneously (some are valid only for certain signals, for example), and not all values make sense from Perl perspective, you should to consult your system'ssigactionand possibly alsosiginfodocumentation. -
siglongjmpsiglongjmp()is C-specific: use die instead. -
sigpendingExamine signals that are blocked and pending. This uses
POSIX::SigSetobjects for thesigsetargument. Consult your system'ssigpendingmanpage for details.Synopsis:
sigpending(sigset)
Returns
undefon failure. -
sigprocmaskChange and/or examine calling process's signal mask. This uses
POSIX::SigSetobjects for thesigsetandoldsigsetarguments. Consult your system'ssigprocmaskmanpage for details.Synopsis:
sigprocmask(how, sigset, oldsigset = 0)
Returns
undefon failure.Note that you can't reliably block or unblock a signal from its own signal handler if you're using safe signals. Other signals can be blocked or unblocked reliably.
-
sigsetjmp -
sigsuspendInstall a signal mask and suspend process until signal arrives. This uses
POSIX::SigSetobjects for thesignal_maskargument. Consult your system'ssigsuspendmanpage for details.Synopsis:
sigsuspend(signal_mask)
Returns
undefon failure. -
sinThis is identical to Perl's builtin
sin()function for returning the sine of the numerical argument, see sin. See also Math::Trig. -
sinhThis is identical to the C function
sinh()for returning the hyperbolic sine of the numerical argument. See also Math::Trig. -
sleepThis is functionally identical to Perl's builtin
sleep()function for suspending the execution of the current for process for certain number of seconds, see sleep. There is one significant difference, however:POSIX::sleep()returns the number of unslept seconds, while theCORE::sleep()returns the number of slept seconds. -
sprintfThis is similar to Perl's builtin
sprintf()function for returning a string that has the arguments formatted as requested, see sprintf. -
sqrtThis is identical to Perl's builtin
sqrt()function. for returning the square root of the numerical argument, see sqrt. -
srandGive a seed the pseudorandom number generator, see srand.
-
sscanfsscanf()is C-specific, use regular expressions instead, see perlre. -
statThis is identical to Perl's builtin
stat()function for returning information about files and directories. -
strcatstrcat()is C-specific, use.=instead, see perlop. -
strchrstrchr()is C-specific, see index instead. -
strcmpstrcmp()is C-specific, useeqorcmpinstead, see perlop. -
strcollThis is identical to the C function
strcoll()for collating (comparing) strings transformed using thestrxfrm()function. Not really needed since Perl can do this transparently, see perllocale. -
strcpystrcpy()is C-specific, use=instead, see perlop. -
strcspnstrcspn()is C-specific, use regular expressions instead, see perlre. -
strerrorReturns the error string for the specified errno. Identical to the string form of the
$!, see $ERRNO in perlvar. -
strftimeConvert date and time information to string. Returns the string.
Synopsis:
strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
The month (
mon), weekday (wday), and yearday (yday) begin at zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The year (year) is given in years since 1900. I.e., the year 1995 is 95; the year 2001 is 101. Consult your system'sstrftime()manpage for details about these and the other arguments.If you want your code to be portable, your format (
fmt) argument should use only the conversion specifiers defined by the ANSI C standard (C89, to play safe). These areaAbBcdHIjmMpSUwWxXyYZ%. But even then, the results of some of the conversion specifiers are non-portable. For example, the specifiersaAbBcpZchange according to the locale settings of the user, and both how to set locales (the locale names) and what output to expect are non-standard. The specifiercchanges according to the timezone settings of the user and the timezone computation rules of the operating system. TheZspecifier is notoriously unportable since the names of timezones are non-standard. Sticking to the numeric specifiers is the safest route.The given arguments are made consistent as though by calling
mktime()before calling your system'sstrftime()function, except that theisdstvalue is not affected.The string for Tuesday, December 12, 1995.
$str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 ); print "$str\n";
-
strlen -
strncatstrncat()is C-specific, use.=instead, see perlop. -
strncmpstrncmp()is C-specific, useeqinstead, see perlop. -
strncpystrncpy()is C-specific, use=instead, see perlop. -
strpbrkstrpbrk()is C-specific, use regular expressions instead, see perlre. -
strrchrstrrchr()is C-specific, see rindex instead. -
strspnstrspn()is C-specific, use regular expressions instead, see perlre. -
strstrThis is identical to Perl's builtin
index()function, see index. -
strtodString to double translation. Returns the parsed number and the number of characters in the unparsed portion of the string. Truly POSIX-compliant systems set
$!($ERRNO) to indicate a translation error, so clear$!before calling strtod. However, non-POSIX systems may not check for overflow, and therefore will never set$!.strtod respects any POSIX setlocale()
LC_TIMEsettings, regardless of whether or not it is called from Perl code that is within the scope ofuse locale.To parse a string
$stras a floating point number use$! = 0; ($num, $n_unparsed) = POSIX::strtod($str);
The second returned item and
$!can be used to check for valid input:if (($str eq '') || ($n_unparsed != 0) || $!) { die "Non-numeric input $str" . ($! ? ": $!\n" : "\n"); }When called in a scalar context strtod returns the parsed number.
-
strtokstrtok()is C-specific, use regular expressions instead, see perlre, or split. -
strtolString to (long) integer translation. Returns the parsed number and the number of characters in the unparsed portion of the string. Truly POSIX-compliant systems set
$!($ERRNO) to indicate a translation error, so clear$!before callingstrtol. However, non-POSIX systems may not check for overflow, and therefore will never set$!.strtolshould respect any POSIX setlocale() settings.To parse a string
$stras a number in some base$baseuse$! = 0; ($num, $n_unparsed) = POSIX::strtol($str, $base);
The base should be zero or between 2 and 36, inclusive. When the base is zero or omitted strtol will use the string itself to determine the base: a leading "0x" or "0X" means hexadecimal; a leading "0" means octal; any other leading characters mean decimal. Thus, "1234" is parsed as a decimal number, "01234" as an octal number, and "0x1234" as a hexadecimal number.
The second returned item and
$!can be used to check for valid input:if (($str eq '') || ($n_unparsed != 0) || !$!) { die "Non-numeric input $str" . $! ? ": $!\n" : "\n"; }When called in a scalar context strtol returns the parsed number.
-
strtoulString to unsigned (long) integer translation.
strtoul()is identical tostrtol()except thatstrtoul()only parses unsigned integers. See strtol for details.Note: Some vendors supply
strtod()andstrtol()but notstrtoul(). Other vendors that do supplystrtoul()parse "-1" as a valid value. -
strxfrmString transformation. Returns the transformed string.
$dst = POSIX::strxfrm( $src );
Used in conjunction with the
strcoll()function, see strcoll.Not really needed since Perl can do this transparently, see perllocale.
-
sysconfRetrieves values of system configurable variables.
The following will get the machine's clock speed.
$clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
Returns
undefon failure. -
systemThis is identical to Perl's builtin
system()function, see system. -
tanThis is identical to the C function
tan(), returning the tangent of the numerical argument. See also Math::Trig. -
tanhThis is identical to the C function
tanh(), returning the hyperbolic tangent of the numerical argument. See also Math::Trig. -
tcdrainThis is similar to the C function
tcdrain()for draining the output queue of its argument stream.Returns
undefon failure. -
tcflowThis is similar to the C function
tcflow()for controlling the flow of its argument stream.Returns
undefon failure. -
tcflushThis is similar to the C function
tcflush()for flushing the I/O buffers of its argument stream.Returns
undefon failure. -
tcgetpgrpThis is identical to the C function
tcgetpgrp()for returning the process group identifier of the foreground process group of the controlling terminal. -
tcsendbreakThis is similar to the C function
tcsendbreak()for sending a break on its argument stream.Returns
undefon failure. -
tcsetpgrpThis is similar to the C function
tcsetpgrp()for setting the process group identifier of the foreground process group of the controlling terminal.Returns
undefon failure. -
timeThis is identical to Perl's builtin
time()function for returning the number of seconds since the epoch (whatever it is for the system), see time. -
timesThe
times()function returns elapsed realtime since some point in the past (such as system startup), user and system times for this process, and user and system times used by child processes. All times are returned in clock ticks.($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
Note: Perl's builtin
times()function returns four values, measured in seconds. -
tmpfileUse method
IO::File::new_tmpfile()instead, or see File::Temp. -
tmpnamReturns a name for a temporary file.
$tmpfile = POSIX::tmpnam();
For security reasons, which are probably detailed in your system's documentation for the C library
tmpnam()function, this interface should not be used; instead see File::Temp. -
tolowerThis is identical to the C function, except that it can apply to a single character or to a whole string. Consider using the
lc()function, see lc, or the equivalent\Loperator inside doublequotish strings. -
toupperThis is identical to the C function, except that it can apply to a single character or to a whole string. Consider using the
uc()function, see uc, or the equivalent\Uoperator inside doublequotish strings. -
ttynameThis is identical to the C function
ttyname()for returning the name of the current terminal. -
tznameRetrieves the time conversion information from the
tznamevariable.POSIX::tzset(); ($std, $dst) = POSIX::tzname();
-
tzsetThis is identical to the C function
tzset()for setting the current timezone based on the environment variableTZ, to be used byctime(),localtime(),mktime(), andstrftime()functions. -
umaskThis is identical to Perl's builtin
umask()function for setting (and querying) the file creation permission mask, see umask. -
unameGet name of current operating system.
($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
Note that the actual meanings of the various fields are not that well standardized, do not expect any great portability. The
$sysnamemight be the name of the operating system, the$nodenamemight be the name of the host, the$releasemight be the (major) release number of the operating system, the$versionmight be the (minor) release number of the operating system, and the$machinemight be a hardware identifier. Maybe. -
ungetcUse method
IO::Handle::ungetc()instead. -
unlinkThis is identical to Perl's builtin
unlink()function for removing files, see unlink. -
utimeThis is identical to Perl's builtin
utime()function for changing the time stamps of files and directories, see utime. -
vfprintfvfprintf()is C-specific, see printf instead. -
vprintfvprintf()is C-specific, see printf instead. -
vsprintfvsprintf()is C-specific, see sprintf instead. -
waitThis is identical to Perl's builtin
wait()function, see wait. -
waitpidWait for a child process to change state. This is identical to Perl's builtin
waitpid()function, see waitpid.$pid = POSIX::waitpid( -1, POSIX::WNOHANG ); print "status = ", ($? / 256), "\n";
-
wcstombsThis is identical to the C function
wcstombs(). Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. -
wctombThis is identical to the C function
wctomb(). Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. -
writeWrite to a file. This uses file descriptors such as those obtained by calling
POSIX::open.$fd = POSIX::open( "foo", &POSIX::O_WRONLY ); $buf = "hello"; $bytes = POSIX::write( $fd, $buf, 5 );
Returns
undefon failure.See also syswrite.
CLASSES
POSIX::SigAction
-
newCreates a new
POSIX::SigActionobject which corresponds to the Cstruct sigaction. This object will be destroyed automatically when it is no longer needed. The first parameter is the handler, a sub reference. The second parameter is aPOSIX::SigSetobject, it defaults to the empty set. The third parameter contains thesa_flags, it defaults to 0.$sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); $sigaction = POSIX::SigAction->new( \&handler, $sigset, &POSIX::SA_NOCLDSTOP );
This
POSIX::SigActionobject is intended for use with thePOSIX::sigaction()function.
-
handler -
mask -
flagsaccessor functions to get/set the values of a SigAction object.
$sigset = $sigaction->mask; $sigaction->flags(&POSIX::SA_RESTART);
-
safeaccessor function for the "safe signals" flag of a SigAction object; see perlipc for general information on safe (a.k.a. "deferred") signals. If you wish to handle a signal safely, use this accessor to set the "safe" flag in the
POSIX::SigActionobject:$sigaction->safe(1);
You may also examine the "safe" flag on the output action object which is filled in when given as the third parameter to
POSIX::sigaction():sigaction(SIGINT, $new_action, $old_action); if ($old_action->safe) { # previous SIGINT handler used safe signals }
POSIX::SigRt
-
%SIGRTA hash of the POSIX realtime signal handlers. It is an extension of the standard
%SIG, the$POSIX::SIGRT{SIGRTMIN}is roughly equivalent to$SIG{SIGRTMIN}, but the right POSIX moves (see below) are made with thePOSIX::SigSetandPOSIX::sigactioninstead of accessing the%SIG.You can set the
%POSIX::SIGRTelements to set the POSIX realtime signal handlers, usedeleteandexistson the elements, and usescalaron the%POSIX::SIGRTto find out how many POSIX realtime signals there are available(SIGRTMAX - SIGRTMIN + 1, theSIGRTMAXis a valid POSIX realtime signal).Setting the
%SIGRTelements is equivalent to calling this:sub new { my ($rtsig, $handler, $flags) = @_; my $sigset = POSIX::SigSet($rtsig); my $sigact = POSIX::SigAction->new($handler,$sigset,$flags); sigaction($rtsig, $sigact); }The flags default to zero, if you want something different you can either use
localon$POSIX::SigRt::SIGACTION_FLAGS, or you can derive from POSIX::SigRt and define your ownnew()(the tied hash STORE method of the%SIGRTcallsnew($rtsig, $handler, $SIGACTION_FLAGS), where the$rtsigranges from zero toSIGRTMAX - SIGRTMIN + 1).Just as with any signal, you can use
sigaction($rtsig, undef, $oa)to retrieve the installed signal handler (or, rather, the signal action).NOTE: whether POSIX realtime signals really work in your system, or whether Perl has been compiled so that it works with them, is outside of this discussion.
-
SIGRTMINReturn the minimum POSIX realtime signal number available, or
undefif no POSIX realtime signals are available. -
SIGRTMAXReturn the maximum POSIX realtime signal number available, or
undefif no POSIX realtime signals are available.
POSIX::SigSet
-
newCreate a new SigSet object. This object will be destroyed automatically when it is no longer needed. Arguments may be supplied to initialize the set.
Create an empty set.
$sigset = POSIX::SigSet->new;
Create a set with
SIGUSR1.$sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
-
addsetAdd a signal to a SigSet object.
$sigset->addset( &POSIX::SIGUSR2 );
Returns
undefon failure. -
delsetRemove a signal from the SigSet object.
$sigset->delset( &POSIX::SIGUSR2 );
Returns
undefon failure. -
emptysetInitialize the SigSet object to be empty.
$sigset->emptyset();
Returns
undefon failure. -
fillsetInitialize the SigSet object to include all signals.
$sigset->fillset();
Returns
undefon failure. -
ismemberTests the SigSet object to see if it contains a specific signal.
if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ print "contains SIGUSR1\n"; }
POSIX::Termios
-
newCreate a new Termios object. This object will be destroyed automatically when it is no longer needed. A Termios object corresponds to the termios C struct.
new()mallocs a new one,getattr()fills it from a file descriptor, andsetattr()sets a file descriptor's parameters to match Termios' contents.$termios = POSIX::Termios->new;
-
getattrGet terminal control attributes.
Obtain the attributes for stdin.
$termios->getattr( 0 ) # Recommended for clarity. $termios->getattr()
Obtain the attributes for stdout.
$termios->getattr( 1 )
Returns
undefon failure. -
getccRetrieve a value from the c_cc field of a termios object. The c_cc field is an array so an index must be specified.
$c_cc[1] = $termios->getcc(1);
-
getcflagRetrieve the c_cflag field of a termios object.
$c_cflag = $termios->getcflag;
-
getiflagRetrieve the c_iflag field of a termios object.
$c_iflag = $termios->getiflag;
-
getispeedRetrieve the input baud rate.
$ispeed = $termios->getispeed;
-
getlflagRetrieve the c_lflag field of a termios object.
$c_lflag = $termios->getlflag;
-
getoflagRetrieve the c_oflag field of a termios object.
$c_oflag = $termios->getoflag;
-
getospeedRetrieve the output baud rate.
$ospeed = $termios->getospeed;
-
setattrSet terminal control attributes.
Set attributes immediately for stdout.
$termios->setattr( 1, &POSIX::TCSANOW );
Returns
undefon failure. -
setccSet a value in the c_cc field of a termios object. The c_cc field is an array so an index must be specified.
$termios->setcc( &POSIX::VEOF, 1 );
-
setcflagSet the c_cflag field of a termios object.
$termios->setcflag( $c_cflag | &POSIX::CLOCAL );
-
setiflagSet the c_iflag field of a termios object.
$termios->setiflag( $c_iflag | &POSIX::BRKINT );
-
setispeedSet the input baud rate.
$termios->setispeed( &POSIX::B9600 );
Returns
undefon failure. -
setlflagSet the c_lflag field of a termios object.
$termios->setlflag( $c_lflag | &POSIX::ECHO );
-
setoflagSet the c_oflag field of a termios object.
$termios->setoflag( $c_oflag | &POSIX::OPOST );
-
setospeedSet the output baud rate.
$termios->setospeed( &POSIX::B9600 );
Returns
undefon failure. -
Baud rate values
B38400B75B200B134B300B1800B150B0B19200B1200B9600B600B4800B50B2400B110 -
Terminal interface values
TCSADRAINTCSANOWTCOONTCIOFLUSHTCOFLUSHTCIONTCIFLUSHTCSAFLUSHTCIOFFTCOOFF -
c_ccfield valuesVEOFVEOLVERASEVINTRVKILLVQUITVSUSPVSTARTVSTOPVMINVTIMENCCS -
c_cflagfield valuesCLOCALCREADCSIZECS5CS6CS7CS8CSTOPBHUPCLPARENBPARODD -
c_iflagfield valuesBRKINTICRNLIGNBRKIGNCRIGNPARINLCRINPCKISTRIPIXOFFIXONPARMRK -
c_lflagfield valuesECHOECHOEECHOKECHONLICANONIEXTENISIGNOFLSHTOSTOP -
c_oflagfield valuesOPOST
PATHNAME CONSTANTS
-
Constants
_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
POSIX CONSTANTS
-
Constants
_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
SYSTEM CONFIGURATION
-
Constants
_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
ERRNO
-
Constants
E2BIGEACCESEADDRINUSEEADDRNOTAVAILEAFNOSUPPORTEAGAINEALREADYEBADFEBADMSGEBUSYECANCELEDECHILDECONNABORTEDECONNREFUSEDECONNRESETEDEADLKEDESTADDRREQEDOMEDQUOTEEXISTEFAULTEFBIGEHOSTDOWNEHOSTUNREACHEIDRMEILSEQEINPROGRESSEINTREINVALEIOEISCONNEISDIRELOOPEMFILEEMLINKEMSGSIZEENAMETOOLONGENETDOWNENETRESETENETUNREACHENFILEENOBUFSENODATAENODEVENOENTENOEXECENOLCKENOLINKENOMEMENOMSGENOPROTOOPTENOSPCENOSRENOSTRENOSYSENOTBLKENOTCONNENOTDIRENOTEMPTYENOTRECOVERABLEENOTSOCKENOTSUPENOTTYENXIOEOPNOTSUPPEOTHEREOVERFLOWEOWNERDEADEPERMEPFNOSUPPORTEPIPEEPROCLIMEPROTOEPROTONOSUPPORTEPROTOTYPEERANGEEREMOTEERESTARTEROFSESHUTDOWNESOCKTNOSUPPORTESPIPEESRCHESTALEETIMEETIMEDOUTETOOMANYREFSETXTBSYEUSERSEWOULDBLOCKEXDEV
FCNTL
-
Constants
FD_CLOEXECF_DUPFDF_GETFDF_GETFLF_GETLKF_OKF_RDLCKF_SETFDF_SETFLF_SETLKF_SETLKWF_UNLCKF_WRLCKO_ACCMODEO_APPENDO_CREATO_EXCLO_NOCTTYO_NONBLOCKO_RDONLYO_RDWRO_TRUNCO_WRONLY
FLOAT
-
Constants
DBL_DIGDBL_EPSILONDBL_MANT_DIGDBL_MAXDBL_MAX_10_EXPDBL_MAX_EXPDBL_MINDBL_MIN_10_EXPDBL_MIN_EXPFLT_DIGFLT_EPSILONFLT_MANT_DIGFLT_MAXFLT_MAX_10_EXPFLT_MAX_EXPFLT_MINFLT_MIN_10_EXPFLT_MIN_EXPFLT_RADIXFLT_ROUNDSLDBL_DIGLDBL_EPSILONLDBL_MANT_DIGLDBL_MAXLDBL_MAX_10_EXPLDBL_MAX_EXPLDBL_MINLDBL_MIN_10_EXPLDBL_MIN_EXP
LIMITS
-
Constants
ARG_MAXCHAR_BITCHAR_MAXCHAR_MINCHILD_MAXINT_MAXINT_MINLINK_MAXLONG_MAXLONG_MINMAX_CANONMAX_INPUTMB_LEN_MAXNAME_MAXNGROUPS_MAXOPEN_MAXPATH_MAXPIPE_BUFSCHAR_MAXSCHAR_MINSHRT_MAXSHRT_MINSSIZE_MAXSTREAM_MAXTZNAME_MAXUCHAR_MAXUINT_MAXULONG_MAXUSHRT_MAX
LOCALE
-
Constants
LC_ALLLC_COLLATELC_CTYPELC_MONETARYLC_NUMERICLC_TIME
MATH
-
Constants
HUGE_VAL
SIGNAL
-
Constants
SA_NOCLDSTOPSA_NOCLDWAITSA_NODEFERSA_ONSTACKSA_RESETHANDSA_RESTARTSA_SIGINFOSIGABRTSIGALRMSIGCHLDSIGCONTSIGFPESIGHUPSIGILLSIGINTSIGKILLSIGPIPESIGQUITSIGSEGVSIGSTOPSIGTERMSIGTSTPSIGTTINSIGTTOUSIGUSR1SIGUSR2SIG_BLOCKSIG_DFLSIG_ERRSIG_IGNSIG_SETMASKSIG_UNBLOCK
STAT
-
Constants
S_IRGRPS_IROTHS_IRUSRS_IRWXGS_IRWXOS_IRWXUS_ISGIDS_ISUIDS_IWGRPS_IWOTHS_IWUSRS_IXGRPS_IXOTHS_IXUSR -
Macros
S_ISBLKS_ISCHRS_ISDIRS_ISFIFOS_ISREG
STDLIB
-
Constants
EXIT_FAILUREEXIT_SUCCESSMB_CUR_MAXRAND_MAX
STDIO
-
Constants
BUFSIZEOFFILENAME_MAXL_ctermidL_cuseridL_tmpnameTMP_MAX
TIME
-
Constants
CLK_TCKCLOCKS_PER_SEC
UNISTD
-
Constants
R_OKSEEK_CURSEEK_ENDSEEK_SETSTDIN_FILENOSTDOUT_FILENOSTDERR_FILENOW_OKX_OK
WAIT
-
Constants
WNOHANGWUNTRACED-
WNOHANGDo not suspend the calling process until a child process changes state but instead return immediately.
-
WUNTRACEDCatch stopped child processes.
-
-
Macros
WIFEXITEDWEXITSTATUSWIFSIGNALEDWTERMSIGWIFSTOPPEDWSTOPSIG-
WIFEXITEDWIFEXITED(${^CHILD_ERROR_NATIVE})returns true if the child process exited normally (exit()or by falling off the end ofmain()) -
WEXITSTATUSWEXITSTATUS(${^CHILD_ERROR_NATIVE})returns the normal exit status of the child process (only meaningful ifWIFEXITED(${^CHILD_ERROR_NATIVE})is true) -
WIFSIGNALEDWIFSIGNALED(${^CHILD_ERROR_NATIVE})returns true if the child process terminated because of a signal -
WTERMSIGWTERMSIG(${^CHILD_ERROR_NATIVE})returns the signal the child process terminated for (only meaningful ifWIFSIGNALED(${^CHILD_ERROR_NATIVE})is true) -
WIFSTOPPEDWIFSTOPPED(${^CHILD_ERROR_NATIVE})returns true if the child process is currently stopped (can happen only if you specified the WUNTRACED flag towaitpid()) -
WSTOPSIGWSTOPSIG(${^CHILD_ERROR_NATIVE})returns the signal the child process was stopped for (only meaningful ifWIFSTOPPED(${^CHILD_ERROR_NATIVE})is true)
-
© 1993–2016 Larry Wall and others
Licensed under the GNU General Public License version 1 or later, or the Artistic License.
The Perl logo is a trademark of the Perl Foundation.
https://perldoc.perl.org/5.20.2/POSIX.html