Filesys::POSIX::Bits::System - Bitfield and constant conversions for file modes and system call flags to system values
This file contains functions to convert the values of bitfields and constants from the values defined in Filesys::POSIX::Bits to the values used by the system, defined in Fcntl. Only exported values are supported.
Filesys::POSIX::Bits
Fcntl
The following (unexported) functions are provided:
convertFlagsToSystem($flags)
Converts the constants beginning with '$O_' to their values on the current system. These constants are generally used in the $flags field of sysopen.
$O_
$flags
sysopen
Values that are not supported by this system will throw a warning and will be left out of the returned value. The flags must include an access mode (e.g. $O_RDONLY, $O_WRONLY, xor $O_RDWR) in addition to any other values desired. If an access mode is not provided or its value is unknown to Filesys::POSIX::Bits, then the function will die.
$O_RDONLY
$O_WRONLY
$O_RDWR
Note that $O_EVTONLY is specific to this module and unsupported by Fcntl. Trying to convert it to a system value will result in a warning.
$O_EVTONLY
convertModeToSystem($mode)
Converts the constants beginning with '$S_I' to their values on the current system. These constants are generally used in the $mode field of sysopen and in the $mode field of stat.
$S_I
$mode
stat
File types that are not supported by this system will throw a warning and will be left out of the returned value. The mode may include zero or one file type (values beginning with $S_IF), but not more. If a file type unknown to Filesys::POSIX::Bits is provided, then the function will die.
$S_IF
convertWhenceToSystem($whence)
Converts the constants beginning with '$SEEK_' to their values on the current system. These constants are generally used in the $whence field of sysseek.
$SEEK_
$whence
sysseek
If a value unknown to Filesys::POSIX::Bits is provided, then the function will die.
The system's Fcntl does not have a value defined for the given CONSTANT and thus it can't (and won't) be converted.
The Fcntl module does not define the given CONSTANT and thus it can't (and won't) be converted.
The access mode provided does not match $O_RDONLY, $O_WRONLY, xor $O_RDWR; or an access mode was not provided at all.
The optional file type component that was provided does not match one of: $S_IFIFO, $S_IFCHR, $S_IFDIR, $S_IFBLK, $S_IFREG, $S_IFLNK, $S_IFSOCK, xor $S_IFWHT.
$S_IFIFO
$S_IFCHR
$S_IFDIR
$S_IFBLK
$S_IFREG
$S_IFLNK
$S_IFSOCK
$S_IFWHT
The whence value provided was not one of: $SEEK_SET, $SEEK_CUR, xor $SEEK_END.
$SEEK_SET
$SEEK_CUR
$SEEK_END
The Fcntl value SEEK_END is assumed to exist when it is not specified by POSIX, but is rather an almost ubiquitously supported extension.
SEEK_END
To install Filesys::POSIX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Filesys::POSIX
CPAN shell
perl -MCPAN -e shell install Filesys::POSIX
For more information on module installation, please visit the detailed CPAN module installation guide.