VirtualBox

source: kBuild/trunk/src/kmk/kmkbuiltin/mscfakes.h@ 2713

Last change on this file since 2713 was 2713, checked in by bird, 11 years ago

Some unlink(), rmdir() and kmk_rm optimizations.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: mscfakes.h 2713 2013-11-21 21:11:00Z bird $ */
2/** @file
3 * Unix fakes for MSC.
4 */
5
6/*
7 * Copyright (c) 2005-2010 knut st. osmundsen <[email protected]>
8 *
9 * This file is part of kBuild.
10 *
11 * kBuild is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * kBuild is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with kBuild. If not, see <http://www.gnu.org/licenses/>
23 *
24 */
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/* Note: Duplicated it config.h.win */
38#include <sys/stat.h>
39#include <io.h>
40#include <direct.h>
41#include "nt/ntstat.h"
42#include "nt/ntunlink.h"
43#if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */
44# define off_t __int64
45# define lseek _lseeki64
46#endif
47
48#undef PATH_MAX
49#define PATH_MAX _MAX_PATH
50#undef MAXPATHLEN
51#define MAXPATHLEN _MAX_PATH
52
53#define EX_OK 0
54#define EX_OSERR 1
55#define EX_NOUSER 1
56#define EX_USAGE 1
57
58#define STDIN_FILENO 0
59#define STDOUT_FILENO 1
60#define STDERR_FILENO 2
61
62#define F_OK 0
63#define X_OK 1
64#define W_OK 2
65#define R_OK 4
66
67#define EFTYPE EINVAL
68
69#define _PATH_DEVNULL "/dev/null"
70
71#ifndef MAX
72# define MAX(a,b) ((a) >= (b) ? (a) : (b))
73#endif
74
75typedef int mode_t;
76typedef unsigned short nlink_t;
77#if 0 /* found in config.h */
78typedef unsigned short uid_t;
79typedef unsigned short gid_t;
80#endif
81typedef long ssize_t;
82typedef unsigned long u_long;
83typedef unsigned int u_int;
84typedef unsigned short u_short;
85
86#ifndef timerisset
87struct timeval
88{
89 long tv_sec;
90 long tv_usec;
91};
92#endif
93
94struct iovec
95{
96 char *iov_base;
97 size_t iov_len;
98};
99
100typedef __int64 intmax_t;
101#if 0 /* found in config.h */
102typedef unsigned __int64 uintmax_t;
103#endif
104
105#define chown(path, uid, gid) 0 /** @todo implement fchmod! */
106char *dirname(char *path);
107#define fsync(fd) 0
108#define fchown(fd,uid,gid) 0
109#define fchmod(fd, mode) 0 /** @todo implement fchmod! */
110#define geteuid() 0
111#define getegid() 0
112int lchmod(const char *path, mode_t mode);
113int msc_chmod(const char *path, mode_t mode);
114#define chmod msc_chmod
115#define lchown(path, uid, gid) chown(path, uid, gid)
116#define lutimes(path, tvs) utimes(path, tvs)
117int link(const char *pszDst, const char *pszLink);
118int mkdir_msc(const char *path, mode_t mode);
119#define mkdir(path, mode) mkdir_msc(path, mode)
120#define mkfifo(path, mode) -1
121#define mknod(path, mode, devno) -1
122int mkstemp(char *temp);
123#define readlink(link, buf, size) -1
124#define reallocf(old, size) realloc(old, size)
125int rmdir_msc(const char *path);
126#define rmdir(path) rmdir_msc(path)
127intmax_t strtoimax(const char *nptr, char **endptr, int base);
128uintmax_t strtoumax(const char *nptr, char **endptr, int base);
129#define strtoll(a,b,c) strtoimax(a,b,c)
130#define strtoull(a,b,c) strtoumax(a,b,c)
131int asprintf(char **strp, const char *fmt, ...);
132int vasprintf(char **strp, const char *fmt, va_list ap);
133#if _MSC_VER < 1400
134int snprintf(char *buf, size_t size, const char *fmt, ...);
135#else
136#define snprintf _snprintf
137#endif
138int symlink(const char *pszDst, const char *pszLink);
139int utimes(const char *pszPath, const struct timeval *paTimes);
140int writev(int fd, const struct iovec *vector, int count);
141
142
143
144/*
145 * MSC fake internals / helpers.
146 */
147int birdSetErrno(unsigned dwErr);
148
149#endif /* _MSC_VER */
150#endif
151
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette