diff options
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r-- | src/include/plibc.h | 1102 |
1 files changed, 551 insertions, 551 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h index ec4acc1e..5eac9945 100644 --- a/src/include/plibc.h +++ b/src/include/plibc.h | |||
@@ -1,551 +1,551 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PlibC. | 2 | This file is part of PlibC. |
3 | (C) 2005 Nils Durner (and other contributing authors) | 3 | (C) 2005 Nils Durner (and other contributing authors) |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. | 8 | version 2.1 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with this library; if not, write to the Free Software | 16 | License along with this library; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @file include/plibc.h | 21 | * @file include/plibc.h |
22 | * @brief PlibC header | 22 | * @brief PlibC header |
23 | * @attention This file is usually not installed under Unix, | 23 | * @attention This file is usually not installed under Unix, |
24 | * so ship it with your application | 24 | * so ship it with your application |
25 | * @version $Revision: 1.26 $ | 25 | * @version $Revision: 1.27 $ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _PLIBC_H_ | 28 | #ifndef _PLIBC_H_ |
29 | #define _PLIBC_H_ | 29 | #define _PLIBC_H_ |
30 | 30 | ||
31 | #ifndef SIGALRM | 31 | #ifndef SIGALRM |
32 | #define SIGALRM 14 | 32 | #define SIGALRM 14 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #if ENABLE_NLS | 35 | #ifdef __cplusplus |
36 | #include "langinfo.h" | 36 | extern "C" { |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #ifdef __cplusplus | 39 | #ifdef WINDOWS |
40 | extern "C" { | 40 | |
41 | #endif | 41 | #if ENABLE_NLS |
42 | 42 | #include "langinfo.h" | |
43 | #ifdef WINDOWS | 43 | #endif |
44 | 44 | ||
45 | #include <windows.h> | 45 | #include <windows.h> |
46 | #include <Ws2tcpip.h> | 46 | #include <Ws2tcpip.h> |
47 | #include <time.h> | 47 | #include <time.h> |
48 | #include <stdio.h> | 48 | #include <stdio.h> |
49 | #include <sys/types.h> | 49 | #include <sys/types.h> |
50 | #include <sys/stat.h> | 50 | #include <sys/stat.h> |
51 | #include <dirent.h> | 51 | #include <dirent.h> |
52 | #include <errno.h> | 52 | #include <errno.h> |
53 | 53 | ||
54 | #define __BYTE_ORDER BYTE_ORDER | 54 | #define __BYTE_ORDER BYTE_ORDER |
55 | #define __BIG_ENDIAN BIG_ENDIAN | 55 | #define __BIG_ENDIAN BIG_ENDIAN |
56 | 56 | ||
57 | /* Conflicts with our definitions */ | 57 | /* Conflicts with our definitions */ |
58 | #define __G_WIN32_H__ | 58 | #define __G_WIN32_H__ |
59 | 59 | ||
60 | /* Convert LARGE_INTEGER to double */ | 60 | /* Convert LARGE_INTEGER to double */ |
61 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | 61 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ |
62 | (double)((x).LowPart)) | 62 | (double)((x).LowPart)) |
63 | 63 | ||
64 | #define socklen_t int | 64 | #define socklen_t int |
65 | #define ssize_t int | 65 | #define ssize_t int |
66 | #ifndef HAVE_FTRUNCATE | 66 | #ifndef HAVE_FTRUNCATE |
67 | #define ftruncate chsize | 67 | #define ftruncate chsize |
68 | #endif | 68 | #endif |
69 | #define off_t int | 69 | #define off_t int |
70 | #define int64_t long long | 70 | #define int64_t long long |
71 | #define int32_t long | 71 | #define int32_t long |
72 | 72 | ||
73 | #ifndef pid_t | 73 | #ifndef pid_t |
74 | #define pid_t int | 74 | #define pid_t int |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifndef WEXITSTATUS | 77 | #ifndef WEXITSTATUS |
78 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | 78 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | /* Thanks to the Cygwin project */ | 81 | /* Thanks to the Cygwin project */ |
82 | #define ENOCSI 43 /* No CSI structure available */ | 82 | #define ENOCSI 43 /* No CSI structure available */ |
83 | #define EL2HLT 44 /* Level 2 halted */ | 83 | #define EL2HLT 44 /* Level 2 halted */ |
84 | #ifndef EDEADLK | 84 | #ifndef EDEADLK |
85 | #define EDEADLK 45 /* Deadlock condition */ | 85 | #define EDEADLK 45 /* Deadlock condition */ |
86 | #endif | 86 | #endif |
87 | #ifndef ENOLCK | 87 | #ifndef ENOLCK |
88 | #define ENOLCK 46 /* No record locks available */ | 88 | #define ENOLCK 46 /* No record locks available */ |
89 | #endif | 89 | #endif |
90 | #define EBADE 50 /* Invalid exchange */ | 90 | #define EBADE 50 /* Invalid exchange */ |
91 | #define EBADR 51 /* Invalid request descriptor */ | 91 | #define EBADR 51 /* Invalid request descriptor */ |
92 | #define EXFULL 52 /* Exchange full */ | 92 | #define EXFULL 52 /* Exchange full */ |
93 | #define ENOANO 53 /* No anode */ | 93 | #define ENOANO 53 /* No anode */ |
94 | #define EBADRQC 54 /* Invalid request code */ | 94 | #define EBADRQC 54 /* Invalid request code */ |
95 | #define EBADSLT 55 /* Invalid slot */ | 95 | #define EBADSLT 55 /* Invalid slot */ |
96 | #ifndef EDEADLOCK | 96 | #ifndef EDEADLOCK |
97 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | 97 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ |
98 | #endif | 98 | #endif |
99 | #define EBFONT 57 /* Bad font file fmt */ | 99 | #define EBFONT 57 /* Bad font file fmt */ |
100 | #define ENOSTR 60 /* Device not a stream */ | 100 | #define ENOSTR 60 /* Device not a stream */ |
101 | #define ENODATA 61 /* No data (for no delay io) */ | 101 | #define ENODATA 61 /* No data (for no delay io) */ |
102 | #define ETIME 62 /* Timer expired */ | 102 | #define ETIME 62 /* Timer expired */ |
103 | #define ENOSR 63 /* Out of streams resources */ | 103 | #define ENOSR 63 /* Out of streams resources */ |
104 | #define ENONET 64 /* Machine is not on the network */ | 104 | #define ENONET 64 /* Machine is not on the network */ |
105 | #define ENOPKG 65 /* Package not installed */ | 105 | #define ENOPKG 65 /* Package not installed */ |
106 | #define EREMOTE 66 /* The object is remote */ | 106 | #define EREMOTE 66 /* The object is remote */ |
107 | #define ENOLINK 67 /* The link has been severed */ | 107 | #define ENOLINK 67 /* The link has been severed */ |
108 | #define EADV 68 /* Advertise error */ | 108 | #define EADV 68 /* Advertise error */ |
109 | #define ESRMNT 69 /* Srmount error */ | 109 | #define ESRMNT 69 /* Srmount error */ |
110 | #define ECOMM 70 /* Communication error on send */ | 110 | #define ECOMM 70 /* Communication error on send */ |
111 | #define EPROTO 71 /* Protocol error */ | 111 | #define EPROTO 71 /* Protocol error */ |
112 | #define EMULTIHOP 74 /* Multihop attempted */ | 112 | #define EMULTIHOP 74 /* Multihop attempted */ |
113 | #define ELBIN 75 /* Inode is remote (not really error) */ | 113 | #define ELBIN 75 /* Inode is remote (not really error) */ |
114 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 114 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
115 | #define EBADMSG 77 /* Trying to read unreadable message */ | 115 | #define EBADMSG 77 /* Trying to read unreadable message */ |
116 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 116 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
117 | #define EBADFD 81 /* f.d. invalid for this operation */ | 117 | #define EBADFD 81 /* f.d. invalid for this operation */ |
118 | #define EREMCHG 82 /* Remote address changed */ | 118 | #define EREMCHG 82 /* Remote address changed */ |
119 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 119 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
120 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 120 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
121 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 121 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
122 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 122 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
123 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 123 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
124 | #ifndef ENOSYS | 124 | #ifndef ENOSYS |
125 | #define ENOSYS 88 /* Function not implemented */ | 125 | #define ENOSYS 88 /* Function not implemented */ |
126 | #endif | 126 | #endif |
127 | #define ENMFILE 89 /* No more files */ | 127 | #define ENMFILE 89 /* No more files */ |
128 | #ifndef ENOTEMPTY | 128 | #ifndef ENOTEMPTY |
129 | #define ENOTEMPTY 90 /* Directory not empty */ | 129 | #define ENOTEMPTY 90 /* Directory not empty */ |
130 | #endif | 130 | #endif |
131 | #ifndef ENAMETOOLONG | 131 | #ifndef ENAMETOOLONG |
132 | #define ENAMETOOLONG 91 /* File or path name too long */ | 132 | #define ENAMETOOLONG 91 /* File or path name too long */ |
133 | #endif | 133 | #endif |
134 | #define ELOOP 92 /* Too many symbolic links */ | 134 | #define ELOOP 92 /* Too many symbolic links */ |
135 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 135 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
136 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 136 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
137 | #define ECONNRESET 104 /* Connection reset by peer */ | 137 | #define ECONNRESET 104 /* Connection reset by peer */ |
138 | #define ENOBUFS 105 /* No buffer space available */ | 138 | #define ENOBUFS 105 /* No buffer space available */ |
139 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 139 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
140 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 140 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
141 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 141 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
142 | #define ENOPROTOOPT 109 /* Protocol not available */ | 142 | #define ENOPROTOOPT 109 /* Protocol not available */ |
143 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 143 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
144 | #define ECONNREFUSED 111 /* Connection refused */ | 144 | #define ECONNREFUSED 111 /* Connection refused */ |
145 | #define EADDRINUSE 112 /* Address already in use */ | 145 | #define EADDRINUSE 112 /* Address already in use */ |
146 | #define ECONNABORTED 113 /* Connection aborted */ | 146 | #define ECONNABORTED 113 /* Connection aborted */ |
147 | #define ENETUNREACH 114 /* Network is unreachable */ | 147 | #define ENETUNREACH 114 /* Network is unreachable */ |
148 | #define ENETDOWN 115 /* Network interface is not configured */ | 148 | #define ENETDOWN 115 /* Network interface is not configured */ |
149 | #ifndef ETIMEDOUT | 149 | #ifndef ETIMEDOUT |
150 | #define ETIMEDOUT 116 /* Connection timed out */ | 150 | #define ETIMEDOUT 116 /* Connection timed out */ |
151 | #endif | 151 | #endif |
152 | #define EHOSTDOWN 117 /* Host is down */ | 152 | #define EHOSTDOWN 117 /* Host is down */ |
153 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 153 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
154 | #define EINPROGRESS 119 /* Connection already in progress */ | 154 | #define EINPROGRESS 119 /* Connection already in progress */ |
155 | #define EALREADY 120 /* Socket already connected */ | 155 | #define EALREADY 120 /* Socket already connected */ |
156 | #define EDESTADDRREQ 121 /* Destination address required */ | 156 | #define EDESTADDRREQ 121 /* Destination address required */ |
157 | #define EMSGSIZE 122 /* Message too long */ | 157 | #define EMSGSIZE 122 /* Message too long */ |
158 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 158 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
159 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 159 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
160 | #define EADDRNOTAVAIL 125 /* Address not available */ | 160 | #define EADDRNOTAVAIL 125 /* Address not available */ |
161 | #define ENETRESET 126 /* Connection aborted by network */ | 161 | #define ENETRESET 126 /* Connection aborted by network */ |
162 | #define EISCONN 127 /* Socket is already connected */ | 162 | #define EISCONN 127 /* Socket is already connected */ |
163 | #define ENOTCONN 128 /* Socket is not connected */ | 163 | #define ENOTCONN 128 /* Socket is not connected */ |
164 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | 164 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ |
165 | #define EPROCLIM 130 /* Too many processes */ | 165 | #define EPROCLIM 130 /* Too many processes */ |
166 | #define EUSERS 131 /* Too many users */ | 166 | #define EUSERS 131 /* Too many users */ |
167 | #define EDQUOT 132 /* Disk quota exceeded */ | 167 | #define EDQUOT 132 /* Disk quota exceeded */ |
168 | #define ESTALE 133 /* Unknown error */ | 168 | #define ESTALE 133 /* Unknown error */ |
169 | #ifndef ENOTSUP | 169 | #ifndef ENOTSUP |
170 | #define ENOTSUP 134 /* Not supported */ | 170 | #define ENOTSUP 134 /* Not supported */ |
171 | #endif | 171 | #endif |
172 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 172 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
173 | #define ENOSHARE 136 /* No such host or network path */ | 173 | #define ENOSHARE 136 /* No such host or network path */ |
174 | #define ECASECLASH 137 /* Filename exists with different case */ | 174 | #define ECASECLASH 137 /* Filename exists with different case */ |
175 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 175 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
176 | 176 | ||
177 | #undef HOST_NOT_FOUND | 177 | #undef HOST_NOT_FOUND |
178 | #define HOST_NOT_FOUND 1 | 178 | #define HOST_NOT_FOUND 1 |
179 | #undef TRY_AGAIN | 179 | #undef TRY_AGAIN |
180 | #define TRY_AGAIN 2 | 180 | #define TRY_AGAIN 2 |
181 | #undef NO_RECOVERY | 181 | #undef NO_RECOVERY |
182 | #define NO_RECOVERY 3 | 182 | #define NO_RECOVERY 3 |
183 | #undef NO_ADDRESS | 183 | #undef NO_ADDRESS |
184 | #define NO_ADDRESS 4 | 184 | #define NO_ADDRESS 4 |
185 | 185 | ||
186 | #define PROT_READ 0x1 | 186 | #define PROT_READ 0x1 |
187 | #define PROT_WRITE 0x2 | 187 | #define PROT_WRITE 0x2 |
188 | #define MAP_SHARED 0x1 | 188 | #define MAP_SHARED 0x1 |
189 | #define MAP_PRIVATE 0x2 /* unsupported */ | 189 | #define MAP_PRIVATE 0x2 /* unsupported */ |
190 | #define MAP_FIXED 0x10 | 190 | #define MAP_FIXED 0x10 |
191 | 191 | ||
192 | struct statfs | 192 | struct statfs |
193 | { | 193 | { |
194 | long f_type; /* type of filesystem (see below) */ | 194 | long f_type; /* type of filesystem (see below) */ |
195 | long f_bsize; /* optimal transfer block size */ | 195 | long f_bsize; /* optimal transfer block size */ |
196 | long f_blocks; /* total data blocks in file system */ | 196 | long f_blocks; /* total data blocks in file system */ |
197 | long f_bfree; /* free blocks in fs */ | 197 | long f_bfree; /* free blocks in fs */ |
198 | long f_bavail; /* free blocks avail to non-superuser */ | 198 | long f_bavail; /* free blocks avail to non-superuser */ |
199 | long f_files; /* total file nodes in file system */ | 199 | long f_files; /* total file nodes in file system */ |
200 | long f_ffree; /* free file nodes in fs */ | 200 | long f_ffree; /* free file nodes in fs */ |
201 | long f_fsid; /* file system id */ | 201 | long f_fsid; /* file system id */ |
202 | long f_namelen; /* maximum length of filenames */ | 202 | long f_namelen; /* maximum length of filenames */ |
203 | long f_spare[6]; /* spare for later */ | 203 | long f_spare[6]; /* spare for later */ |
204 | }; | 204 | }; |
205 | 205 | ||
206 | /* Taken from the Wine project <http://www.winehq.org> | 206 | /* Taken from the Wine project <http://www.winehq.org> |
207 | /wine/include/winternl.h */ | 207 | /wine/include/winternl.h */ |
208 | enum SYSTEM_INFORMATION_CLASS | 208 | enum SYSTEM_INFORMATION_CLASS |
209 | { | 209 | { |
210 | SystemBasicInformation = 0, | 210 | SystemBasicInformation = 0, |
211 | Unknown1, | 211 | Unknown1, |
212 | SystemPerformanceInformation = 2, | 212 | SystemPerformanceInformation = 2, |
213 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | 213 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ |
214 | Unknown4, | 214 | Unknown4, |
215 | SystemProcessInformation = 5, | 215 | SystemProcessInformation = 5, |
216 | Unknown6, | 216 | Unknown6, |
217 | Unknown7, | 217 | Unknown7, |
218 | SystemProcessorPerformanceInformation = 8, | 218 | SystemProcessorPerformanceInformation = 8, |
219 | Unknown9, | 219 | Unknown9, |
220 | Unknown10, | 220 | Unknown10, |
221 | SystemDriverInformation, | 221 | SystemDriverInformation, |
222 | Unknown12, | 222 | Unknown12, |
223 | Unknown13, | 223 | Unknown13, |
224 | Unknown14, | 224 | Unknown14, |
225 | Unknown15, | 225 | Unknown15, |
226 | SystemHandleList, | 226 | SystemHandleList, |
227 | Unknown17, | 227 | Unknown17, |
228 | Unknown18, | 228 | Unknown18, |
229 | Unknown19, | 229 | Unknown19, |
230 | Unknown20, | 230 | Unknown20, |
231 | SystemCacheInformation, | 231 | SystemCacheInformation, |
232 | Unknown22, | 232 | Unknown22, |
233 | SystemInterruptInformation = 23, | 233 | SystemInterruptInformation = 23, |
234 | SystemExceptionInformation = 33, | 234 | SystemExceptionInformation = 33, |
235 | SystemRegistryQuotaInformation = 37, | 235 | SystemRegistryQuotaInformation = 37, |
236 | SystemLookasideInformation = 45 | 236 | SystemLookasideInformation = 45 |
237 | }; | 237 | }; |
238 | 238 | ||
239 | typedef struct | 239 | typedef struct |
240 | { | 240 | { |
241 | LARGE_INTEGER IdleTime; | 241 | LARGE_INTEGER IdleTime; |
242 | LARGE_INTEGER KernelTime; | 242 | LARGE_INTEGER KernelTime; |
243 | LARGE_INTEGER UserTime; | 243 | LARGE_INTEGER UserTime; |
244 | LARGE_INTEGER Reserved1[2]; | 244 | LARGE_INTEGER Reserved1[2]; |
245 | ULONG Reserved2; | 245 | ULONG Reserved2; |
246 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | 246 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; |
247 | 247 | ||
248 | #define sleep(secs) (Sleep(secs * 1000)) | 248 | #define sleep(secs) (Sleep(secs * 1000)) |
249 | 249 | ||
250 | /*********************** statfs *****************************/ | 250 | /*********************** statfs *****************************/ |
251 | /* fake block size */ | 251 | /* fake block size */ |
252 | #define FAKED_BLOCK_SIZE 512 | 252 | #define FAKED_BLOCK_SIZE 512 |
253 | 253 | ||
254 | /* linux-compatible values for fs type */ | 254 | /* linux-compatible values for fs type */ |
255 | #define MSDOS_SUPER_MAGIC 0x4d44 | 255 | #define MSDOS_SUPER_MAGIC 0x4d44 |
256 | #define NTFS_SUPER_MAGIC 0x5346544E | 256 | #define NTFS_SUPER_MAGIC 0x5346544E |
257 | 257 | ||
258 | /*********************** End of statfs ***********************/ | 258 | /*********************** End of statfs ***********************/ |
259 | 259 | ||
260 | #define SHUT_RDWR SD_BOTH | 260 | #define SHUT_RDWR SD_BOTH |
261 | 261 | ||
262 | /* Operations for flock() */ | 262 | /* Operations for flock() */ |
263 | #define LOCK_SH 1 /* shared lock */ | 263 | #define LOCK_SH 1 /* shared lock */ |
264 | #define LOCK_EX 2 /* exclusive lock */ | 264 | #define LOCK_EX 2 /* exclusive lock */ |
265 | #define LOCK_NB 4 /* or'd with one of the above to prevent | 265 | #define LOCK_NB 4 /* or'd with one of the above to prevent |
266 | blocking */ | 266 | blocking */ |
267 | #define LOCK_UN 8 /* remove lock */ | 267 | #define LOCK_UN 8 /* remove lock */ |
268 | 268 | ||
269 | /* Not supported under MinGW */ | 269 | /* Not supported under MinGW */ |
270 | #define S_IRGRP 0 | 270 | #define S_IRGRP 0 |
271 | #define S_IWGRP 0 | 271 | #define S_IWGRP 0 |
272 | #define S_IROTH 0 | 272 | #define S_IROTH 0 |
273 | #define S_IXGRP 0 | 273 | #define S_IXGRP 0 |
274 | #define S_IWOTH 0 | 274 | #define S_IWOTH 0 |
275 | #define S_IXOTH 0 | 275 | #define S_IXOTH 0 |
276 | #define S_ISUID 0 | 276 | #define S_ISUID 0 |
277 | #define S_ISGID 0 | 277 | #define S_ISGID 0 |
278 | #define S_ISVTX 0 | 278 | #define S_ISVTX 0 |
279 | #define S_IRWXG 0 | 279 | #define S_IRWXG 0 |
280 | #define S_IRWXO 0 | 280 | #define S_IRWXO 0 |
281 | 281 | ||
282 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) | 282 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) |
283 | 283 | ||
284 | /** | 284 | /** |
285 | * @brief index() - same as strchr() | 285 | * @brief index() - same as strchr() |
286 | */ | 286 | */ |
287 | #define index(s, c) strchr(s, c) | 287 | #define index(s, c) strchr(s, c) |
288 | 288 | ||
289 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | 289 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); |
290 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | 290 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); |
291 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | 291 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); |
292 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | 292 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); |
293 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, | 293 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, |
294 | char *pszBuffer, long *pdLength); | 294 | char *pszBuffer, long *pdLength); |
295 | 295 | ||
296 | BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); | 296 | BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle); |
297 | void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); | 297 | void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking); |
298 | void __win_DiscardHandleBlockingMode(SOCKET s); | 298 | void __win_DiscardHandleBlockingMode(SOCKET s); |
299 | int _win_isSocketValid(int s); | 299 | int _win_isSocketValid(int s); |
300 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 300 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); |
301 | 301 | ||
302 | typedef void (*TPanicProc) (int, char *); | 302 | typedef void (*TPanicProc) (int, char *); |
303 | void plibc_set_panic_proc(TPanicProc proc); | 303 | void plibc_set_panic_proc(TPanicProc proc); |
304 | 304 | ||
305 | int flock(int fd, int operation); | 305 | int flock(int fd, int operation); |
306 | int fsync(int fildes); | 306 | int fsync(int fildes); |
307 | int inet_pton(int af, const char *src, void *dst); | 307 | int inet_pton(int af, const char *src, void *dst); |
308 | int inet_pton4(const char *src, u_char *dst, int pton); | 308 | int inet_pton4(const char *src, u_char *dst, int pton); |
309 | #if USE_IPV6 | 309 | #if USE_IPV6 |
310 | int inet_pton6(const char *src, u_char *dst); | 310 | int inet_pton6(const char *src, u_char *dst); |
311 | #endif | 311 | #endif |
312 | int truncate(const char *fname, int distance); | 312 | int truncate(const char *fname, int distance); |
313 | int statfs(const char *path, struct statfs *buf); | 313 | int statfs(const char *path, struct statfs *buf); |
314 | const char *hstrerror(int err); | 314 | const char *hstrerror(int err); |
315 | void gettimeofday(struct timeval *tp, void *tzp); | 315 | void gettimeofday(struct timeval *tp, void *tzp); |
316 | int mkstemp(char *tmplate); | 316 | int mkstemp(char *tmplate); |
317 | char *strptime (const char *buf, const char *format, struct tm *tm); | 317 | char *strptime (const char *buf, const char *format, struct tm *tm); |
318 | char *ctime(const time_t *clock); | 318 | char *ctime(const time_t *clock); |
319 | char *ctime_r(const time_t *clock, char *buf); | 319 | char *ctime_r(const time_t *clock, char *buf); |
320 | int plibc_init(char *pszOrg, char *pszApp); | 320 | int plibc_init(char *pszOrg, char *pszApp); |
321 | void plibc_shutdown(); | 321 | void plibc_shutdown(); |
322 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | 322 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); |
323 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | 323 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); |
324 | void SetErrnoFromWinsockError(long lWinError); | 324 | void SetErrnoFromWinsockError(long lWinError); |
325 | void SetHErrnoFromWinError(long lWinError); | 325 | void SetHErrnoFromWinError(long lWinError); |
326 | void SetErrnoFromHRESULT(HRESULT hRes); | 326 | void SetErrnoFromHRESULT(HRESULT hRes); |
327 | FILE *_win_fopen(const char *filename, const char *mode); | 327 | FILE *_win_fopen(const char *filename, const char *mode); |
328 | DIR *_win_opendir(const char *dirname); | 328 | DIR *_win_opendir(const char *dirname); |
329 | int _win_open(const char *filename, int oflag, ...); | 329 | int _win_open(const char *filename, int oflag, ...); |
330 | #ifdef ENABLE_NLS | 330 | #ifdef ENABLE_NLS |
331 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | 331 | char *_win_bindtextdomain(const char *domainname, const char *dirname); |
332 | #endif | 332 | #endif |
333 | int _win_chdir(const char *path); | 333 | int _win_chdir(const char *path); |
334 | int _win_close(int fd); | 334 | int _win_close(int fd); |
335 | int _win_creat(const char *path, mode_t mode); | 335 | int _win_creat(const char *path, mode_t mode); |
336 | int _win_fstat(int handle, struct stat *buffer); | 336 | int _win_fstat(int handle, struct stat *buffer); |
337 | int _win_pipe(int *phandles); | 337 | int _win_pipe(int *phandles); |
338 | int _win_rmdir(const char *path); | 338 | int _win_rmdir(const char *path); |
339 | int _win_access( const char *path, int mode ); | 339 | int _win_access( const char *path, int mode ); |
340 | int _win_chmod(const char *filename, int pmode); | 340 | int _win_chmod(const char *filename, int pmode); |
341 | char *realpath(const char *file_name, char *resolved_name); | 341 | char *realpath(const char *file_name, char *resolved_name); |
342 | long _win_random(void); | 342 | long _win_random(void); |
343 | int _win_remove(const char *path); | 343 | int _win_remove(const char *path); |
344 | int _win_rename(const char *oldname, const char *newname); | 344 | int _win_rename(const char *oldname, const char *newname); |
345 | int _win_stat(const char *path, struct stat *buffer); | 345 | int _win_stat(const char *path, struct stat *buffer); |
346 | int _win_unlink(const char *filename); | 346 | int _win_unlink(const char *filename); |
347 | int _win_write(int fildes, const void *buf, size_t nbyte); | 347 | int _win_write(int fildes, const void *buf, size_t nbyte); |
348 | int _win_read(int fildes, void *buf, size_t nbyte); | 348 | int _win_read(int fildes, void *buf, size_t nbyte); |
349 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); | 349 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); |
350 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | 350 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); |
351 | int _win_symlink(const char *path1, const char *path2); | 351 | int _win_symlink(const char *path1, const char *path2); |
352 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | 352 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, |
353 | unsigned long long offset); | 353 | unsigned long long offset); |
354 | int _win_munmap(void *start, size_t length); | 354 | int _win_munmap(void *start, size_t length); |
355 | int _win_lstat(const char *path, struct stat *buf); | 355 | int _win_lstat(const char *path, struct stat *buf); |
356 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 356 | int _win_readlink(const char *path, char *buf, size_t bufsize); |
357 | int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); | 357 | int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen); |
358 | int _win_printf(const char *format,...); | 358 | int _win_printf(const char *format,...); |
359 | int _win_fprintf(FILE *f,const char *format,...); | 359 | int _win_fprintf(FILE *f,const char *format,...); |
360 | int _win_vprintf(const char *format, va_list ap); | 360 | int _win_vprintf(const char *format, va_list ap); |
361 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | 361 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); |
362 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | 362 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); |
363 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | 363 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); |
364 | int _win_snprintf(char *str,size_t size,const char *format,...); | 364 | int _win_snprintf(char *str,size_t size,const char *format,...); |
365 | int _win_sprintf(char *dest,const char *format,...); | 365 | int _win_sprintf(char *dest,const char *format,...); |
366 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | 366 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); |
367 | int _win_sscanf(const char *str, const char *format, ...); | 367 | int _win_sscanf(const char *str, const char *format, ...); |
368 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | 368 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); |
369 | int _win_vscanf(const char *format, va_list arg_ptr); | 369 | int _win_vscanf(const char *format, va_list arg_ptr); |
370 | int _win_scanf(const char *format, ...); | 370 | int _win_scanf(const char *format, ...); |
371 | int _win_fscanf(FILE *stream, const char *format, ...); | 371 | int _win_fscanf(FILE *stream, const char *format, ...); |
372 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 372 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); |
373 | int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); | 373 | int _win_bind(SOCKET s, const struct sockaddr *name, int namelen); |
374 | int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); | 374 | int _win_connect(SOCKET s,const struct sockaddr *name, int namelen); |
375 | int _win_getpeername(SOCKET s, struct sockaddr *name, | 375 | int _win_getpeername(SOCKET s, struct sockaddr *name, |
376 | int *namelen); | 376 | int *namelen); |
377 | int _win_getsockname(SOCKET s, struct sockaddr *name, | 377 | int _win_getsockname(SOCKET s, struct sockaddr *name, |
378 | int *namelen); | 378 | int *namelen); |
379 | int _win_getsockopt(SOCKET s, int level, int optname, char *optval, | 379 | int _win_getsockopt(SOCKET s, int level, int optname, char *optval, |
380 | int *optlen); | 380 | int *optlen); |
381 | int _win_listen(SOCKET s, int backlog); | 381 | int _win_listen(SOCKET s, int backlog); |
382 | int _win_recv(SOCKET s, char *buf, int len, int flags); | 382 | int _win_recv(SOCKET s, char *buf, int len, int flags); |
383 | int _win_recvfrom(SOCKET s, void *buf, int len, int flags, | 383 | int _win_recvfrom(SOCKET s, void *buf, int len, int flags, |
384 | struct sockaddr *from, int *fromlen); | 384 | struct sockaddr *from, int *fromlen); |
385 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | 385 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, |
386 | const struct timeval *tv); | 386 | const struct timeval *tv); |
387 | int _win_send(SOCKET s, const char *buf, int len, int flags); | 387 | int _win_send(SOCKET s, const char *buf, int len, int flags); |
388 | int _win_sendto(SOCKET s, const char *buf, int len, int flags, | 388 | int _win_sendto(SOCKET s, const char *buf, int len, int flags, |
389 | const struct sockaddr *to, int tolen); | 389 | const struct sockaddr *to, int tolen); |
390 | int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, | 390 | int _win_setsockopt(SOCKET s, int level, int optname, const void *optval, |
391 | int optlen); | 391 | int optlen); |
392 | int _win_shutdown(SOCKET s, int how); | 392 | int _win_shutdown(SOCKET s, int how); |
393 | SOCKET _win_socket(int af, int type, int protocol); | 393 | SOCKET _win_socket(int af, int type, int protocol); |
394 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | 394 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); |
395 | struct hostent *_win_gethostbyname(const char *name); | 395 | struct hostent *_win_gethostbyname(const char *name); |
396 | char *_win_strerror(int errnum); | 396 | char *_win_strerror(int errnum); |
397 | int IsWinNT(); | 397 | int IsWinNT(); |
398 | 398 | ||
399 | #if !HAVE_STRNDUP | 399 | #if !HAVE_STRNDUP |
400 | char *strndup (const char *s, size_t n); | 400 | char *strndup (const char *s, size_t n); |
401 | #endif | 401 | #endif |
402 | #if !HAVE_STRNLEN | 402 | #if !HAVE_STRNLEN |
403 | size_t strnlen (const char *str, size_t maxlen); | 403 | size_t strnlen (const char *str, size_t maxlen); |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | #endif /* WINDOWS */ | 406 | #endif /* WINDOWS */ |
407 | 407 | ||
408 | #ifndef WINDOWS | 408 | #ifndef WINDOWS |
409 | #define DIR_SEPARATOR '/' | 409 | #define DIR_SEPARATOR '/' |
410 | #define DIR_SEPARATOR_STR "/" | 410 | #define DIR_SEPARATOR_STR "/" |
411 | #define NEWLINE "\n" | 411 | #define NEWLINE "\n" |
412 | 412 | ||
413 | #ifdef ENABLE_NLS | 413 | #ifdef ENABLE_NLS |
414 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | 414 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) |
415 | #endif | 415 | #endif |
416 | #define CREAT(p, m) creat(p, m) | 416 | #define CREAT(p, m) creat(p, m) |
417 | #undef FOPEN | 417 | #undef FOPEN |
418 | #define FOPEN(f, m) fopen(f, m) | 418 | #define FOPEN(f, m) fopen(f, m) |
419 | #define OPENDIR(d) opendir(d) | 419 | #define OPENDIR(d) opendir(d) |
420 | #define OPEN(f) open(f) | 420 | #define OPEN(f) open(f) |
421 | #define CHDIR(d) chdir(d) | 421 | #define CHDIR(d) chdir(d) |
422 | #define CLOSE(f) close(f) | 422 | #define CLOSE(f) close(f) |
423 | #define RMDIR(f) rmdir(f) | 423 | #define RMDIR(f) rmdir(f) |
424 | #define ACCESS(p, m) access(p, m) | 424 | #define ACCESS(p, m) access(p, m) |
425 | #define CHMOD(f, p) chmod(f, p) | 425 | #define CHMOD(f, p) chmod(f, p) |
426 | #define FSTAT(h, b) fstat(h, b) | 426 | #define FSTAT(h, b) fstat(h, b) |
427 | #define PIPE(h) pipe(h) | 427 | #define PIPE(h) pipe(h) |
428 | #define REMOVE(p) remove(p) | 428 | #define REMOVE(p) remove(p) |
429 | #define RENAME(o, n) rename(o, n) | 429 | #define RENAME(o, n) rename(o, n) |
430 | #define STAT(p, b) stat(p, b) | 430 | #define STAT(p, b) stat(p, b) |
431 | #define UNLINK(f) unlink(f) | 431 | #define UNLINK(f) unlink(f) |
432 | #define WRITE(f, b, n) write(f, b, n) | 432 | #define WRITE(f, b, n) write(f, b, n) |
433 | #define READ(f, b, n) read(f, b, n) | 433 | #define READ(f, b, n) read(f, b, n) |
434 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | 434 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) |
435 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | 435 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) |
436 | #define SYMLINK(a, b) symlink(a, b) | 436 | #define SYMLINK(a, b) symlink(a, b) |
437 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | 437 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) |
438 | #define MUNMAP(s, l) munmap(s, l) | 438 | #define MUNMAP(s, l) munmap(s, l) |
439 | #define STRERROR(i) strerror(i) | 439 | #define STRERROR(i) strerror(i) |
440 | #define RANDOM() random() | 440 | #define RANDOM() random() |
441 | #define READLINK(p, b, s) readlink(p, b, s) | 441 | #define READLINK(p, b, s) readlink(p, b, s) |
442 | #define LSTAT(p, b) lstat(p, b) | 442 | #define LSTAT(p, b) lstat(p, b) |
443 | #define PRINTF printf | 443 | #define PRINTF printf |
444 | #define FPRINTF fprintf | 444 | #define FPRINTF fprintf |
445 | #define VPRINTF(f, a) vprintf(f, a) | 445 | #define VPRINTF(f, a) vprintf(f, a) |
446 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | 446 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
447 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | 447 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
448 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | 448 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
449 | #define _REAL_SNPRINTF snprintf | 449 | #define _REAL_SNPRINTF snprintf |
450 | #define SPRINTF sprintf | 450 | #define SPRINTF sprintf |
451 | #define VSSCANF(s, f, a) vsscanf(s, f, a) | 451 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
452 | #define SSCANF sscanf | 452 | #define SSCANF sscanf |
453 | #define VFSCANF(s, f, a) vfscanf(s, f, a) | 453 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
454 | #define VSCANF(f, a) vscanf(f, a) | 454 | #define VSCANF(f, a) vscanf(f, a) |
455 | #define SCANF scanf | 455 | #define SCANF scanf |
456 | #define FSCANF fscanf | 456 | #define FSCANF fscanf |
457 | #define WAITPID(p, s, o) waitpid(p, s, o) | 457 | #define WAITPID(p, s, o) waitpid(p, s, o) |
458 | #define ACCEPT(s, a, l) accept(s, a, l) | 458 | #define ACCEPT(s, a, l) accept(s, a, l) |
459 | #define BIND(s, n, l) bind(s, n, l) | 459 | #define BIND(s, n, l) bind(s, n, l) |
460 | #define CONNECT(s, n, l) connect(s, n, l) | 460 | #define CONNECT(s, n, l) connect(s, n, l) |
461 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | 461 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) |
462 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | 462 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) |
463 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | 463 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) |
464 | #define LISTEN(s, b) listen(s, b) | 464 | #define LISTEN(s, b) listen(s, b) |
465 | #define RECV(s, b, l, f) recv(s, b, l, f) | 465 | #define RECV(s, b, l, f) recv(s, b, l, f) |
466 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | 466 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) |
467 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | 467 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) |
468 | #define SEND(s, b, l, f) send(s, b, l, f) | 468 | #define SEND(s, b, l, f) send(s, b, l, f) |
469 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | 469 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) |
470 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | 470 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) |
471 | #define SHUTDOWN(s, h) shutdown(s, h) | 471 | #define SHUTDOWN(s, h) shutdown(s, h) |
472 | #define SOCKET(a, t, p) socket(a, t, p) | 472 | #define SOCKET(a, t, p) socket(a, t, p) |
473 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | 473 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) |
474 | #define GETHOSTBYNAME(n) gethostbyname(n) | 474 | #define GETHOSTBYNAME(n) gethostbyname(n) |
475 | #else | 475 | #else |
476 | #define DIR_SEPARATOR '\\' | 476 | #define DIR_SEPARATOR '\\' |
477 | #define DIR_SEPARATOR_STR "\\" | 477 | #define DIR_SEPARATOR_STR "\\" |
478 | #define NEWLINE "\r\n" | 478 | #define NEWLINE "\r\n" |
479 | 479 | ||
480 | #ifdef ENABLE_NLS | 480 | #ifdef ENABLE_NLS |
481 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | 481 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) |
482 | #endif | 482 | #endif |
483 | #define CREAT(p, m) _win_creat(p, m) | 483 | #define CREAT(p, m) _win_creat(p, m) |
484 | #define FOPEN(f, m) _win_fopen(f, m) | 484 | #define FOPEN(f, m) _win_fopen(f, m) |
485 | #define OPENDIR(d) _win_opendir(d) | 485 | #define OPENDIR(d) _win_opendir(d) |
486 | #define OPEN(f) _win_open(f) | 486 | #define OPEN(f) _win_open(f) |
487 | #define CHDIR(d) _win_chdir(d) | 487 | #define CHDIR(d) _win_chdir(d) |
488 | #define CLOSE(f) _win_close(f) | 488 | #define CLOSE(f) _win_close(f) |
489 | #define FSTAT(h, b) _win_fstat(h, b) | 489 | #define FSTAT(h, b) _win_fstat(h, b) |
490 | #define RMDIR(f) _win_rmdir(f) | 490 | #define RMDIR(f) _win_rmdir(f) |
491 | #define ACCESS(p, m) _win_access(p, m) | 491 | #define ACCESS(p, m) _win_access(p, m) |
492 | #define CHMOD(f, p) _win_chmod(f, p) | 492 | #define CHMOD(f, p) _win_chmod(f, p) |
493 | #define PIPE(h) _win_pipe(h) | 493 | #define PIPE(h) _win_pipe(h) |
494 | #define RANDOM() _win_random() | 494 | #define RANDOM() _win_random() |
495 | #define REMOVE(p) _win_remove(p) | 495 | #define REMOVE(p) _win_remove(p) |
496 | #define RENAME(o, n) _win_rename(o, n) | 496 | #define RENAME(o, n) _win_rename(o, n) |
497 | #define STAT(p, b) _win_stat(p, b) | 497 | #define STAT(p, b) _win_stat(p, b) |
498 | #define UNLINK(f) _win_unlink(f) | 498 | #define UNLINK(f) _win_unlink(f) |
499 | #define WRITE(f, b, n) _win_write(f, b, n) | 499 | #define WRITE(f, b, n) _win_write(f, b, n) |
500 | #define READ(f, b, n) _win_read(f, b, n) | 500 | #define READ(f, b, n) _win_read(f, b, n) |
501 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | 501 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) |
502 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | 502 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) |
503 | #define SYMLINK(a, b) _win_symlink(a, b) | 503 | #define SYMLINK(a, b) _win_symlink(a, b) |
504 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | 504 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) |
505 | #define MUNMAP(s, l) _win_munmap(s, l) | 505 | #define MUNMAP(s, l) _win_munmap(s, l) |
506 | #define STRERROR(i) _win_strerror(i) | 506 | #define STRERROR(i) _win_strerror(i) |
507 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 507 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
508 | #define LSTAT(p, b) _win_lstat(p, b) | 508 | #define LSTAT(p, b) _win_lstat(p, b) |
509 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 509 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) |
510 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 510 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) |
511 | #define VPRINTF(f, a) _win_vprintf(f, a) | 511 | #define VPRINTF(f, a) _win_vprintf(f, a) |
512 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 512 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) |
513 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 513 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) |
514 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 514 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) |
515 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 515 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) |
516 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 516 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) |
517 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 517 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) |
518 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 518 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) |
519 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 519 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) |
520 | #define VSCANF(f, a) _win_vscanf(f, a) | 520 | #define VSCANF(f, a) _win_vscanf(f, a) |
521 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 521 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) |
522 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 522 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) |
523 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 523 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
524 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 524 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
525 | #define BIND(s, n, l) _win_bind(s, n, l) | 525 | #define BIND(s, n, l) _win_bind(s, n, l) |
526 | #define CONNECT(s, n, l) _win_connect(s, n, l) | 526 | #define CONNECT(s, n, l) _win_connect(s, n, l) |
527 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | 527 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) |
528 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | 528 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) |
529 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | 529 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) |
530 | #define LISTEN(s, b) _win_listen(s, b) | 530 | #define LISTEN(s, b) _win_listen(s, b) |
531 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | 531 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) |
532 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | 532 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) |
533 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | 533 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) |
534 | #define SEND(s, b, l, f) _win_send(s, b, l, f) | 534 | #define SEND(s, b, l, f) _win_send(s, b, l, f) |
535 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | 535 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) |
536 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | 536 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) |
537 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | 537 | #define SHUTDOWN(s, h) _win_shutdown(s, h) |
538 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 538 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
539 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | 539 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) |
540 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 540 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
541 | #endif | 541 | #endif |
542 | 542 | ||
543 | 543 | ||
544 | #ifdef __cplusplus | 544 | #ifdef __cplusplus |
545 | } | 545 | } |
546 | #endif | 546 | #endif |
547 | 547 | ||
548 | 548 | ||
549 | #endif //_PLIBC_H_ | 549 | #endif //_PLIBC_H_ |
550 | 550 | ||
551 | /* end of plibc.h */ | 551 | /* end of plibc.h */ |