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 67 #ifndef HAVE_FSBLKCNT_T 70 #ifndef HAVE_FSFILCNT_T 74 #ifndef HAVE_STRUCT_STATVFS_F_BLOCKS 99 #define RTLD_LAZY 0x001 100 #define RTLD_NOW 0x002 101 #define RTLD_GLOBAL 0x100 104 #if !defined(HAVE_FTRUNCATE) && defined(HAVE_CHSIZE) 105 #define ftruncate chsize 108 #if !defined(HAVE_POPEN) && defined(HAVE__POPEN) 112 #if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE) 113 #define pclose _pclose 116 #if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) 117 #define snprintf _snprintf 120 #if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF) 121 #define vsnprintf _vsnprintf 125 # define S_ISLNK(mod) (0) 129 # define S_ISSOCK(mod) (0) 133 # define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR) 137 # define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR) 141 # define S_ISFIFO(mod) (((mod) & _S_IFMT) == _S_IFIFO) 145 # define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG) 154 # define O_LARGEFILE 0 158 # define O_NONBLOCK 0 165 #if !defined(S_IXUSR) && defined(S_IEXEC) 166 # define S_IXUSR S_IEXEC 168 #if !defined(S_IXGRP) && defined(S_IEXEC) 169 # define S_IXGRP S_IEXEC 171 #if !defined(S_IXOTH) && defined(S_IEXEC) 172 # define S_IXOTH S_IEXEC 181 #define M_PI 3.14159265358979323846 185 #define M_PI_2 1.570796326794896619 191 #if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__APPLE__) 192 # define __ASM_GLOBAL_FUNC(name,code) \ 193 __asm__( ".text\n\t" \ 195 ".globl " __ASM_NAME(#name) "\n\t" \ 196 __ASM_FUNC(#name) "\n" \ 197 __ASM_NAME(#name) ":\n\t" \ 201 # define __ASM_GLOBAL_FUNC(name,code) \ 202 void __asm_dummy_##name(void) { \ 203 asm( ".align 4\n\t" \ 204 ".globl " __ASM_NAME(#name) "\n\t" \ 205 __ASM_FUNC(#name) "\n" \ 206 __ASM_NAME(#name) ":\n\t" \ 215 # define DECL_GLOBAL_CONSTRUCTOR(func) \ 216 static void func(void) __attribute__((constructor)); \ 217 static void func(void) 218 #elif defined(__i386__) 219 # define DECL_GLOBAL_CONSTRUCTOR(func) \ 220 static void __dummy_init_##func(void) { \ 221 asm(".section .init,\"ax\"\n\t" \ 222 "call " #func "\n\t" \ 224 static void func(void) 225 #elif defined(__sparc__) 226 # define DECL_GLOBAL_CONSTRUCTOR(func) \ 227 static void __dummy_init_##func(void) { \ 228 asm("\t.section \".init\",#alloc,#execinstr\n" \ 229 "\tcall " #func "\n" \ 231 "\t.section \".text\",#alloc,#execinstr\n" ); } \ 232 static void func(void) 234 # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform 241 #define DEFINE_REGS_ENTRYPOINT( name, fn, args, pop_args ) \ 242 __ASM_GLOBAL_FUNC( name, \ 243 "call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \ 244 ".long " __ASM_NAME(#fn) "\n\t" \ 245 ".byte " #args "," #pop_args ) 254 #ifndef NO_LIBWINE_PORT 256 #ifndef HAVE_FSTATVFS 260 #ifndef HAVE_GETOPT_LONG 267 #ifndef HAVE_STRUCT_OPTION_NAME 277 extern int getopt_long (
int ___argc,
char *
const *___argv,
278 const char *__shortopts,
279 const struct option *__longopts,
int *__longind);
281 const char *__shortopts,
282 const struct option *__longopts,
int *__longind);
294 #ifndef HAVE_GETPAGESIZE 318 #ifndef HAVE_READLINK 322 #ifndef HAVE_SIGSETJMP 333 #ifndef HAVE_STRNCASECMP 334 # ifndef HAVE__STRNICMP 335 int strncasecmp(
const char *str1,
const char *str2,
size_t n);
337 # define strncasecmp _strnicmp 341 #ifndef HAVE_STRERROR 345 #ifndef HAVE_STRCASECMP 346 # ifndef HAVE__STRICMP 347 int strcasecmp(
const char *str1,
const char *str2);
349 # define strcasecmp _stricmp 354 int usleep (
unsigned int useconds);
366 extern int mkstemps(
char *
template,
int suffix_len);
372 # define _P_OVERLAY 2 373 # define _P_NOWAITO 3 377 extern int spawnvp(
int mode,
const char *cmdname,
const char *
const argv[]);
382 #if defined(__i386__) && defined(__GNUC__) 393 __asm__ __volatile__(
"lock; cmpxchgl %2,(%1)" 394 :
"=a" (
ret) :
"r" (
dest),
"r" (xchg),
"0" (
compare) :
"memory" );
401 __asm__ __volatile__(
"lock; cmpxchgl %2,(%1)" 402 :
"=a" (
ret) :
"r" (
dest),
"r" (xchg),
"0" (
compare) :
"memory" );
409 __asm__ __volatile__(
"lock; xchgl %0,(%1)" 410 :
"=r" (
ret) :
"r" (
dest),
"0" (
val) :
"memory" );
417 __asm__ __volatile__(
"lock; xchgl %0,(%1)" 418 :
"=r" (
ret) :
"r" (
dest),
"0" (
val) :
"memory" );
425 __asm__ __volatile__(
"lock; xaddl %0,(%1)" 426 :
"=r" (
ret) :
"r" (
dest),
"0" (incr) :
"memory" );
442 #define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable 444 #define ffs __WINE_NOT_PORTABLE(ffs) 445 #define fstatvfs __WINE_NOT_PORTABLE(fstatvfs) 446 #define futimes __WINE_NOT_PORTABLE(futimes) 447 #define getopt_long __WINE_NOT_PORTABLE(getopt_long) 448 #define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only) 449 #define getpagesize __WINE_NOT_PORTABLE(getpagesize) 450 #define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg) 451 #define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr) 452 #define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg) 453 #define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr) 454 #define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add) 455 #define lstat __WINE_NOT_PORTABLE(lstat) 456 #define memcpy_unaligned __WINE_NOT_PORTABLE(memcpy_unaligned) 457 #define memmove __WINE_NOT_PORTABLE(memmove) 458 #define pread __WINE_NOT_PORTABLE(pread) 459 #define pwrite __WINE_NOT_PORTABLE(pwrite) 460 #define spawnvp __WINE_NOT_PORTABLE(spawnvp) 461 #define statvfs __WINE_NOT_PORTABLE(statvfs) 462 #define strcasecmp __WINE_NOT_PORTABLE(strcasecmp) 463 #define strerror __WINE_NOT_PORTABLE(strerror) 464 #define strncasecmp __WINE_NOT_PORTABLE(strncasecmp) 465 #define usleep __WINE_NOT_PORTABLE(usleep)
int fstatvfs(int fd, struct statvfs *buf)
int usleep(unsigned int useconds)
GLuint GLuint GLsizei count
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
long interlocked_xchg(long *dest, long val)
long interlocked_xchg_add(long *dest, long incr)
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
void * interlocked_xchg_ptr(void **dest, void *val)
GLint GLint GLint GLint GLint x
__asm__("\n\t \
NewInt3Handler:\n\t \
pushl $" STR(REASON_INT3) "\n\t \
// call debugger loop\n\t \
jmp NewInt31Handler\n\t \
")
int spawnvp(int mode, const char *cmdname, const char *const argv[])
void * interlocked_cmpxchg_ptr(void **dest, void *xchg, void *compare)
int getopt_long_only(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
const char * strerror(int err)
GLenum GLuint GLenum GLsizei const GLchar * buf
int strcasecmp(const char *str1, const char *str2)
void * memmove(void *dest, const void *src, size_t len)
int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind)
long interlocked_cmpxchg(long *dest, long xchg, long compare)
void siglongjmp(sigjmp_buf buf, int val)
int sigsetjmp(sigjmp_buf buf, int savesigs)
#define memcpy(s1, s2, n)
void * memcpy_unaligned(void *dst, const void *src, size_t size)
int mkstemps(char *template, int suffix_len)
int strncasecmp(const char *str1, const char *str2, size_t n)
int statvfs(const char *path, struct statvfs *buf)
int readlink(const char *path, char *buf, size_t size)
int futimes(int fd, const struct timeval tv[2])
int lstat(const char *file_name, struct stat *buf)