Changeset 2546 for trunk/src/kmk/kmkbuiltin/haikufakes.h
- Timestamp:
- Oct 1, 2011, 9:49:54 PM (14 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/haikufakes.h
r2545 r2546 1 1 /* $Id$ */ 2 2 /** @file 3 * Unix fakes for MSC.3 * Unix/BSD fakes for Haiku. 4 4 */ 5 5 … … 24 24 */ 25 25 26 #ifndef ___mscfakes_h 27 #define ___mscfakes_h 28 #ifdef _MSC_VER 29 30 #include <io.h> 31 #include <direct.h> 32 #include <time.h> 33 #include <stdarg.h> 34 #include <malloc.h> 35 #include "getopt.h" 36 37 #if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */ 38 # define off_t __int64 39 # define stat _stat64 40 # define fstat _fstat64 41 # define lseek _lseeki64 42 #else 43 # undef stat 44 # define stat(_path, _st) my_other_stat(_path, _st) 45 extern int my_other_stat(const char *, struct stat *); 46 #endif 47 48 49 50 #ifndef S_ISDIR 51 # define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) 52 #endif 53 #ifndef S_ISREG 54 # define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) 55 #endif 56 #define S_ISLNK(m) 0 57 #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) 58 #define S_IXUSR _S_IEXEC 59 #define S_IWUSR _S_IWRITE 60 #define S_IRUSR _S_IREAD 61 #define S_IRWXG 0000070 62 #define S_IRGRP 0000040 63 #define S_IWGRP 0000020 64 #define S_IXGRP 0000010 65 #define S_IRWXO 0000007 66 #define S_IROTH 0000004 67 #define S_IWOTH 0000002 68 #define S_IXOTH 0000001 69 #define S_ISUID 0004000 70 #define S_ISGID 0002000 71 #define ALLPERMS 0000777 72 73 #undef PATH_MAX 74 #define PATH_MAX _MAX_PATH 75 #undef MAXPATHLEN 76 #define MAXPATHLEN _MAX_PATH 26 #ifndef ___haikufakes_h 27 #define ___haikufakes_h 77 28 78 29 #define EX_OK 0 … … 80 31 #define EX_NOUSER 1 81 32 #define EX_USAGE 1 33 #define EX_TEMPFAIL 1 34 #define EX_SOFTWARE 1 82 35 83 #define STDIN_FILENO 0 84 #define STDOUT_FILENO 1 85 #define STDERR_FILENO 2 36 #define lutimes(path, tvs) utimes(path, tvs) 37 #define lchmod haiku_lchmod 86 38 87 #define F_OK 088 #define X_OK 189 #define W_OK 290 #define R_OK 491 92 #define EFTYPE EINVAL93 94 #define _PATH_DEVNULL "/dev/null"95 96 #ifndef MAX97 # define MAX(a,b) ((a) >= (b) ? (a) : (b))98 39 #endif 99 40 100 typedef int mode_t;101 typedef unsigned short nlink_t;102 #if 0 /* found in config.h */103 typedef unsigned short uid_t;104 typedef unsigned short gid_t;105 #endif106 typedef long ssize_t;107 typedef unsigned long u_long;108 typedef unsigned int u_int;109 typedef unsigned short u_short;110 111 #ifndef timerisset112 struct timeval113 {114 long tv_sec;115 long tv_usec;116 };117 #endif118 119 struct iovec120 {121 char *iov_base;122 size_t iov_len;123 };124 125 typedef __int64 intmax_t;126 #if 0 /* found in config.h */127 typedef unsigned __int64 uintmax_t;128 #endif129 130 #define chown(path, uid, gid) 0 /** @todo implement fchmod! */131 char *dirname(char *path);132 #define fsync(fd) 0133 #define fchown(fd,uid,gid) 0134 #define fchmod(fd, mode) 0 /** @todo implement fchmod! */135 #define geteuid() 0136 #define getegid() 0137 #define lstat(path, s) stat(path, s)138 int lchmod(const char *path, mode_t mode);139 int msc_chmod(const char *path, mode_t mode);140 #define chmod msc_chmod141 #define lchown(path, uid, gid) chown(path, uid, gid)142 #define lutimes(path, tvs) utimes(path, tvs)143 int link(const char *pszDst, const char *pszLink);144 int mkdir_msc(const char *path, mode_t mode);145 #define mkdir(path, mode) mkdir_msc(path, mode)146 #define mkfifo(path, mode) -1147 #define mknod(path, mode, devno) -1148 int mkstemp(char *temp);149 #define readlink(link, buf, size) -1150 #define reallocf(old, size) realloc(old, size)151 int rmdir_msc(const char *path);152 #define rmdir(path) rmdir_msc(path)153 intmax_t strtoimax(const char *nptr, char **endptr, int base);154 uintmax_t strtoumax(const char *nptr, char **endptr, int base);155 #define strtoll(a,b,c) strtoimax(a,b,c)156 #define strtoull(a,b,c) strtoumax(a,b,c)157 int asprintf(char **strp, const char *fmt, ...);158 int vasprintf(char **strp, const char *fmt, va_list ap);159 #if _MSC_VER < 1400160 int snprintf(char *buf, size_t size, const char *fmt, ...);161 #else162 #define snprintf _snprintf163 #endif164 int symlink(const char *pszDst, const char *pszLink);165 int utimes(const char *pszPath, const struct timeval *paTimes);166 int writev(int fd, const struct iovec *vector, int count);167 168 #endif /* _MSC_VER */169 #endif170
Note:
See TracChangeset
for help on using the changeset viewer.