_exit
| Identical to the C function _exit(2).
|
abort
| Identical to the C function abort(3).
|
abs
| Identical to Perl's built-in abs function.
|
access
| Determines the accessibility of a file. Returns undef on failure.
if (POSIX::access("/", &POSIX::R_OK ) ){ print "have read permission\n";
}
|
acos
| Identical to the C function acos(3).
|
alarm
| Identical to Perl's built-in alarm function.
|
asctime
| Identical to the C function asctime(3).
|
asin
| Identical to the C function asin(3).
|
assert
| Similar to the C macro assert(3).
|
atan
| Identical to the C function atan(3).
|
atan2
| Identical to Perl's built-in atan2 function.
|
atexit
| C-specific: use END {} instead.
|
atof
| C-specific.
|
atoi
| C-specific.
|
atol
| C-specific.
|
bsearch
| Not supplied. You should probably be using a hash anyway.
|
calloc
| C-specific.
|
ceil
| Identical to the C function ceil(3).
|
chdir
| Identical to Perl's built-in chdir function.
|
chmod
| Identical to Perl's built-in chmod function.
|
chown
| Identical to Perl's built-in chown function.
|
clearerr
| Use method FileHandle::clearerr() instead.
|
clock
| Identical to the C function clock(3).
|
close
| Closes a file. This uses file descriptors such as those obtained by calling POSIX::open(). Returns undef on failure.
$fd = POSIX::open("foo", &POSIX::O_RDONLY); POSIX::close($fd);
|
closedir
| Identical to Perl's built-in closedir function.
|
cos
| Identical to Perl's built-in cos function.
|
cosh
| Identical to the C function cosh(3).
|
creat
| Creates a new file. This returns a file descriptor like the ones returned by POSIX::open(). Use POSIX::close() to close the file.
$fd = POSIX::creat("foo", 0611); POSIX::close($fd);
|
ctermid
| Generates the path name for the controlling terminal.
$path = POSIX::ctermid();
|
ctime
| Identical to the C function ctime(3)
|
cuserid
| Gets the character login name of the user.
$name = POSIX::cuserid();
|
difftime
| Identical to the C function difftime(3).
|
div
| C-specific.
|
dup
| Similar to the C function dup(2). Uses file descriptors such as those obtained by calling POSIX::open(). Returns undef on failure.
|
dup2
| Similar to the C function dup2(2). Uses file descriptors such as those obtained by calling POSIX::open(). Returns undef on failure.
|
errno
| Returns the value of errno.
$errno = POSIX::errno();
|
execl
| C-specific; use Perl's exec instead.
|
execle
| C-specific; use Perl's exec instead.
|
execlp
| C-specific; use Perl's exec instead.
|
execv
| C-specific; use Perl's exec instead.
|
execve
| C-specific; use Perl's exec instead.
|
execvp
| C-specific; use Perl's exec instead.
|
exit
| Identical to Perl's built-in exit function.
|
exp
| Identical to Perl's built-in exp function.
|
fabs
| Identical to Perl's built-in abs function.
|
fclose
| Use method FileHandle::close() instead.
|
fcntl
| Identical to Perl's built-in fcntl function.
|
fdopen
| Use method FileHandle::new_from_fd() instead.
|
feof
| Use method FileHandle::eof() instead.
|
ferror
| Use method FileHandle::error() instead.
|
fflush
| Use method FileHandle::flush() instead.
|
fgetc
| Use method FileHandle::getc() instead.
|
fgetpos
| Use method FileHandle::getpos() instead.
|
fgets
| Use method FileHandle::gets() instead.
|
fileno
| Use method FileHandle::fileno() instead.
|
floor
| Identical to the C function floor(3).
|
fmod
| Identical to the C function fmod(3).
|
fopen
| Use method FileHandle::open() instead.
|
fork
| Identical to Perl's built-in fork function.
|
fpathconf
| Retrieves the value of a configurable limit on a file or directory. This uses file descriptors such as those obtained by calling POSIX::open(). Returns undef on failure. The following will determine the maximum length of the longest allowable pathname on the filesystem that holds /tmp/foo.
$fd = POSIX::open("/tmp/foo", &POSIX::O_RDONLY); $path_max = POSIX::fpathconf($fd, &POSIX::_PC_PATH_MAX);
|
fprintf
| C-specific; use Perl's built-in printf function instead.
|
fputc
| C-specific; use Perl's built-in print function instead.
|
fputs
| C-specific; use Perl's built-in print function instead.
|
fread
| C-specific; use Perl's built-in read function instead.
|
free
| C-specific
|
freopen
| C-specific; use Perl's built-in open function instead.
|
frexp
| Returns the mantissa and exponent of a floating-point number.
($mantissa, $exponent) = POSIX::frexp(3.14);
|
fscanf
| C-specific; use <> and regular expressions instead.
|
fseek
| Use method FileHandle::seek() instead.
|
fsetpos
| Use method FileHandle::setpos() instead.
|
fstat
| Gets 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 built-in stat function. Odd how that happens...
$fd = POSIX::open("foo", &POSIX::O_RDONLY); @stats = POSIX::fstat($fd);
|
ftell
| Use method FileHandle::tell() instead.
|
fwrite
| C-specific; use Perl's built-in print function instead.
|
getc
| Identical to Perl's built-in getc function.
|
getchar
| Returns one character from STDIN.
|
getcwd
| Returns the name of the current working directory.
|
getegid
| Returns the effective group ID (gid).
|
getenv
| Returns the value of the specified environment variable.
|
geteuid
| Returns the effective user ID (uid).
|
getgid
| Returns the user's real group ID (gid).
|
getgrgid
| Identical to Perl's built-in getgrgid function.
|
getgrnam
| Identical to Perl's built-in getgrnam function.
|
getgroups
| Returns the ids of the user's supplementary groups.
|
getlogin
| Identical to Perl's built-in getlogin function.
|
getpgrp
| Identical to Perl's built-in getpgrp function.
|
getpid
| Returns the process's ID (pid).
|
getppid
| Identical to Perl's built-in getppid function.
|
getpwnam
| Identical to Perl's built-in getpwnam function.
|
getpwuid
| Identical to Perl's built-in getpwuid function.
|
gets
| Returns one line from STDIN.
|
getuid
| Returns the user's ID (uid).
|
gmtime
| Identical to Perl's built-in gmtime function.
|
isalnum
| Identical to the C function, except that it can apply to a single character or to a whole string. (If applied to a whole string, all characters must be of the indicated category.)
|
isalpha
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isatty
| Returns a Boolean indicating whether the specified filehandle is connected to a TTY.
|
iscntrl
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isdigit
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isgraph
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
islower
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isprint
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
ispunct
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isspace
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isupper
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
isxdigit
| Identical to the C function, except that it can apply to a single character or to a whole string.
|
kill
| Identical to Perl's built-in kill function.
|
labs
| C-specific; use Perl's built-in abs function instead.
|
ldexp
| Identical to the C function ldexp(3).
|
ldiv
| C-specific; use the division operator / and Perl's built-in int function instead.
|
link
| Identical to Perl's built-in link function.
|
localeconv
| Gets numeric formatting information. Returns a reference to a hash containing the current locale formatting values. The database for the de (Deutsch or German) locale:
|
$loc = POSIX::setlocale(&POSIX::LC_ALL, "de");
print "Locale = $loc\n"; $lconv = POSIX::localeconv();
print "decimal_point = ", $lconv->{decimal_point}, "\n";
print "thousands_sep = ", $lconv->{thousands_sep}, "\n";
print "grouping = ", $lconv->{grouping}, "\n";
print "int_curr_symbol = ", $lconv->{int_curr_symbol}, "\n";
print "currency_symbol = ", $lconv->{currency_symbol}, "\n";
print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
print "mon_grouping = ", $lconv->{mon_grouping}, "\n";
print "positive_sign = ", $lconv->{positive_sign}, "\n";
print "negative_sign = ", $lconv->{negative_sign}, "\n";
|
print "int_frac_digits = ", $lconv->{int_frac_digits}, "\n";
print "frac_digits = ", $lconv->{frac_digits}, "\n";
print "p_cs_precedes = ", $lconv->{p_cs_precedes}, "\n";
print "p_sep_by_space = ", $lconv->{p_sep_by_space}, "\n";
print "n_cs_precedes = ", $lconv->{n_cs_precedes}, "\n";
print "n_sep_by_space = ", $lconv->{n_sep_by_space}, "\n";
print "p_sign_posn = ", $lconv->{p_sign_posn}, "\n";
print "n_sign_posn = ", $lconv->{n_sign_posn}, "\n";
|
localtime
| Identical to Perl's built-in localtime function.
|
log
| Identical to Perl's built-in log function.
|
log10
| Identical to the C function log10(3).
|
longjmp
| C-specific; use Perl's built-in die function instead.
|
lseek
| Moves the read/write file pointer. 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 undef on failure.
|
malloc
| C-specific.
|
mblen
| Identical to the C function mblen(3).
|
mbstowcs
| Identical to the C function mbstowcs(3).
|
mbtowc
| Identical to the C function mbtowc(3).
|
memchr
| C-specific; use Perl's built-in index instead.
|
memcmp
| C-specific; use eq instead.
|
memcpy
| C-specific; use = instead.
|
memmove
| C-specific; use = instead.
|
memset
| C-specific; use x instead.
|
mkdir
| Identical to Perl's built-in mkdir function.
|
mkfifo
| Similar to the C function mkfifo(2). Returns undef on failure.
|
mktime
| Converts date/time information to a calendar time. Returns undef on failure. Synopsis:
|
mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
|
The month (mon), weekday (wday), and yearday (yday) begin at zero. That is, 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. That is, the year 1995 is 95; the year 2014 is 101. Consult your system's mktime(3) 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);
|
modf
| Returns the integral and fractional parts of a floating-point number.
($fractional, $integral) = POSIX::modf(3.14);
|
nice
| Similar to the C function nice(3). Returns undef on failure.
|
offsetof
| C-specific.
|
open
| Opens a file for reading or writing. This returns file descriptors, not Perl filehandles. Returns undef on failure. Use POSIX::close() to close the file. Open a file read-only:
$fd = POSIX::open("foo");
Open a file for reading and writing:
$fd = POSIX::open("foo", &POSIX::O_RDWR);
Open a file for writing, with truncation:
$fd = POSIX::open("foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC);
Create a new file with mode 0644; set up the file for writing:
$fd = POSIX::open("foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0644);
|
opendir
| Opens a directory for reading. Returns undef on failure.
$dir = POSIX::opendir("/tmp"); @files = POSIX::readdir($dir); POSIX::closedir($dir);
|
pathconf
| Retrieves the value of a configurable limit on a file or directory. Returns undef on failure. The following will determine the maximum length of the longest allowable pathname on the filesystem that holds /tmp:
$path_max = POSIX::pathconf("/tmp", &POSIX::_PC_PATH_MAX);
|
pause
| Similar to the C function pause(3). Returns undef on failure.
|
perror
| Identical to the C function perror(3).
|
pipe
| Creates an interprocess channel. Returns file descriptors like those returned by POSIX::open().
($fd0, $fd1) = POSIX::pipe(); POSIX::write($fd0, "hello", 5); POSIX::read($fd1, $buf, 5);
|
pow
| Computes $x raised to the power $exponent.
$ret = POSIX::pow($x, $exponent);
|
printf
| Prints the specified arguments to STDOUT.
|
putc
| C-specific; use Perl's built-in print function instead.
|
putchar
| C-specific; use Perl's built-in print function instead.
|
puts
| C-specific; use Perl's built-in print function instead.
|
qsort
| C-specific; use Perl's built-in sort function instead.
|
raise
| Sends the specified signal to the current process.
|
rand
| Non-portable; use Perl's built-in rand function instead.
|
read
| Reads from a file. This uses file descriptors such as those obtained by calling POSIX::open(). If the buffer $buf is not large enough for the read, then Perl will extend it to make room for the request. Returns undef on failure.
$fd = POSIX::open("foo", &POSIX::O_RDONLY); $bytes = POSIX::read($fd, $buf, 3);
|
readdir
| Identical to Perl's built-in readdir function.
|
realloc
| C-specific.
|
remove
| Identical to Perl's built-in unlink function.
|
rename
| Identical to Perl's built-in rename function.
|
rewind
| Seeks to the beginning of the file.
|
rewinddir
| Identical to Perl's built-in rewinddir function.
|
rmdir
| Identical to Perl's built-in rmdir function.
|
scanf
| C-specific; use <> and regular expressions instead.
|
setgid
| Sets the real group id for this process, like assigning to the special variable $(.
|
setjmp
| C-specific; use eval {} instead.
|
setlocale
| Modifies and queries program's locale. The following will set the traditional UNIX system locale behavior.
$loc = POSIX::setlocale(&POSIX::LC_ALL, "C");
|
setpgid
| Similar to the C function setpgid(2). Returns undef on failure.
|
setsid
| Identical to the C function setsid(8).
|
setuid
| Sets the real user ID for this process, like assigning to the special variable $<.
|
sigaction
| Detailed signal management. This uses POSIX::SigAction objects for the $action and $oldaction arguments. Consult your system's sigaction(3) manpage for details. Returns undef on failure.
POSIX::sigaction($sig, $action, $oldaction)
|
siglongjmp
| C-specific; use Perl's built-in die function instead.
|
sigpending
| Examine signals that are blocked and pending. This uses POSIX::SigSet objects for the $sigset argument. Consult your system's sigpending(2) manpage for details. Returns undef on failure.
POSIX::sigpending($sigset)
|
sigprocmask
| Changes and/or examines this process's signal mask. This uses POSIX::SigSet objects for the $sigset and $oldsigset arguments. Consult your system's sigprocmask(2) manpage for details. Returns undef on failure.
POSIX::sigprocmask($how, $sigset, $oldsigset)
|
sigsetjmp
| C-specific; use eval {} instead.
|
sigsuspend
| Install a signal mask and suspend process until signal arrives. This uses POSIX::SigSet objects for the $signal_mask argument. Consult your system's sigsuspend(2) manpage for details. Returns undef on failure.
POSIX::sigsuspend($signal_mask)
|
sin
| Identical to Perl's built-in sin function.
|
sinh
| Identical to the C function sinh(3).
|
sleep
| Identical to Perl's built-in sleep function.
|
sprintf
| Identical to Perl's built-in sprintf function.
|
sqrt
| Identical to Perl's built-in sqrt function.
|
srand
| Identical to Perl's built-in srand function.
|
sscanf
| C-specific; use regular expressions instead.
|
stat
| Identical to Perl's built-in stat function.
|
strcat
| C-specific; use = instead.
|
strchr
| C-specific; use index instead.
|
strcmp
| C-specific; use eq instead.
|
strcoll
| Identical to the C function strcoll(3).
|
strcpy
| C-specific; use = instead.
|
strcspn
| C-specific; use regular expressions instead.
|
strerror
| Returns the error string for the specified errno.
|
strftime
| Converts date and time information to string. Returns the string.
strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
The month (mon), weekday (wday), and yearday (yday) begin at zero. That is, 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. That is, the year 1995 is 95; the year 2014 is 101. Consult your system's strftime(3) manpage for details about these and the other arguments. 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
| C-specific; use length instead.
|
strncat
| C-specific; use = and/or substr instead.
|
strncmp
| C-specific; use eq and/or substr instead.
|
strncpy
| C-specific; use = and/or substr instead.
|
strpbrk
| C-specific.
|
strrchr
| C-specific; use rindex and/or substr instead.
|
strspn
| C-specific.
|
strstr
| Identical to Perl's built-in index function.
|
strtod
| C-specific.
|
strtok
| C-specific.
|
strtol
| C-specific.
|
strtoul
| C-specific.
|
strxfrm
| String transformation. Returns the transformed string.
$dst = POSIX::strxfrm($src);
|
sysconf
| Retrieves values of system configurable variables. Returns undef on failure. The following will get the machine's clock speed.
$clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK);
|
system
| Identical to Perl's built-in system function.
|
tan
| Identical to the C function tan(3).
|
tanh
| Identical to the C function tanh(3).
|
tcdrain
| Similar to the C function tcdrain(3). Returns undef on failure.
|
tcflow
| Similar to the C function tcflow(3). Returns undef on failure.
|
tcflush
| Similar to the C function tcflush(3). Returns undef on failure.
|
tcgetpgrp
| Identical to the C function tcgetpgrp(3).
|
tcsendbreak
| Similar to the C function tcsendbreak(3). Returns undef on failure.
|
tcsetpgrp
| Similar to the C function tcsetpgrp(3). Returns undef on failure.
|
time
| Identical to Perl's built-in time function.
|
times
| 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 for child processes. All times are returned in clock ticks.
($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
Note: Perl's built-in times function returns four values, measured in seconds.
|
tmpfile
| Use method FileHandle::new_tmpfile() instead.
|
tmpnam
| Returns a name for a temporary file.
$tmpfile = POSIX::tmpnam();
|
tolower
| Identical to Perl's built-in lc function.
|
toupper
| Identical to Perl's built-in uc function.
|
ttyname
| Identical to the C function ttyname(3).
|
tzname
| Retrieves the time conversion information from the tzname variable.
POSIX::tzset(); ($std, $dst) = POSIX::tzname();
|
tzset
| Identical to the C function tzset(3).
|
umask
| Identical to Perl's built-in umask function.
|
uname
| Gets name of current operating system.
($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
|
ungetc
| Use method FileHandle::ungetc() instead.
|
unlink
| Identical to Perl's built-in unlink function.
|
utime
| Identical to Perl's built-in utime function.
|
vfprintf
| C-specific.
|
vprintf
| C-specific.
|
vsprintf
| C-specific.
|
wait
| Identical to Perl's built-in wait function.
|
waitpid
| Wait for a child process to change state. This is identical to Perl's built-in waitpid function.
$pid = POSIX::waitpid(-1, &POSIX::WNOHANG);
print "status = ", ($? / 256), "\n";
|
wcstombs
| Identical to the C function wcstombs(3).
|
wctomb
| Identical to the C function wctomb(3).
|
write
| Writes to a file. Uses file descriptors such as those obtained by calling POSIX::open(). Returns undef on failure.
$fd = POSIX::open("foo", &POSIX::O_WRONLY); $buf = "hello"; $bytes = POSIX::write($b, $buf, 5);
|