6 * Copyright (c) 2005-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net>
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.
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.
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
25 #ifndef __mscfakes_h__
26 #define __mscfakes_h__
29 #define setmode setmode_msc
30 #include <sys/cdefs.h>
41 #if !defined(__GNUC__) && !defined(__attribute__)
42 #define __attribute__(a)
45 #define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
46 #define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
48 #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
49 #define S_IXUSR _S_IEXEC
50 #define S_IWUSR _S_IWRITE
51 #define S_IRUSR _S_IREAD
52 #define S_IRWXG 0000070
53 #define S_IRGRP 0000040
54 #define S_IWGRP 0000020
55 #define S_IXGRP 0000010
56 #define S_IRWXO 0000007
57 #define S_IROTH 0000004
58 #define S_IWOTH 0000002
59 #define S_IXOTH 0000001
60 #define S_ISUID 0004000
61 #define S_ISGID 0002000
62 #define ALLPERMS 0000777
64 #define PATH_MAX _MAX_PATH
65 #define MAXPATHLEN _MAX_PATH
72 #define STDIN_FILENO 0
73 #define STDOUT_FILENO 1
74 #define STDERR_FILENO 2
83 #define _PATH_DEVNULL "/dev/null"
85 #define MAX(a,b) ((a) >= (b) ? (a) : (b))
88 typedef unsigned short nlink_t
;
90 typedef unsigned long u_long
;
91 typedef unsigned int u_int
;
92 typedef unsigned short u_short
;
109 #define chown(path, uid, gid) 0 /** @todo implement fchmod! */
110 char *dirname(char *path
);
112 #define fchown(fd,uid,gid) 0
113 #define fchmod(fd, mode) 0 /** @todo implement fchmod! */
115 #define lstat(path, s) stat(path, s)
116 #define lchmod(path, mod) chmod(path, mod)
117 #define lchown(path, uid, gid) chown(path, uid, gid)
118 #define lutimes(path, tvs) utimes(path, tvs)
119 int link(const char *pszDst
, const char *pszLink
);
120 int mkdir_msc(const char *path
, mode_t mode
);
121 #define mkdir(path, mode) mkdir_msc(path, mode)
122 #define mkfifo(path, mode) -1
123 #define mknod(path, mode, devno) -1
124 #define pipe(v) _pipe(v,0,0)
125 int mkstemp(char *temp
);
126 #define readlink(link, buf, size) -1
127 #define reallocf(old, size) realloc(old, size)
128 #define strcasecmp stricmp
129 #define strncasecmp strnicmp
131 int snprintf(char *buf
, size_t size
, const char *fmt
, ...);
133 #define snprintf _snprintf
135 size_t strlcpy(char *, const char *, size_t);
136 int symlink(const char *pszDst
, const char *pszLink
);
137 int utimes(const char *pszPath
, const struct timeval
*paTimes
);
138 int writev(int fd
, const struct iovec
*vector
, int count
);
145 #define O_NONBLOCK 0 /// @todo
146 #define EWOULDBLOCK 512
147 int fcntl(int, int, ...);
148 int ioctl(int, unsigned long, ...);
149 pid_t
tcgetpgrp(int fd
);
154 typedef struct sigset
156 unsigned long __bitmap
[1];
158 typedef void __sighandler_t(int);
159 typedef void __siginfohandler_t(int, struct __siginfo
*, void *);
160 typedef __sighandler_t
*sig_t
; /** BSD 4.4 type. */
165 __siginfohandler_t
*__sa_sigaction
;
166 __sighandler_t
*__sa_handler
;
171 #define sa_handler __sigaction_u.__sa_handler
172 #define sa_sigaction __sigaction_u.__sa_sigaction
174 int sigprocmask(int, const sigset_t
*, sigset_t
*);
176 #define SIG_UNBLOCK 2
177 #define SIG_SETMASK 3
187 extern const char *const sys_siglist
[NSIG
]; /* NSIG == 23 */
189 int kill(pid_t
, int);
190 int sigaction(int, const struct sigaction
*, struct sigaction
*);
191 //int sigaddset(sigset_t *, int);
192 //int sigdelset(sigset_t *, int);
193 int sigemptyset(sigset_t
*);
194 //int sigfillset(sigset_t *);
195 //int sigismember(const sigset_t *, int);
196 //int sigpending(sigset_t *);
197 //int sigsuspend(const sigset_t *);
198 //int sigwait(const sigset_t *, int *);
199 int siginterrupt(int, int);
201 #endif /* _MSC_VER */