.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "POSIX::2008 3pm" .TH POSIX::2008 3pm "2018-11-01" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" POSIX::2008 \- Perl interface to POSIX.1\-2008 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Fcntl; \& use POSIX::2008 qw(openat pwrite); \& \& sysopen my $dh, \*(Aq/tmp\*(Aq, O_RDONLY|O_DIRECTORY|O_NOFOLLOW or die \*(AqDafuq?\*(Aq; \& my $fh = openat($dh, \*(Aqfoobar\*(Aq, O_RDWR|O_CREAT); \& pwrite($fh, \*(Aqfuckyounsa\*(Aq, 10, 0); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1POSIX::2008\s0 contains many of the interfaces specified by \&\s-1POSIX.1\-2008\s0 that the core \&\s-1POSIX\s0 module withholds, implements in Perl or fucked up. .PP This module is provided \*(L"as is\*(R" unless someone volunteers to maintain it. .SH "INCOMPATIBLE PARAMETER CHANGE" .IX Header "INCOMPATIBLE PARAMETER CHANGE" Since version 0.13, the parameter order of pread/pwrite is (count, offset) as with the actual system calls instead of (offset, count). Good luck. .SH "FILE DESCRIPTORS AND HANDLES" .IX Header "FILE DESCRIPTORS AND HANDLES" Since version 0.05, all I/O functions that take numeric file descriptors also accept Perl file or directory handles. \f(CW\*(C`openat()\*(C'\fR even returns a handle if you passed it one. .SH "SYSTEM CALL RETURN VALUES" .IX Header "SYSTEM CALL RETURN VALUES" A system call return value of \-1 meaning \*(L"error\*(R" is mapped to undef. .PP A system call return value of 0 meaning \*(L"success\*(R" is mapped to \*(L"0 but true\*(R". .PP For system calls where 0 does not just mean \*(L"success\*(R", 0 is returned unchanged. These are \f(CW\*(C`open()\*(C'\fR, \f(CW\*(C`read()\*(C'\fR, \f(CW\*(C`write()\*(C'\fR, \f(CW\*(C`readv()\*(C'\fR, \&\f(CW\*(C`writev()\*(C'\fR, \f(CW\*(C`pread()\*(C'\fR, \f(CW\*(C`pwrite()\*(C'\fR, \f(CW\*(C`preadv()\*(C'\fR, \f(CW\*(C`pwritev()\*(C'\fR. \f(CW\*(C`openat()\*(C'\fR gets a special treatment in this module, see below. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .IP "a64l" 4 .IX Item "a64l" l = a64l(s); .IP "abort" 4 .IX Item "abort" \&\fBabort()\fR; .IP "abs" 4 .IX Item "abs" ui = abs(i); .IP "access" 4 .IX Item "access" ret = access(path, mode); .IP "acos" 4 .IX Item "acos" y = acos(x); .IP "acosh" 4 .IX Item "acosh" y = acosh(x); .IP "alarm" 4 .IX Item "alarm" remaining_sec = alarm(sec); .IP "asin" 4 .IX Item "asin" y = asin(x); .IP "asinh" 4 .IX Item "asinh" y = asinh(x); .IP "atan2" 4 .IX Item "atan2" z = atan2(y, x); .IP "atan" 4 .IX Item "atan" y = atan(x); .IP "atanh" 4 .IX Item "atanh" y = atanh(x); .IP "atof" 4 .IX Item "atof" f = atof(s); .IP "atoi" 4 .IX Item "atoi" i = atoi(s); .IP "atol" 4 .IX Item "atol" l = atol(s); .IP "basename" 4 .IX Item "basename" s = basename(path); .IP "cabs" 4 .IX Item "cabs" r = cabs(re, im); .IP "cacos" 4 .IX Item "cacos" (re, im) = cacos(re, im); .IP "cacosh" 4 .IX Item "cacosh" (re, im) = cacosh(re, im); .IP "carg" 4 .IX Item "carg" phi = carg(re, im); .IP "casinh" 4 .IX Item "casinh" (re, im) = casinh(re, im); .IP "catan" 4 .IX Item "catan" (re, im) = catan(re, im); .IP "catanh" 4 .IX Item "catanh" (re, im) = catanh(re, im); .IP "catclose" 4 .IX Item "catclose" ret = catclose(catd); .IP "catgets" 4 .IX Item "catgets" s = catgets(catd, set_id, msg_id, dflt_string); .IP "catopen" 4 .IX Item "catopen" catd = catopen(name, oflag); .IP "cbrt" 4 .IX Item "cbrt" y = cbrt(x); .IP "ccos" 4 .IX Item "ccos" (re, im) = ccos(re, im); .IP "ccosh" 4 .IX Item "ccosh" (re, im) = ccosh(re, im); .IP "ceil" 4 .IX Item "ceil" y = ceil(x); .IP "cexp" 4 .IX Item "cexp" (re, im) = cexp(re, im); .IP "chdir" 4 .IX Item "chdir" ret = chdir(path); .IP "chmod" 4 .IX Item "chmod" ret = chmod(path, mode); .IP "chown" 4 .IX Item "chown" ret = chown(path, uid, gid); .IP "cimag" 4 .IX Item "cimag" im = cimag(re, im); .IP "clock" 4 .IX Item "clock" t = \fBclock()\fR .IP "clock_getcpuclockid" 4 .IX Item "clock_getcpuclockid" clock_id = clock_getcpuclockid(pid); .Sp pid defaults to $$. Returns undef on error. .IP "clock_getres" 4 .IX Item "clock_getres" (sec, nsec) = clock_getres(clock_id); .Sp clock_id defaults to \s-1CLOCK_REALTIME.\s0 Returns empty list on error. .IP "clock_gettime" 4 .IX Item "clock_gettime" (sec, nsec) = clock_gettime(clock_id); .Sp clock_id defaults to \s-1CLOCK_REALTIME.\s0 Returns empty list on error. .IP "clock_nanosleep" 4 .IX Item "clock_nanosleep" (rem_sec, rem_nsec) = clock_nanosleep(clock_id, flags, sec, nsec); .Sp In scalar context returns the remaining seconds as a floating point number. .IP "clock_settime" 4 .IX Item "clock_settime" ret = clock_settime(clock_id, sec, nsec); .IP "clog" 4 .IX Item "clog" (re, im) = clog(re, im); .IP "close" 4 .IX Item "close" ret = close(fd); .IP "confstr" 4 .IX Item "confstr" s = confstr(name); .Sp \&\fIname\fR is one of the _CS_ integer constants. .IP "conj" 4 .IX Item "conj" (re, im) = conj(re, im); .IP "copysign" 4 .IX Item "copysign" xs = copysign(x, y); .IP "cos" 4 .IX Item "cos" y = cos(x); .IP "cosh" 4 .IX Item "cosh" y = cosh(x); .IP "cpow" 4 .IX Item "cpow" (re, im) = cpow(re_x, im_x, re_y, im_y); .IP "cproj" 4 .IX Item "cproj" (re, im) = cproj(re, im); .IP "creal" 4 .IX Item "creal" re = creal(re, im); .IP "csin" 4 .IX Item "csin" (re, im) = csin(re, im); .IP "csinh" 4 .IX Item "csinh" (re, im) = csinh(re, im); .IP "csqrt" 4 .IX Item "csqrt" (re, im) = csqrt(re, im); .IP "ctan" 4 .IX Item "ctan" (re, im) = ctan(re, im); .IP "ctanh" 4 .IX Item "ctanh" (re, im) = ctanh(re, im); .IP "dirname" 4 .IX Item "dirname" name = dirname(path); .IP "div" 4 .IX Item "div" (quot, rem) = div(numer, denom); .IP "dlclose" 4 .IX Item "dlclose" dlclose(dlhandle); .IP "dlerror" 4 .IX Item "dlerror" \&\fBdlerror()\fR; .IP "dlopen" 4 .IX Item "dlopen" dlhandle = dlopen(file, mode); .IP "dlsym" 4 .IX Item "dlsym" addr = dlsym(dlhandle, name); .IP "drand48" 4 .IX Item "drand48" r = \fBdrand48()\fR; .IP "endutxent" 4 .IX Item "endutxent" \&\fBendutxent()\fR; .IP "erand48" 4 .IX Item "erand48" (r, X0, X1, X2) = erand48(X0, X1, X2); .IP "erf" 4 .IX Item "erf" y = erf(x); .IP "erfc" 4 .IX Item "erfc" y = erfc(x); .IP "exp2" 4 .IX Item "exp2" y = exp2(x); .IP "expm1" 4 .IX Item "expm1" y = expm1(x); .IP "faccessat" 4 .IX Item "faccessat" ret = faccessat(dirfd, path, amode, flags=0); .Sp \&\fIflags\fR is the bitwise \s-1OR\s0 of zero or more of \s-1AT_EACCESS, AT_SYMLINK_NOFOLLOW.\s0 .IP "fchdir" 4 .IX Item "fchdir" ret = fchdir(dirfd); .IP "fchmod" 4 .IX Item "fchmod" ret = fchmod(fd, mode); .IP "fchmodat" 4 .IX Item "fchmodat" ret = fchmodat(dirfd, path, mode, flags=0); .Sp \&\fIflags\fR can be 0 or \s-1AT_SYMLINK_NOFOLLOW.\s0 .IP "fchown" 4 .IX Item "fchown" ret = fchown(fd, uid, gid); .IP "fchownat" 4 .IX Item "fchownat" ret = fchownat(dirfd, path, uid, gid, flags=0); .Sp \&\fIflags\fR can be 0 or \s-1AT_SYMLINK_NOFOLLOW.\s0 .IP "fdatasync" 4 .IX Item "fdatasync" ret = fdatasync(fd); .IP "fdopen" 4 .IX Item "fdopen" ret = fdopen(fd, mode) .Sp Returns a file handle associated with the file descriptor \fIfd\fR or undef on error. \fImode\fR is one of the values \f(CW"r"\fR, \f(CW"w"\fR, \f(CW"a"\fR with an optional \&\f(CW"+"\fR and/or \f(CW"b"\fR. .Sp It's similar to \f(CW\*(C`IO::Handle::new_from_fd()\*(C'\fR with the following improvements: .RS 4 .IP "\(bu" 4 It \fIreally\fR calls \f(CWfdopen(3)\fR. .IP "\(bu" 4 It expects \s-1POSIX\s0 mode strings (e.g. \f(CW"r"\fR, not \f(CW"<"\fR). .IP "\(bu" 4 It fails \fImode\fR is not compatible with the flags of \fIfd\fR. .RE .RS 4 .RE .IP "fdopendir" 4 .IX Item "fdopendir" ret = fdopendir(fd) .Sp Returns a directory handle associated with the file descriptor \fIfd\fR or undef on error. Usage example: .Sp .Vb 7 \& my $dh = do { \& sysopen my $fh, \*(Aq/tmp\*(Aq, O_RDONLY|O_DIRECTORY|O_NOFOLLOW; \& fdopendir($fh); # or fdopendir(fileno $fh) but the former also works \& # with handles from opendir() for which fileno does \& # not work before Perl 5.22 \& }; \& my @files = readdir $dh; # this would fail with $fh from sysopen .Ve .IP "fdim" 4 .IX Item "fdim" d = fdim(double x, double y); .IP "fegetround" 4 .IX Item "fegetround" round = \fBfegetround()\fR; .IP "fesetround" 4 .IX Item "fesetround" ret = fesetround(round); .IP "ffs" 4 .IX Item "ffs" pos = ffs(i); .IP "floor" 4 .IX Item "floor" y = floor(x); .IP "fma" 4 .IX Item "fma" r = fma(x, y, z); .IP "fmax" 4 .IX Item "fmax" m = fmax(x, y); .IP "fmin" 4 .IX Item "fmin" m = fmin(x, y); .IP "fmod" 4 .IX Item "fmod" m = fmod(x, y); .IP "fnmatch" 4 .IX Item "fnmatch" ret = fnmatch(pattern, string, flags); .Sp Returns 0 if \fIstring\fR matches \fIpattern\fR, \s-1FNM_NOMATCH\s0 if there is no match, undef if there is an error. .Sp \&\fIflags\fR is the bitwise \s-1OR\s0 of zero or more of \s-1FNM_NOESCAPE, FNM_PATHNAME, FNM_PERIOD, FNM_FILE_NAME, FNM_LEADING_DIR, FNM_CASEFOLD.\s0 .IP "fpclassify" 4 .IX Item "fpclassify" fpclassify(x); .Sp Returns one of \s-1FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL.\s0 .IP "fstatat" 4 .IX Item "fstatat" (dev, ino, mode, nlink, uid, gid, rdev, size, atim_sec, mtim_sec, ctim_sec, blksize, blocks, atim_nsec, mtim_nsec, ctim_nsec) = fstatat(dirfd, path, flags = 0); .Sp \&\fIflags\fR is the bitwise \s-1OR\s0 of zero or more of \s-1AT_SYMLINK_NOFOLLOW, AT_NO_AUTOMOUNT.\s0 .IP "fsync" 4 .IX Item "fsync" ret = fsync(fd); .IP "ftruncate" 4 .IX Item "ftruncate" ret = ftruncate(fd, length); .IP "futimens" 4 .IX Item "futimens" ret = futimens(fd, atime_sec, atime_nsec, mtime_sec, mtime_nsec); .Sp atime_sec and mtime_sec default to 0, atime_nsec and mtime_nsec default to \&\s-1UTIME_NOW.\s0 .IP "getdate" 4 .IX Item "getdate" (sec, min, hour, mday, mon, year, wday, yday, isdst) = getdate(string); .IP "getdate_err" 4 .IX Item "getdate_err" \&\fBgetdate_err()\fR returns the value of the getdate_err variable. .IP "getegid" 4 .IX Item "getegid" egid = \fBgetegid()\fR; .IP "geteuid" 4 .IX Item "geteuid" euid = \fBgeteuid()\fR; .IP "getgid" 4 .IX Item "getgid" gid = \fBgetgid()\fR; .IP "gethostid" 4 .IX Item "gethostid" hostid = \fBgethostid()\fR; .IP "gethostname" 4 .IX Item "gethostname" hostname = \fBgethostname()\fR; .IP "getitimer" 4 .IX Item "getitimer" (int_sec, int_usec, val_sec, val_usec) = getitimer(which); .Sp \&\fIwhich\fR is one of \s-1ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF.\s0 .IP "getpriority" 4 .IX Item "getpriority" prio = getpriority(which, who); .Sp \&\fIwhich\fR can be one of \s-1PRIO_PROCESS, PRIO_PGRP, PRIO_USER,\s0 defaults to \&\s-1PRIO_PROCESS.\s0 .Sp \&\fIwho\fR defaults to 0. .Sp Returns undef on error. .IP "getsid" 4 .IX Item "getsid" sid = getsid(pid); .Sp \&\fIpid\fR defaults to 0. .IP "getuid" 4 .IX Item "getuid" uid = \fBgetuid()\fR; .IP "getutxent" 4 .IX Item "getutxent" (user, id, line, pid, type, sec, usec) = \fBgetutxent()\fR; .Sp \&\fBgetutxent()\fR reads a line from the current file position in the utmp file. .IP "getutxid" 4 .IX Item "getutxid" (user, id, line, pid, type, sec, usec) = getutxid(ut_type, ut_id); .Sp \&\fBgetutxid()\fR searches forward from the current file position in the utmp file based upon \fIut_type\fR and \fIut_id\fR. If \fIut_type\fR is one of \s-1RUN_LVL, BOOT_TIME, NEW_TIME,\s0 or \s-1OLD_TIME,\s0 \fBgetutxid()\fR will find the first entry whose \&\fIut_type\fR field matches \fIut_type\fR. If \fIut_type\fR is one of \s-1INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS,\s0 or \s-1DEAD_PROCESS,\s0 \fBgetutxid()\fR will find the first entry whose \fIut_id\fR field matches \fIut_id\fR. .IP "getutxline" 4 .IX Item "getutxline" (user, id, line, pid, type, sec, usec) = getutxline(ut_line); .Sp \&\fBgetutxline()\fR searches forward from the current file position in the utmp file. It scans entries whose \fIut_type\fR is \s-1USER_PROCESS\s0 or \s-1LOGIN_PROCESS\s0 and returns the first one whose \fIut_line\fR field matches \fIut_line\fR. .IP "hypot" 4 .IX Item "hypot" r = hypot(x, y); .IP "ilogb" 4 .IX Item "ilogb" y = ilogb(x); .IP "isalpha" 4 .IX Item "isalpha" Like \fBPOSIX::isalpha()\fR but returns 0 for the empty string. .IP "isatty" 4 .IX Item "isatty" ret = isatty(fd) .IP "isblank" 4 .IX Item "isblank" ret = isblank(charstring) .Sp Returns 1 if \fIcharstring\fR consists only of blank characters (i.e. spaces and/or tabs). Returns 0 otherwise (also for the empty string). .IP "iscntrl" 4 .IX Item "iscntrl" Like \fBPOSIX::iscntrl()\fR but returns 0 for the empty string. .IP "isdigit" 4 .IX Item "isdigit" Like \fBPOSIX::isdigit()\fR but returns 0 for the empty string. .IP "isfinite" 4 .IX Item "isfinite" isfinite(x); .IP "isgraph" 4 .IX Item "isgraph" Like \fBPOSIX::isgraph()\fR but returns 0 for the empty string. .IP "isinf" 4 .IX Item "isinf" isinf(x); .IP "islower" 4 .IX Item "islower" Like \fBPOSIX::islower()\fR but returns 0 for the empty string. .IP "isnan" 4 .IX Item "isnan" isnan(x); .IP "isnormal" 4 .IX Item "isnormal" isnormal(x); .IP "isprint" 4 .IX Item "isprint" Like \fBPOSIX::isprint()\fR but returns 0 for the empty string. .IP "ispunct" 4 .IX Item "ispunct" Like \fBPOSIX::ispunct()\fR but returns 0 for the empty string. .IP "isspace" 4 .IX Item "isspace" Like \fBPOSIX::isspace()\fR but returns 0 for the empty string. .IP "isupper" 4 .IX Item "isupper" Like \fBPOSIX::isupper()\fR but returns 0 for the empty string. .IP "isxdigit" 4 .IX Item "isxdigit" Like \fBPOSIX::isxdigit()\fR but returns 0 for the empty string. .IP "j0" 4 .IX Item "j0" y = j0(x); .Sp \&\fBj0()\fR is the Bessel function of the first kind of order 0. .IP "j1" 4 .IX Item "j1" y = j1(x); .Sp \&\fBj1()\fR is the Bessel function of the first kind of order 1. .IP "jn" 4 .IX Item "jn" y = jn(n, x); .Sp \&\fBjn()\fR is the Bessel function of the first kind of order \fIn\fR. .IP "jrand48" 4 .IX Item "jrand48" (r, X0, X1, X2) = jrand48(X0, X1, X2); .IP "killpg" 4 .IX Item "killpg" ret = killpg(pgrp, sig); .IP "l64a" 4 .IX Item "l64a" s = l64a(n); .IP "lchown" 4 .IX Item "lchown" ret = lchown(path, uid, gid) .IP "ldexp" 4 .IX Item "ldexp" y = ldexp(x, exp); .IP "ldiv" 4 .IX Item "ldiv" (quot, rem) = ldiv(numer, denom); .IP "lgamma" 4 .IX Item "lgamma" y = lgamma(x); .IP "link" 4 .IX Item "link" ret = link(path1, path2); .IP "linkat" 4 .IX Item "linkat" ret = linkat(fd1, path1, fd2, path2, flags=0); .Sp \&\fIflags\fR can be 0 or \s-1AT_SYMLINK_FOLLOW.\s0 .IP "log1p" 4 .IX Item "log1p" y = log1p(x); .IP "log2" 4 .IX Item "log2" y = log2(x); .IP "logb" 4 .IX Item "logb" y = logb(x); .IP "lrand48" 4 .IX Item "lrand48" r = \fBlrand48()\fR; .IP "lround" 4 .IX Item "lround" l = lround(x) .IP "lstat" 4 .IX Item "lstat" ret = lstat(path); .IP "mkdir" 4 .IX Item "mkdir" ret = mkdir(path, mode); .IP "mkdirat" 4 .IX Item "mkdirat" ret = mkdirat(fd, path, mode); .IP "mkdtemp" 4 .IX Item "mkdtemp" name = mkdtemp(template); .IP "mkfifo" 4 .IX Item "mkfifo" ret = mkfifo(path, mode); .IP "mkfifoat" 4 .IX Item "mkfifoat" ret = mkfifoat(fd, path, mode); .IP "mknod" 4 .IX Item "mknod" ret = mknod(path, mode, dev); .IP "mknodat" 4 .IX Item "mknodat" ret = mknodat(fd, path, mode, dev); .IP "mkstemp" 4 .IX Item "mkstemp" (fd, name) = mkstemp(template); .IP "mrand48" 4 .IX Item "mrand48" \&\fBmrand48()\fR; .IP "nanosleep" 4 .IX Item "nanosleep" (rem_sec, rem_nsec) = nanosleep(sec, nsec); .Sp In scalar context returns the remaining seconds as a floating point number. .IP "nearbyint" 4 .IX Item "nearbyint" y = nearbyint(x); .IP "nextafter" 4 .IX Item "nextafter" z = nextafter(x, y); .IP "nrand48" 4 .IX Item "nrand48" r = \fBnrand48()\fR .IP "open" 4 .IX Item "open" ret = open(path, oflag[, mode]); .Sp \&\fIoflag\fR defaults to O_RDONLY, \fImode\fR defaults to 0600. .IP "openat" 4 .IX Item "openat" ret = openat(fd, path, oflag[, mode]); .Sp \&\fIoflag\fR defaults to O_RDONLY, \fImode\fR defaults to 0600. .Sp If \fIfd\fR is numeric (i.e. a file descriptor), \f(CW\*(C`openat()\*(C'\fR returns a file descriptor. If \fIfd\fR is a file or directory handle the return value is also a handle whose type depends on the file type of \fIpath\fR: If path is a directory, the return value is a directory handle, otherwise it's a file handle. .Sp Returns undef on error. .IP "posix_fadvise" 4 .IX Item "posix_fadvise" ret = posix_fadvise(fd, offset, len, advice); .Sp \&\fIadvice\fR is one of the \f(CW\*(C`POSIX_FADV_\*(C'\fR constants. .Sp Returns undef on error .IP "posix_fallocate" 4 .IX Item "posix_fallocate" ret = posix_fallocate(fd, offset, len); .IP "pread" 4 .IX Item "pread" bytes_read = pread(fd, buf, count, [offset, buf_offset]); .Sp \&\f(CW\*(C`pread()\*(C'\fR reads \fIcount\fR bytes (not characters) of data from the file descriptor \fIfd\fR at file offset \fIoffset\fR into the scalar \fIbuf\fR without changing the file offset. \fIbuf\fR will be enlarged automatically if necessary. .Sp \&\fIoffset\fR and \fIbuf_offset\fR are set to 0 if omitted or undef. .Sp \&\f(CW\*(C`pread()\*(C'\fR treats \fIbuf\fR just like \f(CW\*(C`sysread()\*(C'\fR does: \fIbuf_offset\fR may be specified to place the read data at that position in \fIbuf\fR. If \fIbuf_offset\fR is past the end of \fIbuf\fR, \fIbuf\fR will be padded with zeros before appending the data. If \fIbuf_offset\fR is negative, it is counted from the end of the string. \fIbuf\fR will be grown or shrunk so that the last byte actually read is the last byte of \fIbuf\fR after the read. .Sp Returns the number of bytes read, 0 at \s-1EOF,\s0 undef on error. .IP "preadv" 4 .IX Item "preadv" bytes_read = preadv(fd, buffers, sizes, [offset]) .Sp \&\f(CW\*(C`preadv()\*(C'\fR behaves like \f(CW\*(C`readv()\*(C'\fR but adds an optional \fIoffset\fR argument, which specifies the file position at which the data is to be read. \fIoffset\fR is set to 0 if omitted or undef. .Sp The file offset is not changed by this system call. The file referred to by \&\fIfd\fR must be capable of seeking. .IP "ptsname" 4 .IX Item "ptsname" name = ptsname(fd); .IP "pwrite" 4 .IX Item "pwrite" bytes_written = pwrite(fd, buf, [count, offset, buf_offset]); .Sp \&\fBpwrite()\fR writes \fIcount\fR bytes of data from the scalar \fIbuf\fR to the file descriptor \fIfd\fR at file offset \fIoffset\fR without changing the file offset. The file referenced by \fIfd\fR must be capable of seeking. .Sp If \fIcount\fR is omitted or undef, everything from \fIbuf_offset\fR up to the end of \fIbuf\fR is written. .Sp \&\fIbuf_offset\fR may be specified to write data from that position in \&\fIbuf\fR. If \fIbuf_offset\fR is negative it is counted from the end of the string. .Sp \&\fIoffset\fR and \fIbuf_offset\fR are set to 0 if omitted or undef. .Sp Returns the number of bytes written, undef on error. .Sp On Linux, if a file is opened with O_APPEND, \fBpwrite()\fR appends data to the end of the file, regardless of the value of offset (in violation of \s-1POSIX\s0). .IP "pwritev" 4 .IX Item "pwritev" bytes_written = pwritev(fd, buffers, [offset]) .Sp \&\f(CW\*(C`pwritev()\*(C'\fR behaves like \f(CW\*(C`writev()\*(C'\fR but adds an optional \&\fIoffset\fR argument, which specifies the file position at which the data is to be written. \fIoffset\fR is set to 0 if omitted or undef. .Sp The file offset is not changed by this system call. The file referred to by \&\fIfd\fR must be capable of seeking. .IP "random" 4 .IX Item "random" r = \fBrandom()\fR; .IP "read" 4 .IX Item "read" bytes_read = read(fd, buf, count); .Sp Like \fBPOSIX::read()\fR but returns 0 at \s-1EOF\s0 instead of \*(L"0 but true\*(R". .IP "readv" 4 .IX Item "readv" bytes_read = readv(fd, buffers, sizes); .Sp Example: .Sp .Vb 4 \& sysopen my $fh, \*(Aq/tmp/foobar\*(Aq, O_RDWR|O_CREAT|O_TRUNC; \& pwrite($fh, \*(Aqfoobar\*(Aq, 6, 0); \& readv($fh, my @buf, [4, 0, 4, 4]); \& # \-> @buf is (\*(Aqfoob\*(Aq, \*(Aq\*(Aq, \*(Aqar\*(Aq) .Ve .Sp \&\f(CW\*(C`readv()\*(C'\fR reads from the file descriptor \fIfd\fR into \fIbuffers\fR as many strings as there are elements in \fIsizes\fR. \fIbuffers\fR must be a variable holding an array or an array reference. \fIsizes\fR must be an array reference. .Sp \&\fIsizes\fR is expected to hold unsigned integers that specify how many bytes are to be read into each buffer. A byte count of 0 or undef creates an empty string. \fIsizes\fR is processed in array order. .Sp \&\fIbuffers\fR will be extended if necessary, but it will never be shrunk. If \&\fIbuffers\fR is not empty, any existing elements are replaced as long as sufficient data was read from \fIfd\fR. .Sp If the total byte count of \fIsizes\fR exceeds the number of bytes actually read from \fIfd\fR, there may be one partly filled buffer and the rest of \fIsizes\fR is skipped, so you may end up with less strings in \fIbuffers\fR than there are elements in \fIsizes\fR. .Sp \&\f(CW\*(C`readv()\*(C'\fR returns the number of bytes read (which may be less than the total bytes in \fIsizes\fR) or undef on error. .IP "readlink" 4 .IX Item "readlink" name = readlink(path); .Sp Returns undef on error. .IP "readlinkat" 4 .IX Item "readlinkat" name = readlinkat(dirfd, path); .Sp Returns undef on error. .IP "remainder" 4 .IX Item "remainder" r = remainder(x, y); .IP "remove" 4 .IX Item "remove" ret = remove(path); .Sp Calls the actual C library function \f(CW\*(C`remove()\*(C'\fR. .Sp Note that \fBPOSIX::remove()\fR fails if \fIpath\fR is a symlink to a directory because someone \*(L"couldn't read the plans right and did a piss-poor job of putting it together\*(R" as \f(CW\*(C`(\-d $_[0]) ? CORE::rmdir($_[0]) : CORE::unlink($_[0])\*(C'\fR. Quote from Armageddon. .IP "rename" 4 .IX Item "rename" ret = rename(old, new); .IP "renameat" 4 .IX Item "renameat" ret = renameat(olddirfd, oldpath, newdirfd, newpath); .IP "round" 4 .IX Item "round" r = round(x); .IP "scalbn" 4 .IX Item "scalbn" y = scalbn(x, n); .IP "seed48" 4 .IX Item "seed48" (old_seed1, old_seed2, old_seed3) = seed48(seed1, seed2, seed3); .IP "setegid" 4 .IX Item "setegid" ret = setegid(gid); .IP "seteuid" 4 .IX Item "seteuid" ret = seteuid(uid); .IP "setgid" 4 .IX Item "setgid" ret = setgid(gid); .IP "setitimer" 4 .IX Item "setitimer" (old_int_sec, old_int_usec, old_val_sec, old_val_usec) = setitimer(which, int_sec, int_usec, val_sec, val_usec); .Sp \&\fIwhich\fR is one of \s-1ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF.\s0 .IP "setpriority" 4 .IX Item "setpriority" ret = setpriority(value, which, who); .Sp \&\fIwhich\fR can be one of \s-1PRIO_PROCESS, PRIO_PGRP, PRIO_USER,\s0 defaults to \&\s-1PRIO_PROCESS.\s0 .Sp Returns true on success, undef on error. .Sp \&\fIwho\fR defaults to 0. .IP "setregid" 4 .IX Item "setregid" ret = setregid(rgid, egid); .IP "setreuid" 4 .IX Item "setreuid" ret = setreuid(ruid, euid); .IP "setuid" 4 .IX Item "setuid" ret = setuid(uid); .IP "setutxent" 4 .IX Item "setutxent" \&\fBsetutxent()\fR; .IP "sighold" 4 .IX Item "sighold" ret = sighold(sig); .IP "sigignore" 4 .IX Item "sigignore" ret = sigignore(sig); .IP "signbit" 4 .IX Item "signbit" b = signbit(x); .IP "sigpause" 4 .IX Item "sigpause" sigpause(sig); .IP "sigrelse" 4 .IX Item "sigrelse" ret = sigrelse(sig); .IP "sinh" 4 .IX Item "sinh" y = sinh(x); .IP "srand48" 4 .IX Item "srand48" srand48(seedval); .IP "srandom" 4 .IX Item "srandom" srandom(seed); .IP "stat" 4 .IX Item "stat" (dev, ino, mode, nlink, uid, gid, rdev, size, atim_sec, mtim_sec, ctim_sec, blksize, blocks, atim_nsec, mtim_nsec, ctim_nsec) = stat(path); .IP "strptime" 4 .IX Item "strptime" (sec, min, hour, mday, mon, year, wday, yday, isdst) = strptime(s, format[, sec, min, hour, mday, mon, year, wday, yday, isdst]); .Sp \&\fBstrptime()\fR converts the string \fIs\fR into a broken-down time according to the format string \fIformat\fR. The time fields may optionally be initialized in whole or in part and will be returned as initialized if they are not affected by the format string. Unprocessed uninitialized or undef fields are returned as undef. .Sp Returns an empty list on error. .Sp In scalar context returns the index of the first byte in \fIs\fR that was not processed or the byte length of \fIs\fR if the whole string was consumed or undef on error. .Sp As \fBstrptime()\fR acts on null-terminated strings, strings containing \s-1NUL\s0 bytes will only be processed up to the first \s-1NUL\s0 byte. .IP "symlink" 4 .IX Item "symlink" symlink(old, new); .IP "symlinkat" 4 .IX Item "symlinkat" ret = symlinkat(old, dirfd, new); .IP "sync" 4 .IX Item "sync" \&\fBsync()\fR; .IP "tan" 4 .IX Item "tan" y = tan(x); .IP "tanh" 4 .IX Item "tanh" y = tanh(x); .IP "tgamma" 4 .IX Item "tgamma" y = tgamma(x); .IP "timer_create" 4 .IX Item "timer_create" timerid = timer_create(clockid, signal); .Sp Returns undef on error. .IP "timer_delete" 4 .IX Item "timer_delete" timer_delete(timerid); .Sp Returns '0 but true' on success, undef on error. .IP "timer_getoverrun" 4 .IX Item "timer_getoverrun" count = timer_getoverrun(timerid); .Sp Returns undef on error. .IP "timer_gettime" 4 .IX Item "timer_gettime" (interval_sec, interval_nsec, initial_sec, initial_nsec) = timer_gettime(timerid); .Sp Returns an empty list on error. .IP "timer_settime" 4 .IX Item "timer_settime" (old_int_sec, old_int_nsec, old_init_sec, old_init_nsec) = timer_settime(timerid, flags, int_sec, int_nsec, [init_sec, init_nsec]); .Sp \&\fIflags\fR may be 0 or \f(CW\*(C`TIMER_ABSTIME\*(C'\fR. If the \fIinit\fR values are omitted, they are set to the \fIint\fR values. .IP "truncate" 4 .IX Item "truncate" ret = truncate(path, length); .IP "trunc" 4 .IX Item "trunc" y = trunc(x); .IP "unlinkat" 4 .IX Item "unlinkat" ret = unlinkat(dirfd, path, flags=0); .Sp \&\fIflags\fR can be 0 or \s-1AT_REMOVEDIR.\s0 .IP "unlink" 4 .IX Item "unlink" ret = unlink(path); .IP "utimensat" 4 .IX Item "utimensat" ret = utimensat(dirfd, path, flags, atime_sec, atime_nsec, mtime_sec, mtime_nsec); .Sp \&\fIflags\fR can be 0 or \s-1AT_SYMLINK_NOFOLLOW,\s0 defaults to 0. .Sp \&\fIatime_sec\fR and \fImtime_sec\fR default to 0. \fIatime_nsec\fR and \fImtime_nsec\fR default to \s-1UTIME_NOW.\s0 .IP "write" 4 .IX Item "write" bytes_written = write(fd, buf[, count]); .Sp Like \fBPOSIX::write()\fR but returns 0 instead of \*(L"0 but true\*(R" if 0 bytes were written, and it does not write more bytes than \fIbuf\fR contains. .Sp If \fIcount\fR is omitted or undef, it defaults to the length of \fIbuf\fR. .IP "writev" 4 .IX Item "writev" bytes_written = writev(fd, buffers); .Sp \&\fBwritev()\fR writes multiple buffers from \fIbuffers\fR to the file associated with the file descriptor \fIfd\fR. \fIbuffers\fR must be an array reference. The buffers are processed in array order. Undefined or empty elements are skipped. .Sp Returns the number of bytes written or undef on error. .IP "y0" 4 .IX Item "y0" y = y0(x); .Sp \&\fBy0()\fR is the Bessel function of the second kind of order 0. .IP "y1" 4 .IX Item "y1" y = y1(x); .Sp \&\fBy1()\fR is the Bessel function of the second kind of order 1. .IP "yn" 4 .IX Item "yn" y = yn(n, x); .Sp \&\fByn()\fR is the Bessel function of the second kind of order n. .SH "EXPORTS" .IX Header "EXPORTS" This module does not export anything by default. The following export tags are available: .PP .Vb 10 \& :at All *at() functions like openat() etc. plus all AT_ constants \& :id All get/set*id() functions like getuid() etc. \& :is All is* functions like isdigit() etc. \& :rw read(), readv(), write(), writev() \& :prw pread(), preadv(), pwrite(), pwritev() \& :clock All clock* functions and all CLOCK* constants \& :fcntl All F_, FD_, O_, POSIX_FADV_ and SEEK_ constants (for AT_ use :at) \& :fnm C and all FNM_ constants \& :time_h All CLOCK_ and TIMER_ constants \& :timer All timer_ functions and TIMER_ constants .Ve .SH "CONSTANTS" .IX Header "CONSTANTS" \&\f(CW\*(C`AT_EACCESS\*(C'\fR \f(CW\*(C`AT_EMPTY_PATH\*(C'\fR \f(CW\*(C`AT_FDCWD\*(C'\fR \f(CW\*(C`AT_NO_AUTOMOUNT\*(C'\fR \f(CW\*(C`AT_REMOVEDIR\*(C'\fR \&\f(CW\*(C`AT_SYMLINK_FOLLOW\*(C'\fR \f(CW\*(C`AT_SYMLINK_NOFOLLOW\*(C'\fR .PP \&\f(CW\*(C`BOOT_TIME\*(C'\fR \f(CW\*(C`NEW_TIME\*(C'\fR \f(CW\*(C`OLD_TIME\*(C'\fR \f(CW\*(C`DEAD_PROCESS\*(C'\fR \f(CW\*(C`INIT_PROCESS\*(C'\fR \&\f(CW\*(C`LOGIN_PROCESS\*(C'\fR \f(CW\*(C`USER_PROCESS\*(C'\fR \f(CW\*(C`RUN_LVL\*(C'\fR .PP \&\f(CW\*(C`CLOCK_BOOTTIME\*(C'\fR \f(CW\*(C`CLOCK_HIGHRES\*(C'\fR \f(CW\*(C`CLOCK_MONOTONIC\*(C'\fR \&\f(CW\*(C`CLOCK_MONOTONIC_COARSE\*(C'\fR \f(CW\*(C`CLOCK_MONOTONIC_FAST\*(C'\fR \f(CW\*(C`CLOCK_MONOTONIC_PRECISE\*(C'\fR \&\f(CW\*(C`CLOCK_MONOTONIC_RAW\*(C'\fR \f(CW\*(C`CLOCK_PROCESS_CPUTIME_ID\*(C'\fR \f(CW\*(C`CLOCK_REALTIME\*(C'\fR \&\f(CW\*(C`CLOCK_REALTIME_COARSE\*(C'\fR \f(CW\*(C`CLOCK_REALTIME_FAST\*(C'\fR \f(CW\*(C`CLOCK_REALTIME_PRECISE\*(C'\fR \&\f(CW\*(C`CLOCK_SOFTTIME\*(C'\fR \f(CW\*(C`CLOCK_THREAD_CPUTIME_ID\*(C'\fR \f(CW\*(C`CLOCK_UPTIME\*(C'\fR \&\f(CW\*(C`CLOCK_UPTIME_FAST\*(C'\fR \f(CW\*(C`CLOCK_UPTIME_PRECISE\*(C'\fR .PP \&\f(CW\*(C`_CS_GNU_LIBC_VERSION\*(C'\fR \f(CW\*(C`_CS_GNU_LIBPTHREAD_VERSION\*(C'\fR \f(CW\*(C`_CS_PATH\*(C'\fR .PP \&\f(CW\*(C`F_DUPFD\*(C'\fR \f(CW\*(C`F_DUPFD_CLOEXEC\*(C'\fR \f(CW\*(C`F_GETFD\*(C'\fR \f(CW\*(C`F_SETFD\*(C'\fR \f(CW\*(C`F_GETFL\*(C'\fR \&\f(CW\*(C`F_SETFL\*(C'\fR \f(CW\*(C`F_GETLK\*(C'\fR \f(CW\*(C`F_SETLK\*(C'\fR \f(CW\*(C`F_SETLKW\*(C'\fR \f(CW\*(C`F_GETOWN\*(C'\fR \f(CW\*(C`F_SETOWN\*(C'\fR \&\f(CW\*(C`F_RDLCK\*(C'\fR \f(CW\*(C`F_UNLCK\*(C'\fR \f(CW\*(C`F_WRLCK\*(C'\fR .PP \&\f(CW\*(C`FD_CLOEXEC\*(C'\fR .PP \&\f(CW\*(C`FNM_CASEFOLD\*(C'\fR \f(CW\*(C`FNM_FILE_NAME\*(C'\fR \f(CW\*(C`FNM_LEADING_DIR\*(C'\fR \f(CW\*(C`FNM_NOESCAPE\*(C'\fR \&\f(CW\*(C`FNM_NOMATCH\*(C'\fR \f(CW\*(C`FNM_PATHNAME\*(C'\fR \f(CW\*(C`FNM_PERIOD\*(C'\fR .PP \&\f(CW\*(C`FP_INFINITE\*(C'\fR \f(CW\*(C`FP_NAN\*(C'\fR \f(CW\*(C`FP_NORMAL\*(C'\fR \f(CW\*(C`FP_SUBNORMAL\*(C'\fR \f(CW\*(C`FP_ZERO\*(C'\fR .PP \&\f(CW\*(C`TIMER_ABSTIME\*(C'\fR \f(CW\*(C`ITIMER_PROF\*(C'\fR \f(CW\*(C`ITIMER_REAL\*(C'\fR \f(CW\*(C`ITIMER_VIRTUAL\*(C'\fR .PP \&\f(CW\*(C`O_ACCMODE\*(C'\fR \f(CW\*(C`O_APPEND\*(C'\fR \f(CW\*(C`O_CLOEXEC\*(C'\fR \f(CW\*(C`O_CREAT\*(C'\fR \f(CW\*(C`O_DIRECTORY\*(C'\fR \f(CW\*(C`O_DSYNC\*(C'\fR \&\f(CW\*(C`O_EXEC\*(C'\fR \f(CW\*(C`O_NOCTTY\*(C'\fR \f(CW\*(C`O_NOFOLLOW\*(C'\fR \f(CW\*(C`O_NONBLOCK\*(C'\fR \f(CW\*(C`O_RDONLY\*(C'\fR \f(CW\*(C`O_RDWR\*(C'\fR \&\f(CW\*(C`O_RSYNC\*(C'\fR \f(CW\*(C`O_SEARCH\*(C'\fR \f(CW\*(C`O_SYNC\*(C'\fR \f(CW\*(C`O_TMPFILE\*(C'\fR \f(CW\*(C`O_TRUNC\*(C'\fR \f(CW\*(C`O_TTY_INIT\*(C'\fR \&\f(CW\*(C`O_WRONLY\*(C'\fR .PP \&\f(CW\*(C`POSIX_FADV_NORMAL\*(C'\fR \f(CW\*(C`POSIX_FADV_SEQUENTIAL\*(C'\fR \f(CW\*(C`POSIX_FADV_RANDOM\*(C'\fR \&\f(CW\*(C`POSIX_FADV_NOREUSE\*(C'\fR \f(CW\*(C`POSIX_FADV_WILLNEED\*(C'\fR \f(CW\*(C`POSIX_FADV_DONTNEED\*(C'\fR .PP \&\f(CW\*(C`RTLD_GLOBAL\*(C'\fR \f(CW\*(C`RTLD_LAZY\*(C'\fR \f(CW\*(C`RTLD_LOCAL\*(C'\fR \f(CW\*(C`RTLD_NOW\*(C'\fR .PP \&\f(CW\*(C`SEEK_SET\*(C'\fR \f(CW\*(C`SEEK_CUR\*(C'\fR \f(CW\*(C`SEEK_END\*(C'\fR .PP \&\f(CW\*(C`UTIME_NOW\*(C'\fR \f(CW\*(C`UTIME_OMIT\*(C'\fR .SH "NOTES" .IX Header "NOTES" For whatever reason, \f(CW\*(C`preadv()\*(C'\fR and \f(CW\*(C`pwritev()\*(C'\fR are not part of \s-1POSIX.\s0 They are included anyway. .SH "AUTHOR" .IX Header "AUTHOR" Initially hacked together by Carsten Gaebler. .SH "LICENSE" .IX Header "LICENSE" This library is free software. You can redistribute and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the \s-1COPYING\s0 file or http://www.wtfpl.net/ for more details.