2 * Wine porting definitions
6 #ifndef __WINE_WINE_PORT_H
7 #define __WINE_WINE_PORT_H
12 #include <sys/types.h>
19 #ifndef HAVE_GETRLIMIT
20 #define RLIMIT_STACK 3
27 int getrlimit (int resource, struct rlimit *rlim);
28 #endif /* HAVE_GETRLIMIT */
30 #if !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME)
37 #endif /* !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) */
39 #if !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER)
45 #endif /* !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER) */
49 # define STATFS_HAS_BFREE
51 long f_bsize; /* block_size */
52 long f_blocks; /* total_blocks */
53 long f_bfree; /* free_blocks */
55 # else /* defined(__BEOS__) */
57 # endif /* defined(__BEOS__) */
58 #endif /* !defined(HAVE_STATFS) */
62 #if !defined(HAVE_CLONE) && defined(linux)
63 int clone(int (*fn)(void *arg), void *stack, int flags, void *arg);
64 #endif /* !defined(HAVE_CLONE) && defined(linux) */
66 #ifndef HAVE_GETNETBYADDR
67 struct netent *getnetbyaddr(unsigned long net, int type);
68 #endif /* defined(HAVE_GETNETBYNAME) */
70 #ifndef HAVE_GETNETBYNAME
71 struct netent *getnetbyname(const char *name);
72 #endif /* defined(HAVE_GETNETBYNAME) */
74 #ifndef HAVE_GETPROTOBYNAME
75 struct protoent *getprotobyname(const char *name);
76 #endif /* !defined(HAVE_GETPROTOBYNAME) */
78 #ifndef HAVE_GETPROTOBYNUMBER
79 struct protoent *getprotobynumber(int proto);
80 #endif /* !defined(HAVE_GETPROTOBYNUMBER) */
82 #ifndef HAVE_GETSERVBYPORT
83 struct servent *getservbyport(int port, const char *proto);
84 #endif /* !defined(HAVE_GETSERVBYPORT) */
86 #ifndef HAVE_GETSOCKOPT
87 int getsockopt(int socket, int level, int option_name, void *option_value, size_t *option_len);
88 #endif /* !defined(HAVE_GETSOCKOPT) */
91 void *memmove(void *dest, const void *src, unsigned int len);
92 #endif /* !defined(HAVE_MEMMOVE) */
94 #ifndef HAVE_GETPAGESIZE
95 size_t getpagesize(void);
96 #endif /* HAVE_GETPAGESIZE */
98 #ifndef HAVE_INET_NETWORK
99 unsigned long inet_network(const char *cp);
100 #endif /* !defined(HAVE_INET_NETWORK) */
102 #ifndef HAVE_SETTIMEOFDAY
103 int settimeofday(struct timeval *tp, void *reserved);
104 #endif /* !defined(HAVE_SETTIMEOFDAY) */
107 int statfs(const char *name, struct statfs *info);
108 #endif /* !defined(HAVE_STATFS) */
110 #ifndef HAVE_STRNCASECMP
111 int strncasecmp(const char *str1, const char *str2, size_t n);
112 #endif /* !defined(HAVE_STRNCASECMP) */
114 #ifndef HAVE_STRERROR
115 const char *strerror(int err);
116 #endif /* !defined(HAVE_STRERROR) */
118 #ifndef HAVE_STRCASECMP
119 int strcasecmp(const char *str1, const char *str2);
120 #endif /* !defined(HAVE_STRCASECMP) */
123 int usleep (unsigned int useconds);
124 #endif /* !defined(HAVE_USLEEP) */
127 int lstat(const char *file_name, struct stat *buf);
128 #endif /* HAVE_LSTAT */
131 #define S_ISLNK(mod) (0)
134 /* So we open files in 64 bit access mode on Linux */
136 # define O_LARGEFILE 0
139 extern void *wine_dlopen( const char *filename, int flag, char *error, int errorsize );
140 extern void *wine_dlsym( void *handle, const char *symbol, char *error, int errorsize );
141 extern int wine_dlclose( void *handle, char *error, int errorsize );
146 #define RTLD_LAZY 0x001
147 #define RTLD_NOW 0x002
148 #define RTLD_GLOBAL 0x100
152 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
154 #define PUT_WORD(ptr, w) (*(WORD *)(ptr) = (w))
155 #define GET_WORD(ptr) (*(WORD *)(ptr))
156 #define PUT_DWORD(ptr, d) (*(DWORD *)(ptr) = (d))
157 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
159 #define PUT_LE_WORD(ptr, w) \
160 do { ((BYTE *)(ptr))[0] = LOBYTE(w); \
161 ((BYTE *)(ptr))[1] = HIBYTE(w); } while (0)
162 #define GET_LE_WORD(ptr) \
163 MAKEWORD( ((BYTE *)(ptr))[0], \
165 #define PUT_LE_DWORD(ptr, d) \
166 do { PUT_LE_WORD(&((WORD *)(ptr))[0], LOWORD(d)); \
167 PUT_LE_WORD(&((WORD *)(ptr))[1], HIWORD(d)); } while (0)
168 #define GET_LE_DWORD(ptr) \
169 ((DWORD)MAKELONG( GET_LE_WORD(&((WORD *)(ptr))[0]), \
170 GET_LE_WORD(&((WORD *)(ptr))[1]) ))
172 #define PUT_BE_WORD(ptr, w) \
173 do { ((BYTE *)(ptr))[1] = LOBYTE(w); \
174 ((BYTE *)(ptr))[0] = HIBYTE(w); } while (0)
175 #define GET_BE_WORD(ptr) \
176 MAKEWORD( ((BYTE *)(ptr))[1], \
178 #define PUT_BE_DWORD(ptr, d) \
179 do { PUT_BE_WORD(&((WORD *)(ptr))[1], LOWORD(d)); \
180 PUT_BE_WORD(&((WORD *)(ptr))[0], HIWORD(d)); } while (0)
181 #define GET_BE_DWORD(ptr) \
182 ((DWORD)MAKELONG( GET_BE_WORD(&((WORD *)(ptr))[1]), \
183 GET_BE_WORD(&((WORD *)(ptr))[0]) ))
185 #if defined(ALLOW_UNALIGNED_ACCESS)
186 #define PUT_UA_WORD(ptr, w) PUT_WORD(ptr, w)
187 #define GET_UA_WORD(ptr) GET_WORD(ptr)
188 #define PUT_UA_DWORD(ptr, d) PUT_DWORD(ptr, d)
189 #define GET_UA_DWORD(ptr) GET_DWORD(ptr)
190 #elif defined(WORDS_BIGENDIAN)
191 #define PUT_UA_WORD(ptr, w) PUT_BE_WORD(ptr, w)
192 #define GET_UA_WORD(ptr) GET_BE_WORD(ptr)
193 #define PUT_UA_DWORD(ptr, d) PUT_BE_DWORD(ptr, d)
194 #define GET_UA_DWORD(ptr) GET_BE_DWORD(ptr)
196 #define PUT_UA_WORD(ptr, w) PUT_LE_WORD(ptr, w)
197 #define GET_UA_WORD(ptr) GET_LE_WORD(ptr)
198 #define PUT_UA_DWORD(ptr, d) PUT_LE_DWORD(ptr, d)
199 #define GET_UA_DWORD(ptr) GET_LE_DWORD(ptr)
202 #endif /* !defined(__WINE_WINE_PORT_H) */