VirtualBox

source: kBuild/trunk/src/ash/win/mscfakes.h@ 632

最後變更 在這個檔案從632是 632,由 bird 提交於 18 年 前

MSC hacking.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.5 KB
 
1/* $Id: mscfakes.h 632 2006-11-26 13:46:21Z bird $ */
2/** @file
3 *
4 * Unix fakes for MSC.
5 *
6 * Copyright (c) 2005 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with This program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __mscfakes_h__
26#define __mscfakes_h__
27#ifdef _MSC_VER
28
29#define setmode setmode_msc
30#include <io.h>
31#include <direct.h>
32#include <time.h>
33#include <fcntl.h>
34#include <limits.h>
35#undef setmode
36//#include "getopt.h"
37
38#if !defined(__GNUC__) && !defined(__attribute__)
39#define __attribute__(a)
40#endif
41
42typedef int pid_t;
43
44#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
45#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
46#define S_ISLNK(m) 0
47#define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
48#define S_IXUSR _S_IEXEC
49#define S_IWUSR _S_IWRITE
50#define S_IRUSR _S_IREAD
51#define S_IRWXG 0000070
52#define S_IRGRP 0000040
53#define S_IWGRP 0000020
54#define S_IXGRP 0000010
55#define S_IRWXO 0000007
56#define S_IROTH 0000004
57#define S_IWOTH 0000002
58#define S_IXOTH 0000001
59#define S_ISUID 0004000
60#define S_ISGID 0002000
61#define ALLPERMS 0000777
62
63#define PATH_MAX _MAX_PATH
64#define MAXPATHLEN _MAX_PATH
65
66#define EX_OK 0
67#define EX_OSERR 1
68#define EX_NOUSER 1
69#define EX_USAGE 1
70
71#define STDIN_FILENO 0
72#define STDOUT_FILENO 1
73#define STDERR_FILENO 2
74
75#define F_OK 0
76#define X_OK 1
77#define W_OK 2
78#define R_OK 4
79
80#define EFTYPE EINVAL
81
82#define _PATH_DEVNULL "/dev/null"
83
84#define MAX(a,b) ((a) >= (b) ? (a) : (b))
85
86typedef int mode_t;
87typedef unsigned short nlink_t;
88typedef unsigned short uid_t;
89typedef unsigned short gid_t;
90typedef long ssize_t;
91typedef unsigned long u_long;
92typedef unsigned int u_int;
93typedef unsigned short u_short;
94
95#ifndef timerisset
96struct timeval
97{
98 long tv_sec;
99 long tv_usec;
100};
101#endif
102
103struct iovec
104{
105 char *iov_base;
106 size_t iov_len;
107};
108
109
110#define chown(path, uid, gid) 0 /** @todo implement fchmod! */
111char *dirname(char *path);
112#define fsync(fd) 0
113#define fchown(fd,uid,gid) 0
114#define fchmod(fd, mode) 0 /** @todo implement fchmod! */
115#define geteuid() 0
116#define lstat(path, s) stat(path, s)
117#define lchmod(path, mod) chmod(path, mod)
118#define lchown(path, uid, gid) chown(path, uid, gid)
119#define lutimes(path, tvs) utimes(path, tvs)
120int link(const char *pszDst, const char *pszLink);
121int mkdir_msc(const char *path, mode_t mode);
122#define mkdir(path, mode) mkdir_msc(path, mode)
123#define mkfifo(path, mode) -1
124#define mknod(path, mode, devno) -1
125#define pipe(v) _pipe(v,0,0)
126int mkstemp(char *temp);
127#define readlink(link, buf, size) -1
128#define reallocf(old, size) realloc(old, size)
129#define strcasecmp stricmp
130#define strncasecmp strnicmp
131#if _MSC_VER < 1400
132int snprintf(char *buf, size_t size, const char *fmt, ...);
133#else
134#define snprintf _snprintf
135#endif
136size_t strlcpy(char *, const char *, size_t);
137int symlink(const char *pszDst, const char *pszLink);
138int utimes(const char *pszPath, const struct timeval *paTimes);
139int writev(int fd, const struct iovec *vector, int count);
140#define F_DUPFD 0
141#define F_GETFD 1
142#define F_SETFD 2
143#define F_GETFL 3
144#define F_SETFL 4
145#define FD_CLOEXEC 1
146#define O_NONBLOCK 0 /// @todo
147#define EWOULDBLOCK 512
148int fcntl (int, int, ...);
149
150/* signal hacks */
151typedef struct sigset
152{
153 unsigned long __bitmap[1];
154} sigset_t;
155int sigprocmask(int, const sigset_t *, sigset_t *);
156#define SIG_BLOCK 1
157#define SIG_UNBLOCK 2
158#define SIG_SETMASK 3
159
160#define SIGTTIN 0
161#define SIGTSTP 0
162#define SIGTTOU 0
163#define SIGCONT 0
164#define SIGPIPE 0
165#define SIGQUIT 0
166#define SIGHUP 0
167#ifndef NSIG
168#define NSIG 32
169#endif
170extern const char *const sys_siglist[NSIG];
171
172int kill(pid_t, int);
173int sigaction(int, const struct sigaction *, struct sigaction *);
174//int sigaddset(sigset_t *, int);
175//int sigdelset(sigset_t *, int);
176int sigemptyset(sigset_t *);
177//int sigfillset(sigset_t *);
178//int sigismember(const sigset_t *, int);
179//int sigpending(sigset_t *);
180//int sigsuspend(const sigset_t *);
181//int sigwait(const sigset_t *, int *);
182
183#endif /* _MSC_VER */
184#endif
185
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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