The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Filesys::POSIX::Bits::System - Bitfield and constant conversions for file modes and system call flags to system values

DESCRIPTION

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.

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.

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.

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.

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.

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.

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.

If a value unknown to Filesys::POSIX::Bits is provided, then the function will die.

DIAGNOSTICS

CONSTANT is not supported by this system

The system's Fcntl does not have a value defined for the given CONSTANT and thus it can't (and won't) be converted.

CONSTANT is not supported by Fcntl

The Fcntl module does not define the given CONSTANT and thus it can't (and won't) be converted.

Unknown access mode: flag

The access mode provided does not match $O_RDONLY, $O_WRONLY, xor $O_RDWR; or an access mode was not provided at all.

Unknown file type: mode

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.

Unknown whence value: whence

The whence value provided was not one of: $SEEK_SET, $SEEK_CUR, xor $SEEK_END.

KNOWN ISSUES

SEEK_END is assumed to exist

The Fcntl value SEEK_END is assumed to exist when it is not specified by POSIX, but is rather an almost ubiquitously supported extension.