All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fileSystem.h File Reference

Architecture dependent file system access. More...

+ Include dependency graph for fileSystem.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARCH_GLOB_NOCHECK   GLOB_NOCHECK
 
#define ARCH_GLOB_MARK   GLOB_MARK
 
#define ARCH_GLOB_NOSORT   GLOB_NOSORT
 
#define ARCH_GLOB_DEFAULT   (ARCH_GLOB_NOCHECK | ARCH_GLOB_MARK)
 
#define ARCH_PATH_MAX   1024
 
#define ARCH_PATH_SEP   "/"
 
#define ARCH_PATH_LIST_SEP   ":"
 
#define ARCH_REL_PATH_IDENT   "./"
 
#define ArchChmod(path, mode)   chmod(path, mode)
 
#define ArchCloseFile(fd)   close(fd)
 
#define ArchUnlinkFile(path)   unlink(path)
 
#define ArchFileAccess(path, mode)   access(path, mode)
 
#define ArchFdOpen(fd, mode)   fdopen(fd, mode)
 
#define ArchFileNo(stream)   fileno(stream)
 
#define ArchFileIsaTTY(stream)   isatty(stream)
 
#define ArchRmDir(path)   rmdir(path)
 

Typedefs

typedef struct stat ArchStatType
 
using ArchConstFileMapping = std::unique_ptr< char const, Arch_Unmapper >
 ArchConstFileMapping and ArchMutableFileMapping are std::unique_ptr<char const *, ...> and std::unique_ptr<char *, ...> respectively.
 
using ArchMutableFileMapping = std::unique_ptr< char, Arch_Unmapper >
 

Enumerations

enum  ArchMemAdvice { ArchMemAdviceNormal , ArchMemAdviceWillNeed , ArchMemAdviceDontNeed , ArchMemAdviceRandomAccess }
 
enum  ArchFileAdvice { ArchFileAdviceNormal , ArchFileAdviceWillNeed , ArchFileAdviceDontNeed , ArchFileAdviceRandomAccess }
 

Functions

ARCH_API FILE * ArchOpenFile (char const *fileName, char const *mode)
 Opens a file.
 
ARCH_API int64_t ArchGetFileLength (const char *fileName)
 Return the length of a file in bytes.
 
ARCH_API int64_t ArchGetFileLength (FILE *file)
 
ARCH_API std::string ArchGetFileName (FILE *file)
 Return a filename for this file, if one can be obtained.
 
ARCH_API bool ArchStatIsWritable (const ArchStatType *st)
 Returns true if the data in stat struct st indicates that the target file or directory is writable.
 
ARCH_API bool ArchGetModificationTime (const char *pathname, double *time)
 Returns the modification time (mtime) in seconds for a file.
 
ARCH_API double ArchGetModificationTime (const ArchStatType &st)
 Returns the modification time (mtime) in seconds from the stat struct.
 
ARCH_API std::string ArchNormPath (const std::string &path, bool stripDriveSpecifier=false)
 Normalizes the specified path, eliminating double slashes, etc.
 
ARCH_API std::string ArchAbsPath (const std::string &path)
 Returns the canonical absolute path of the specified filename.
 
ARCH_API bool ArchGetStatMode (const char *pathname, int *mode)
 Returns the permissions mode (mode_t) for the given pathname.
 
ARCH_API const char * ArchGetTmpDir ()
 Return the path to a temporary directory for this platform.
 
ARCH_API std::string ArchMakeTmpFileName (const std::string &prefix, const std::string &suffix=std::string())
 Make a temporary file name, in a system-determined temporary directory.
 
ARCH_API int ArchMakeTmpFile (const std::string &prefix, std::string *pathname=0)
 Create a temporary file, in a system-determined temporary directory.
 
ARCH_API int ArchMakeTmpFile (const std::string &tmpdir, const std::string &prefix, std::string *pathname=0)
 Create a temporary file, in a given temporary directory.
 
ARCH_API std::string ArchMakeTmpSubdir (const std::string &tmpdir, const std::string &prefix)
 Create a temporary sub-direcrory, in a given temporary directory.
 
size_t ArchGetFileMappingLength (ArchConstFileMapping const &m)
 Return the length of an ArchConstFileMapping.
 
size_t ArchGetFileMappingLength (ArchMutableFileMapping const &m)
 Return the length of an ArchMutableFileMapping.
 
ARCH_API ArchConstFileMapping ArchMapFileReadOnly (FILE *file, std::string *errMsg=nullptr)
 Privately map the passed file into memory and return a unique_ptr to the read-only mapped contents.
 
ARCH_API ArchConstFileMapping ArchMapFileReadOnly (std::string const &path, std::string *errMsg=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
ARCH_API ArchMutableFileMapping ArchMapFileReadWrite (FILE *file, std::string *errMsg=nullptr)
 Privately map the passed file into memory and return a unique_ptr to the copy-on-write mapped contents.
 
ARCH_API ArchMutableFileMapping ArchMapFileReadWrite (std::string const &path, std::string *errMsg=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
ARCH_API void ArchMemAdvise (void const *addr, size_t len, ArchMemAdvice adv)
 Advise the OS regarding how the application intends to access a range of memory.
 
ARCH_API bool ArchQueryMappedMemoryResidency (void const *addr, size_t len, unsigned char *pageMap)
 Report whether or not the mapped virtual memory pages starting at addr for len bytes are resident in RAM.
 
ARCH_API int64_t ArchPRead (FILE *file, void *buffer, size_t count, int64_t offset)
 Read up to count bytes from offset in file into buffer.
 
ARCH_API int64_t ArchPWrite (FILE *file, void const *bytes, size_t count, int64_t offset)
 Write up to count bytes from buffer to file at offset.
 
ARCH_API std::string ArchReadLink (const char *path)
 Returns the value of the symbolic link at path.
 
ARCH_API void ArchFileAdvise (FILE *file, int64_t offset, size_t count, ArchFileAdvice adv)
 Advise the OS regarding how the application intends to access a range of bytes in a file.
 

Detailed Description

Architecture dependent file system access.

Definition in file fileSystem.h.