24 #ifndef PXR_BASE_ARCH_FILE_SYSTEM_H
25 #define PXR_BASE_ARCH_FILE_SYSTEM_H
41 #include <sys/types.h>
44 #if defined(ARCH_OS_LINUX)
46 #include <sys/statfs.h>
48 #elif defined(ARCH_OS_DARWIN)
50 #include <sys/mount.h>
52 #elif defined(ARCH_OS_WINDOWS)
60 #if !defined(ARCH_OS_WINDOWS)
64 #include <sys/param.h>
68 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
72 #define F_OK 0 // Test for existence.
73 #define X_OK 1 // Test for execute permission.
74 #define W_OK 2 // Test for write permission.
75 #define R_OK 4 // Test for read permission.
78 #if defined(ARCH_OS_WINDOWS)
79 #define ARCH_GLOB_NOCHECK 1
80 #define ARCH_GLOB_MARK 2
81 #define ARCH_GLOB_NOSORT 4
83 #define ARCH_GLOB_NOCHECK GLOB_NOCHECK
84 #define ARCH_GLOB_MARK GLOB_MARK
85 #define ARCH_GLOB_NOSORT GLOB_NOSORT
87 #define ARCH_GLOB_DEFAULT (ARCH_GLOB_NOCHECK | ARCH_GLOB_MARK)
91 #define ARCH_PATH_MAX PATH_MAX
94 #define ARCH_PATH_MAX MAXPATHLEN
97 #define ARCH_PATH_MAX _MAX_PATH
99 #define ARCH_PATH_MAX 1024
105 #if defined(ARCH_OS_WINDOWS)
106 #define ARCH_PATH_SEP "\\"
107 #define ARCH_PATH_LIST_SEP ";"
108 #define ARCH_REL_PATH_IDENT ".\\"
110 #define ARCH_PATH_SEP "/"
111 #define ARCH_PATH_LIST_SEP ":"
112 #define ARCH_REL_PATH_IDENT "./"
115 #if defined(ARCH_OS_WINDOWS)
134 #if defined(ARCH_OS_WINDOWS)
135 # define ArchChmod(path, mode) _chmod(path, mode)
137 # define ArchChmod(path, mode) chmod(path, mode)
140 #if defined(ARCH_OS_WINDOWS)
141 # define ArchCloseFile(fd) _close(fd)
143 # define ArchCloseFile(fd) close(fd)
146 #if defined(ARCH_OS_WINDOWS)
147 # define ArchUnlinkFile(path) _unlink(path)
149 # define ArchUnlinkFile(path) unlink(path)
152 #if defined(ARCH_OS_WINDOWS)
155 # define ArchFileAccess(path, mode) access(path, mode)
158 #if defined(ARCH_OS_WINDOWS)
159 # define ArchFdOpen(fd, mode) _fdopen(fd, mode)
161 # define ArchFdOpen(fd, mode) fdopen(fd, mode)
164 #if defined(ARCH_OS_WINDOWS)
165 # define ArchFileNo(stream) _fileno(stream)
167 # define ArchFileNo(stream) fileno(stream)
170 #if defined(ARCH_OS_WINDOWS)
171 # define ArchFileIsaTTY(stream) _isatty(stream)
173 # define ArchFileIsaTTY(stream) isatty(stream)
176 #if defined(ARCH_OS_WINDOWS)
179 # define ArchRmDir(path) rmdir(path)
222 bool stripDriveSpecifier =
false);
322 return m.get_deleter().GetLength();
328 return m.get_deleter().GetLength();
388 void const *
addr,
size_t len,
unsigned char *pageMap);
428 #endif // PXR_BASE_ARCH_FILE_SYSTEM_H
ARCH_API FILE * ArchOpenFile(char const *fileName, char const *mode)
ARCH_API void ArchMemAdvise(void const *addr, size_t len, ArchMemAdvice adv)
GT_API const UT_StringHolder time
GLsizei const GLchar *const * path
ARCH_API std::string ArchAbsPath(const std::string &path)
ARCH_API void ArchFileAdvise(FILE *file, int64_t offset, size_t count, ArchFileAdvice adv)
ARCH_API std::string ArchNormPath(const std::string &path, bool stripDriveSpecifier=false)
ARCH_API ArchConstFileMapping ArchMapFileReadOnly(FILE *file, std::string *errMsg=nullptr)
std::unique_ptr< char const, Arch_Unmapper > ArchConstFileMapping
Arch_Unmapper(size_t length)
ARCH_API ArchMutableFileMapping ArchMapFileReadWrite(FILE *file, std::string *errMsg=nullptr)
ARCH_API const char * ArchGetTmpDir()
ARCH_API int ArchMakeTmpFile(const std::string &prefix, std::string *pathname=0)
std::unique_ptr< char, Arch_Unmapper > ArchMutableFileMapping
GLsizei const GLchar *const * string
ARCH_API std::string ArchReadLink(const char *path)
ARCH_API int64_t ArchGetFileLength(const char *fileName)
size_t ArchGetFileMappingLength(ArchConstFileMapping const &m)
Return the length of an ArchConstFileMapping.
ARCH_API bool ArchGetStatMode(const char *pathname, int *mode)
GLuint GLsizei GLsizei * length
ARCH_API bool ArchStatIsWritable(const ArchStatType *st)
ARCH_API bool ArchQueryMappedMemoryResidency(void const *addr, size_t len, unsigned char *pageMap)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
ARCH_API std::string ArchGetFileName(FILE *file)
Return a filename for this file, if one can be obtained.
#define ArchFileAccess(path, mode)
ARCH_API int64_t ArchPRead(FILE *file, void *buffer, size_t count, int64_t offset)
ARCH_API void operator()(char *mapStart) const
ARCH_API std::string ArchMakeTmpSubdir(const std::string &tmpdir, const std::string &prefix)
ARCH_API int64_t ArchPWrite(FILE *file, void const *bytes, size_t count, int64_t offset)
ARCH_API bool ArchGetModificationTime(const char *pathname, double *time)
ARCH_API std::string ArchMakeTmpFileName(const std::string &prefix, const std::string &suffix=std::string())