Ignore:
Timestamp:
Nov 21, 2013, 1:11:08 AM (12 years ago)
Author:
bird
Message:

kmk/WindowsNT: Avoiding unnecessary stat() calls. Reimplemented stat(), lstat(), fstat(), opendir(), readdir(), and closedir() using native NT APIs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmkbuiltin/mscfakes.h

    r2592 r2702  
    3939#include <io.h>
    4040#include <direct.h>
     41#include "nt/ntstat.h"
    4142#if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */
    4243# define off_t __int64
    43 # undef stat
    44 # define stat  _stat64
    45 # define fstat _fstat64
    4644# define lseek _lseeki64
    47 #else
    48 # ifndef STAT_REDEFINED_ALREADY
    49 #  define STAT_REDEFINED_ALREADY
    50 #  undef stat
    51 #  define stat(_path, _st) bird_w32_stat(_path, _st)
    52 extern int bird_w32_stat(const char *, struct stat *);
    53 # endif
    5445#endif
    55 
    56 #ifndef S_ISDIR
    57 # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
    58 #endif
    59 #ifndef S_ISREG
    60 # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
    61 #endif
    62 #define S_ISLNK(m)  0
    63 #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
    64 #define S_IXUSR _S_IEXEC
    65 #define S_IWUSR _S_IWRITE
    66 #define S_IRUSR _S_IREAD
    67 #define S_IRWXG 0000070
    68 #define S_IRGRP 0000040
    69 #define S_IWGRP 0000020
    70 #define S_IXGRP 0000010
    71 #define S_IRWXO 0000007
    72 #define S_IROTH 0000004
    73 #define S_IWOTH 0000002
    74 #define S_IXOTH 0000001
    75 #define S_ISUID 0004000
    76 #define S_ISGID 0002000
    77 #define ALLPERMS 0000777
    7846
    7947#undef  PATH_MAX
     
    141109#define geteuid()  0
    142110#define getegid()  0
    143 #define lstat(path, s) stat(path, s)
    144111int lchmod(const char *path, mode_t mode);
    145112int msc_chmod(const char *path, mode_t mode);
     
    172139int writev(int fd, const struct iovec *vector, int count);
    173140
     141
     142
     143/*
     144 * MSC fake internals / helpers.
     145 */
     146int birdSetErrno(unsigned dwErr);
     147
    174148#endif /* _MSC_VER */
    175149#endif
Note: See TracChangeset for help on using the changeset viewer.