2 * Wine porting definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WINE_PORT_H
22 #define __WINE_WINE_PORT_H
24 #ifndef __WINE_CONFIG_H
25 # error You must include config.h to use this header
28 #ifdef __WINE_BASETSD_H
29 # error You must include port.h before all other headers
33 # define _GNU_SOURCE /* for pread/pwrite, isfinite */
37 #include <sys/types.h>
46 /****************************************************************
47 * Hard-coded values for the Windows platform
50 #if defined(_WIN32) && !defined(__CYGWIN__)
56 #define mkdir(path,mode) mkdir(path)
58 static inline void *dlopen(const char *name
, int flags
) { return NULL
; }
59 static inline void *dlsym(void *handle
, const char *name
) { return NULL
; }
60 static inline int dlclose(void *handle
) { return 0; }
61 static inline const char *dlerror(void) { return "No dlopen support on Windows"; }
66 #define pclose _pclose
67 /* The UCRT headers in the Windows SDK #error out if we #define snprintf.
68 * The C headers that came with previous Visual Studio versions do not have
69 * snprintf. Check for VS 2015, which appears to be the first version to
70 * use the UCRT headers by default. */
72 # define snprintf _snprintf
74 #define strtoll _strtoi64
75 #define strtoull _strtoui64
76 #define strncasecmp _strnicmp
77 #define strcasecmp _stricmp
88 # if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) || defined(_WIN64)
91 # define __int64 long long
95 /* Process creation flags */
100 # define _P_NOWAITO 3
103 #ifndef HAVE__SPAWNVP
104 extern int _spawnvp(int mode
, const char *cmdname
, const char * const argv
[]);
109 /****************************************************************
116 #define RTLD_LAZY 0x001
117 #define RTLD_NOW 0x002
118 #define RTLD_GLOBAL 0x100
122 # define S_ISLNK(mod) (0)
126 # define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR)
130 # define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR)
134 # define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
137 /* So we open files in 64 bit access mode on Linux */
139 # define O_LARGEFILE 0
143 # define O_NONBLOCK 0
151 /****************************************************************
156 #define M_PI 3.14159265358979323846
160 #define M_PI_2 1.570796326794896619
164 /****************************************************************
165 * Function definitions (only when using libwine_port)
168 #ifndef HAVE_GETOPT_LONG_ONLY
175 #ifndef HAVE_STRUCT_OPTION_NAME
185 extern int getopt_long (int ___argc
, char *const *___argv
,
186 const char *__shortopts
,
187 const struct option
*__longopts
, int *__longind
);
188 extern int getopt_long_only (int ___argc
, char *const *___argv
,
189 const char *__shortopts
,
190 const struct option
*__longopts
, int *__longind
);
191 #endif /* HAVE_GETOPT_LONG_ONLY */
194 int lstat(const char *file_name
, struct stat
*buf
);
195 #endif /* HAVE_LSTAT */
209 #define POLLNVAL 0x20
210 int poll( struct pollfd
*fds
, unsigned int count
, int timeout
);
211 #endif /* HAVE_POLL */
214 ssize_t
pread( int fd
, void *buf
, size_t count
, off_t offset
);
215 #endif /* HAVE_PREAD */
218 ssize_t
pwrite( int fd
, const void *buf
, size_t count
, off_t offset
);
219 #endif /* HAVE_PWRITE */
221 #ifndef HAVE_READLINK
222 int readlink( const char *path
, char *buf
, size_t size
);
223 #endif /* HAVE_READLINK */
226 int symlink(const char *from
, const char *to
);
229 extern int mkstemps(char *template, int suffix_len
);
231 #endif /* !defined(__WINE_WINE_PORT_H) */