1999-11-13 23:23:35 +01:00
|
|
|
/*
|
|
|
|
* Wine porting definitions
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 1996 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-11-13 23:23:35 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_WINE_PORT_H
|
|
|
|
#define __WINE_WINE_PORT_H
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h to use this header
|
|
|
|
#endif
|
2001-07-26 23:43:29 +02:00
|
|
|
|
2005-08-03 23:25:10 +02:00
|
|
|
#define _FILE_OFFSET_BITS 64
|
2002-01-07 22:00:27 +01:00
|
|
|
#define _GNU_SOURCE /* for pread/pwrite */
|
2001-05-16 21:45:34 +02:00
|
|
|
#include <fcntl.h>
|
2003-07-15 22:45:49 +02:00
|
|
|
#include <math.h>
|
1999-11-13 23:23:35 +01:00
|
|
|
#include <sys/types.h>
|
2000-12-06 21:20:11 +01:00
|
|
|
#include <sys/stat.h>
|
2002-03-11 06:08:38 +01:00
|
|
|
#ifdef HAVE_DIRECT_H
|
|
|
|
# include <direct.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
2003-10-14 07:27:43 +02:00
|
|
|
#ifdef HAVE_PROCESS_H
|
|
|
|
# include <process.h>
|
|
|
|
#endif
|
2002-03-11 06:08:38 +01:00
|
|
|
#include <string.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
1999-11-13 23:23:35 +01:00
|
|
|
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
/****************************************************************
|
|
|
|
* Type definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_MODE_T
|
|
|
|
typedef int mode_t;
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_OFF_T
|
|
|
|
typedef long off_t;
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_PID_T
|
|
|
|
typedef int pid_t;
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_SIZE_T
|
|
|
|
typedef unsigned int size_t;
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_SSIZE_T
|
|
|
|
typedef int ssize_t;
|
|
|
|
#endif
|
2004-03-05 22:03:46 +01:00
|
|
|
#ifndef HAVE_FSBLKCNT_T
|
|
|
|
typedef unsigned long fsblkcnt_t;
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_FSFILCNT_T
|
|
|
|
typedef unsigned long fsfilcnt_t;
|
|
|
|
#endif
|
2000-12-01 21:47:11 +01:00
|
|
|
|
2004-03-05 22:03:46 +01:00
|
|
|
#ifndef HAVE_STRUCT_STATVFS_F_BLOCKS
|
|
|
|
struct statvfs
|
|
|
|
{
|
|
|
|
unsigned long f_bsize;
|
|
|
|
unsigned long f_frsize;
|
|
|
|
fsblkcnt_t f_blocks;
|
|
|
|
fsblkcnt_t f_bfree;
|
|
|
|
fsblkcnt_t f_bavail;
|
|
|
|
fsfilcnt_t f_files;
|
|
|
|
fsfilcnt_t f_ffree;
|
|
|
|
fsfilcnt_t f_favail;
|
|
|
|
unsigned long f_fsid;
|
|
|
|
unsigned long f_flag;
|
|
|
|
unsigned long f_namemax;
|
1999-11-13 23:23:35 +01:00
|
|
|
};
|
2004-03-05 22:03:46 +01:00
|
|
|
#endif /* HAVE_STRUCT_STATVFS_F_BLOCKS */
|
1999-11-13 23:23:35 +01:00
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* Macro definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_DLFCN_H
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#else
|
|
|
|
#define RTLD_LAZY 0x001
|
|
|
|
#define RTLD_NOW 0x002
|
|
|
|
#define RTLD_GLOBAL 0x100
|
|
|
|
#endif
|
|
|
|
|
2002-05-05 23:03:44 +02:00
|
|
|
#if !defined(HAVE_FTRUNCATE) && defined(HAVE_CHSIZE)
|
|
|
|
#define ftruncate chsize
|
|
|
|
#endif
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
|
|
|
|
#define popen _popen
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
|
|
|
|
#define pclose _pclose
|
|
|
|
#endif
|
|
|
|
|
2002-05-10 03:33:40 +02:00
|
|
|
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
|
|
|
|
#define snprintf _snprintf
|
|
|
|
#endif
|
|
|
|
|
2003-01-14 20:35:03 +01:00
|
|
|
#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
|
|
|
|
#define vsnprintf _vsnprintf
|
|
|
|
#endif
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef S_ISLNK
|
|
|
|
# define S_ISLNK(mod) (0)
|
2004-04-23 01:45:47 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISSOCK
|
|
|
|
# define S_ISSOCK(mod) (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISDIR
|
|
|
|
# define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISCHR
|
|
|
|
# define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISFIFO
|
|
|
|
# define S_ISFIFO(mod) (((mod) & _S_IFMT) == _S_IFIFO)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISREG
|
|
|
|
# define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_IWUSR
|
|
|
|
# define S_IWUSR 0
|
|
|
|
#endif
|
2002-04-26 21:05:15 +02:00
|
|
|
|
|
|
|
/* So we open files in 64 bit access mode on Linux */
|
|
|
|
#ifndef O_LARGEFILE
|
|
|
|
# define O_LARGEFILE 0
|
|
|
|
#endif
|
|
|
|
|
2004-02-12 23:39:18 +01:00
|
|
|
#ifndef O_NONBLOCK
|
|
|
|
# define O_NONBLOCK 0
|
|
|
|
#endif
|
2003-07-15 22:45:49 +02:00
|
|
|
|
2004-04-23 01:45:47 +02:00
|
|
|
#ifndef O_BINARY
|
|
|
|
# define O_BINARY 0
|
|
|
|
#endif
|
|
|
|
|
2004-03-10 02:54:39 +01:00
|
|
|
#if !defined(S_IXUSR) && defined(S_IEXEC)
|
|
|
|
# define S_IXUSR S_IEXEC
|
|
|
|
#endif
|
|
|
|
#if !defined(S_IXGRP) && defined(S_IEXEC)
|
|
|
|
# define S_IXGRP S_IEXEC
|
|
|
|
#endif
|
|
|
|
#if !defined(S_IXOTH) && defined(S_IEXEC)
|
|
|
|
# define S_IXOTH S_IEXEC
|
|
|
|
#endif
|
|
|
|
|
2004-05-25 20:05:39 +02:00
|
|
|
|
2003-07-15 22:45:49 +02:00
|
|
|
/****************************************************************
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef M_PI_2
|
|
|
|
#define M_PI_2 1.570796326794896619
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
/* Macros to define assembler functions somewhat portably */
|
|
|
|
|
2004-10-05 20:31:21 +02:00
|
|
|
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__APPLE__)
|
2002-04-26 21:05:15 +02:00
|
|
|
# define __ASM_GLOBAL_FUNC(name,code) \
|
2004-05-28 21:30:25 +02:00
|
|
|
__asm__( ".text\n\t" \
|
|
|
|
".align 4\n\t" \
|
2002-04-26 21:05:15 +02:00
|
|
|
".globl " __ASM_NAME(#name) "\n\t" \
|
|
|
|
__ASM_FUNC(#name) "\n" \
|
|
|
|
__ASM_NAME(#name) ":\n\t" \
|
2004-05-28 21:30:25 +02:00
|
|
|
code \
|
|
|
|
"\n\t.previous" );
|
2004-06-14 19:00:38 +02:00
|
|
|
#else /* defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__) */
|
2002-04-26 21:05:15 +02:00
|
|
|
# define __ASM_GLOBAL_FUNC(name,code) \
|
|
|
|
void __asm_dummy_##name(void) { \
|
|
|
|
asm( ".align 4\n\t" \
|
|
|
|
".globl " __ASM_NAME(#name) "\n\t" \
|
|
|
|
__ASM_FUNC(#name) "\n" \
|
|
|
|
__ASM_NAME(#name) ":\n\t" \
|
|
|
|
code ); \
|
|
|
|
}
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
|
|
|
|
|
2003-12-04 06:48:03 +01:00
|
|
|
/* Register functions */
|
|
|
|
|
|
|
|
#ifdef __i386__
|
2005-05-07 20:10:30 +02:00
|
|
|
#define DEFINE_REGS_ENTRYPOINT( name, args, pop_args ) \
|
2003-12-04 06:48:03 +01:00
|
|
|
__ASM_GLOBAL_FUNC( name, \
|
2005-09-18 13:13:54 +02:00
|
|
|
"pushl %eax\n\t" \
|
2003-12-04 06:48:03 +01:00
|
|
|
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
|
2005-06-16 13:04:41 +02:00
|
|
|
".long " __ASM_NAME("__regs_") #name "-.\n\t" \
|
2003-12-04 06:48:03 +01:00
|
|
|
".byte " #args "," #pop_args )
|
|
|
|
/* FIXME: add support for other CPUs */
|
|
|
|
#endif /* __i386__ */
|
|
|
|
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
/****************************************************************
|
2003-03-20 23:06:16 +01:00
|
|
|
* Function definitions (only when using libwine_port)
|
2002-04-26 21:05:15 +02:00
|
|
|
*/
|
|
|
|
|
2003-03-20 22:07:49 +01:00
|
|
|
#ifndef NO_LIBWINE_PORT
|
1999-11-13 23:23:35 +01:00
|
|
|
|
2004-04-06 05:33:25 +02:00
|
|
|
#ifndef HAVE_FSTATVFS
|
|
|
|
int fstatvfs( int fd, struct statvfs *buf );
|
|
|
|
#endif
|
|
|
|
|
2003-03-19 23:44:55 +01:00
|
|
|
#ifndef HAVE_GETOPT_LONG
|
|
|
|
extern char *optarg;
|
|
|
|
extern int optind;
|
|
|
|
extern int opterr;
|
|
|
|
extern int optopt;
|
2003-04-20 04:56:14 +02:00
|
|
|
struct option;
|
2003-03-19 23:44:55 +01:00
|
|
|
|
2003-04-20 04:56:14 +02:00
|
|
|
#ifndef HAVE_STRUCT_OPTION_NAME
|
2003-03-19 23:44:55 +01:00
|
|
|
struct option
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int has_arg;
|
|
|
|
int *flag;
|
|
|
|
int val;
|
|
|
|
};
|
2003-04-20 04:56:14 +02:00
|
|
|
#endif
|
2003-03-19 23:44:55 +01:00
|
|
|
|
|
|
|
extern int getopt_long (int ___argc, char *const *___argv,
|
|
|
|
const char *__shortopts,
|
|
|
|
const struct option *__longopts, int *__longind);
|
|
|
|
extern int getopt_long_only (int ___argc, char *const *___argv,
|
|
|
|
const char *__shortopts,
|
|
|
|
const struct option *__longopts, int *__longind);
|
|
|
|
#endif /* HAVE_GETOPT_LONG */
|
|
|
|
|
2004-10-20 01:53:26 +02:00
|
|
|
#ifndef HAVE_FFS
|
|
|
|
int ffs( int x );
|
|
|
|
#endif
|
|
|
|
|
2004-10-07 06:25:05 +02:00
|
|
|
#ifndef HAVE_FUTIMES
|
2004-10-11 22:22:06 +02:00
|
|
|
struct timeval;
|
2004-10-07 06:25:05 +02:00
|
|
|
int futimes(int fd, const struct timeval tv[2]);
|
|
|
|
#endif
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef HAVE_GETPAGESIZE
|
|
|
|
size_t getpagesize(void);
|
|
|
|
#endif /* HAVE_GETPAGESIZE */
|
|
|
|
|
2003-11-12 04:16:00 +01:00
|
|
|
#ifndef HAVE_GETTID
|
|
|
|
pid_t gettid(void);
|
|
|
|
#endif /* HAVE_GETTID */
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef HAVE_LSTAT
|
|
|
|
int lstat(const char *file_name, struct stat *buf);
|
|
|
|
#endif /* HAVE_LSTAT */
|
|
|
|
|
1999-11-13 23:23:35 +01:00
|
|
|
#ifndef HAVE_MEMMOVE
|
2002-10-18 02:27:38 +02:00
|
|
|
void *memmove(void *dest, const void *src, size_t len);
|
1999-11-13 23:23:35 +01:00
|
|
|
#endif /* !defined(HAVE_MEMMOVE) */
|
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef HAVE_PREAD
|
|
|
|
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
|
|
|
|
#endif /* HAVE_PREAD */
|
2000-11-08 05:28:54 +01:00
|
|
|
|
2002-04-26 21:05:15 +02:00
|
|
|
#ifndef HAVE_PWRITE
|
|
|
|
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
|
|
|
|
#endif /* HAVE_PWRITE */
|
1999-11-13 23:23:35 +01:00
|
|
|
|
2004-01-08 06:07:05 +01:00
|
|
|
#ifndef HAVE_READLINK
|
|
|
|
int readlink( const char *path, char *buf, size_t size );
|
|
|
|
#endif /* HAVE_READLINK */
|
|
|
|
|
2003-11-12 04:16:00 +01:00
|
|
|
#ifndef HAVE_SIGSETJMP
|
|
|
|
# include <setjmp.h>
|
|
|
|
typedef jmp_buf sigjmp_buf;
|
|
|
|
int sigsetjmp( sigjmp_buf buf, int savesigs );
|
|
|
|
void siglongjmp( sigjmp_buf buf, int val );
|
|
|
|
#endif /* HAVE_SIGSETJMP */
|
|
|
|
|
2004-03-09 20:22:08 +01:00
|
|
|
#ifndef HAVE_STATVFS
|
|
|
|
int statvfs( const char *path, struct statvfs *buf );
|
|
|
|
#endif
|
|
|
|
|
1999-11-13 23:23:35 +01:00
|
|
|
#ifndef HAVE_STRNCASECMP
|
2002-03-11 06:08:38 +01:00
|
|
|
# ifndef HAVE__STRNICMP
|
1999-11-13 23:23:35 +01:00
|
|
|
int strncasecmp(const char *str1, const char *str2, size_t n);
|
2002-03-11 06:08:38 +01:00
|
|
|
# else
|
|
|
|
# define strncasecmp _strnicmp
|
|
|
|
# endif
|
1999-11-13 23:23:35 +01:00
|
|
|
#endif /* !defined(HAVE_STRNCASECMP) */
|
|
|
|
|
|
|
|
#ifndef HAVE_STRERROR
|
|
|
|
const char *strerror(int err);
|
|
|
|
#endif /* !defined(HAVE_STRERROR) */
|
|
|
|
|
|
|
|
#ifndef HAVE_STRCASECMP
|
2002-03-11 06:08:38 +01:00
|
|
|
# ifndef HAVE__STRICMP
|
1999-11-13 23:23:35 +01:00
|
|
|
int strcasecmp(const char *str1, const char *str2);
|
2002-03-11 06:08:38 +01:00
|
|
|
# else
|
|
|
|
# define strcasecmp _stricmp
|
|
|
|
# endif
|
1999-11-13 23:23:35 +01:00
|
|
|
#endif /* !defined(HAVE_STRCASECMP) */
|
|
|
|
|
|
|
|
#ifndef HAVE_USLEEP
|
|
|
|
int usleep (unsigned int useconds);
|
|
|
|
#endif /* !defined(HAVE_USLEEP) */
|
|
|
|
|
2002-10-18 02:27:38 +02:00
|
|
|
#ifdef __i386__
|
2003-08-26 01:45:34 +02:00
|
|
|
static inline void *memcpy_unaligned( void *dst, const void *src, size_t size )
|
2003-03-21 00:44:36 +01:00
|
|
|
{
|
|
|
|
return memcpy( dst, src, size );
|
|
|
|
}
|
2002-10-18 02:27:38 +02:00
|
|
|
#else
|
2003-03-21 00:44:36 +01:00
|
|
|
extern void *memcpy_unaligned( void *dst, const void *src, size_t size );
|
2002-10-18 02:27:38 +02:00
|
|
|
#endif /* __i386__ */
|
|
|
|
|
2003-03-20 22:07:49 +01:00
|
|
|
extern int mkstemps(char *template, int suffix_len);
|
|
|
|
|
2003-04-02 07:20:12 +02:00
|
|
|
/* Process creation flags */
|
|
|
|
#ifndef _P_WAIT
|
|
|
|
# define _P_WAIT 0
|
|
|
|
# define _P_NOWAIT 1
|
|
|
|
# define _P_OVERLAY 2
|
|
|
|
# define _P_NOWAITO 3
|
|
|
|
# define _P_DETACH 4
|
|
|
|
#endif
|
2003-09-24 20:54:40 +02:00
|
|
|
#ifndef HAVE_SPAWNVP
|
2003-10-15 05:35:54 +02:00
|
|
|
extern int spawnvp(int mode, const char *cmdname, const char * const argv[]);
|
2003-09-24 20:54:40 +02:00
|
|
|
#endif
|
2003-04-02 07:20:12 +02:00
|
|
|
|
2002-04-25 23:40:56 +02:00
|
|
|
/* Interlocked functions */
|
|
|
|
|
|
|
|
#if defined(__i386__) && defined(__GNUC__)
|
|
|
|
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare );
|
2005-01-11 11:46:58 +01:00
|
|
|
extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_xchg( int *dest, int val );
|
2005-01-11 11:46:58 +01:00
|
|
|
extern inline void *interlocked_xchg_ptr( void **dest, void *val );
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_xchg_add( int *dest, int incr );
|
2005-01-11 11:46:58 +01:00
|
|
|
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare )
|
2002-04-25 23:40:56 +02:00
|
|
|
{
|
2005-09-26 15:51:58 +02:00
|
|
|
int ret;
|
2002-04-25 23:40:56 +02:00
|
|
|
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
|
|
|
|
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-03-20 23:06:16 +01:00
|
|
|
extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare )
|
2002-04-25 23:40:56 +02:00
|
|
|
{
|
|
|
|
void *ret;
|
|
|
|
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
|
|
|
|
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_xchg( int *dest, int val )
|
2002-04-25 23:40:56 +02:00
|
|
|
{
|
2005-09-26 15:51:58 +02:00
|
|
|
int ret;
|
2002-04-25 23:40:56 +02:00
|
|
|
__asm__ __volatile__( "lock; xchgl %0,(%1)"
|
|
|
|
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-03-20 23:06:16 +01:00
|
|
|
extern inline void *interlocked_xchg_ptr( void **dest, void *val )
|
2002-04-25 23:40:56 +02:00
|
|
|
{
|
|
|
|
void *ret;
|
|
|
|
__asm__ __volatile__( "lock; xchgl %0,(%1)"
|
|
|
|
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-26 15:51:58 +02:00
|
|
|
extern inline int interlocked_xchg_add( int *dest, int incr )
|
2002-04-25 23:40:56 +02:00
|
|
|
{
|
2005-09-26 15:51:58 +02:00
|
|
|
int ret;
|
2002-04-25 23:40:56 +02:00
|
|
|
__asm__ __volatile__( "lock; xaddl %0,(%1)"
|
|
|
|
: "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* __i386___ && __GNUC__ */
|
|
|
|
|
2005-09-26 15:51:58 +02:00
|
|
|
extern int interlocked_cmpxchg( int *dest, int xchg, int compare );
|
2002-04-25 23:40:56 +02:00
|
|
|
extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
2005-09-26 15:51:58 +02:00
|
|
|
extern int interlocked_xchg( int *dest, int val );
|
2002-04-25 23:40:56 +02:00
|
|
|
extern void *interlocked_xchg_ptr( void **dest, void *val );
|
2005-09-26 15:51:58 +02:00
|
|
|
extern int interlocked_xchg_add( int *dest, int incr );
|
2002-04-25 23:40:56 +02:00
|
|
|
|
|
|
|
#endif /* __i386___ && __GNUC__ */
|
|
|
|
|
2003-03-20 22:07:49 +01:00
|
|
|
#else /* NO_LIBWINE_PORT */
|
2002-04-26 21:05:15 +02:00
|
|
|
|
|
|
|
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
|
|
|
|
2004-10-20 01:53:26 +02:00
|
|
|
#define ffs __WINE_NOT_PORTABLE(ffs)
|
2004-04-06 05:33:25 +02:00
|
|
|
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
|
2004-10-07 06:25:05 +02:00
|
|
|
#define futimes __WINE_NOT_PORTABLE(futimes)
|
2003-03-20 23:06:16 +01:00
|
|
|
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
|
|
|
|
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
|
|
|
|
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
|
|
|
|
#define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg)
|
|
|
|
#define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
|
|
|
|
#define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg)
|
|
|
|
#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
|
|
|
|
#define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add)
|
|
|
|
#define lstat __WINE_NOT_PORTABLE(lstat)
|
2003-03-21 00:44:36 +01:00
|
|
|
#define memcpy_unaligned __WINE_NOT_PORTABLE(memcpy_unaligned)
|
2005-11-04 12:14:22 +01:00
|
|
|
#undef memmove
|
2003-03-20 23:06:16 +01:00
|
|
|
#define memmove __WINE_NOT_PORTABLE(memmove)
|
|
|
|
#define pread __WINE_NOT_PORTABLE(pread)
|
|
|
|
#define pwrite __WINE_NOT_PORTABLE(pwrite)
|
2003-04-02 07:20:12 +02:00
|
|
|
#define spawnvp __WINE_NOT_PORTABLE(spawnvp)
|
2004-03-09 20:22:08 +01:00
|
|
|
#define statvfs __WINE_NOT_PORTABLE(statvfs)
|
2003-03-20 23:06:16 +01:00
|
|
|
#define strcasecmp __WINE_NOT_PORTABLE(strcasecmp)
|
|
|
|
#define strerror __WINE_NOT_PORTABLE(strerror)
|
|
|
|
#define strncasecmp __WINE_NOT_PORTABLE(strncasecmp)
|
|
|
|
#define usleep __WINE_NOT_PORTABLE(usleep)
|
2002-04-26 21:05:15 +02:00
|
|
|
|
2003-03-20 22:07:49 +01:00
|
|
|
#endif /* NO_LIBWINE_PORT */
|
2000-12-27 05:18:26 +01:00
|
|
|
|
1999-11-13 23:23:35 +01:00
|
|
|
#endif /* !defined(__WINE_WINE_PORT_H) */
|