1
0
forked from 0ad/0ad
0ad/source/lib/sysdep/win/wposix/wfilesystem.h
janwas cded0936c5 # housekeeping
. update moduleInit mechanism and move it out of lib.cpp. now has a
thread-safe reference count and allows repeated init/shutdown (required
for self-tests)
. vfs now depends on h_mgr; h_mgr need therefore no longer explicitly be
shutdown (e.g. in self-tests)
. acpi: minor fixes
. cpu: AtomicAdd and CAS now take volatile variable (safer)
. mahaf: unload driver on shutdown (did this for DriverVerifier, but
it's 'cleaner' in general)
. wdbg_sym
. wfilesystem: get rid of manual declarations of deprecated functions;
implement them via trampoline instead

This was SVN commit r5086.
2007-05-21 23:24:56 +00:00

80 lines
1.7 KiB
C

#ifndef INCLUDED_WFILESYSTEM
#define INCLUDED_WFILESYSTEM
#include <sys/stat.h>
#include "no_crt_posix.h"
//
// sys/stat.h
//
// stat is defined by <sys/stat.h> (we allow this because VC8 declares
// inline macros that are worth keeping)
// defined by MinGW but not VC
#if MSC_VERSION
typedef unsigned int mode_t;
#endif
// mkdir is defined by posix_filesystem #if !HAVE_MKDIR
// (christmas-tree values because mkdir mode is ignored anyway)
#define S_IRWXO 0xFFFF
#define S_IRWXU 0xFFFF
#define S_IRWXG 0xFFFF
#define S_ISDIR(m) (m & S_IFDIR)
#define S_ISREG(m) (m & S_IFREG)
//
// dirent.h
//
typedef void DIR;
struct dirent
{
// note: SUSv3 describes this as a "char array" but of unspecified size.
// since that precludes using sizeof(), we may as well declare as a
// pointer to avoid copying in the implementation.
char* d_name;
};
extern DIR* opendir(const char* name);
extern struct dirent* readdir(DIR*);
extern int closedir(DIR*);
// return status for the file returned by the last successful
// readdir call from the given directory stream.
// currently sets st_size, st_mode, and st_mtime; the rest are zeroed.
// non-portable, but considerably faster than stat(). used by file_enum.
extern int readdir_stat_np(DIR*, struct stat*);
//
// <stdlib.h>
//
extern char* realpath(const char*, char*);
//
// <unistd.h>
//
// values from MS _access() implementation. do not change.
#define F_OK 0
#define R_OK 4
#define W_OK 2
// .. MS implementation doesn't support this distinction.
// hence, the file is reported executable if it exists.
#define X_OK 0
extern int access(const char* path, int mode);
extern int rmdir(const char* path);
#endif // #ifndef INCLUDED_WFILESYSTEM