aboutsummaryrefslogtreecommitdiff
path: root/src/include/plibc.h
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-04-21 13:36:55 +0000
committerLRN <lrn1986@gmail.com>2013-04-21 13:36:55 +0000
commit5eb44fbf35d9f0a332ced2b2d1f6defbf47206b5 (patch)
tree7e1a05e814edd1369e3f85de90f0204186b5205c /src/include/plibc.h
parent87c2411c30758a5a6f39b433b8012c030ecd5963 (diff)
downloadgnunet-5eb44fbf35d9f0a332ced2b2d1f6defbf47206b5.tar.gz
gnunet-5eb44fbf35d9f0a332ced2b2d1f6defbf47206b5.zip
Update plibc header
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r--src/include/plibc.h373
1 files changed, 268 insertions, 105 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h
index 1cb84e6b7..7ef80acaf 100644
--- a/src/include/plibc.h
+++ b/src/include/plibc.h
@@ -22,7 +22,7 @@
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: 84 $ 25 * @version $Revision$
26 */ 26 */
27 27
28#ifndef _PLIBC_H_ 28#ifndef _PLIBC_H_
@@ -70,7 +70,7 @@ extern "C" {
70/* Convert LARGE_INTEGER to double */ 70/* Convert LARGE_INTEGER to double */
71#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ 71#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
72 (double)((x).LowPart)) 72 (double)((x).LowPart))
73#ifndef __MINGW64__ 73#ifndef __MINGW64_VERSION_MAJOR
74struct stat64 74struct stat64
75{ 75{
76 _dev_t st_dev; 76 _dev_t st_dev;
@@ -116,101 +116,254 @@ enum
116}; 116};
117 117
118/* Thanks to the Cygwin project */ 118/* Thanks to the Cygwin project */
119#define ENOCSI 43 /* No CSI structure available */ 119#if !defined(ENOCSI)
120#define EL2HLT 44 /* Level 2 halted */ 120# define ENOCSI 43 /* No CSI structure available */
121#ifndef EDEADLK 121#endif
122 #define EDEADLK 45 /* Deadlock condition */ 122#if !defined(EL2HLT)
123#endif 123# define EL2HLT 44 /* Level 2 halted */
124#ifndef ENOLCK 124#endif
125 #define ENOLCK 46 /* No record locks available */ 125#if !defined(EDEADLK)
126#endif 126# define EDEADLK 45 /* Deadlock condition */
127#define EBADE 50 /* Invalid exchange */ 127#endif
128#define EBADR 51 /* Invalid request descriptor */ 128#if !defined(ENOLCK)
129#define EXFULL 52 /* Exchange full */ 129# define ENOLCK 46 /* No record locks available */
130#define ENOANO 53 /* No anode */ 130#endif
131#define EBADRQC 54 /* Invalid request code */ 131#if !defined(EBADE)
132#define EBADSLT 55 /* Invalid slot */ 132# define EBADE 50 /* Invalid exchange */
133#ifndef EDEADLOCK 133#endif
134 #define EDEADLOCK EDEADLK /* File locking deadlock error */ 134#if !defined(EBADR)
135#endif 135# define EBADR 51 /* Invalid request descriptor */
136#define EBFONT 57 /* Bad font file fmt */ 136#endif
137#define ENOSTR 60 /* Device not a stream */ 137#if !defined(EXFULL)
138#define ENODATA 61 /* No data (for no delay io) */ 138# define EXFULL 52 /* Exchange full */
139#define ETIME 62 /* Timer expired */ 139#endif
140#define ENOSR 63 /* Out of streams resources */ 140#if !defined(ENOANO)
141#define ENONET 64 /* Machine is not on the network */ 141# define ENOANO 53 /* No anode */
142#define ENOPKG 65 /* Package not installed */ 142#endif
143#define EREMOTE 66 /* The object is remote */ 143#if !defined(EBADRQC)
144#define ENOLINK 67 /* The link has been severed */ 144# define EBADRQC 54 /* Invalid request code */
145#define EADV 68 /* Advertise error */ 145#endif
146#define ESRMNT 69 /* Srmount error */ 146#if !defined(EBADSLT)
147#define ECOMM 70 /* Communication error on send */ 147# define EBADSLT 55 /* Invalid slot */
148#define EPROTO 71 /* Protocol error */ 148#endif
149#define EMULTIHOP 74 /* Multihop attempted */ 149#if !defined(EDEADLOCK)
150#define ELBIN 75 /* Inode is remote (not really error) */ 150# define EDEADLOCK EDEADLK /* File locking deadlock error */
151#define EDOTDOT 76 /* Cross mount point (not really error) */ 151#endif
152#define EBADMSG 77 /* Trying to read unreadable message */ 152#if !defined(EBFONT)
153#define ENOTUNIQ 80 /* Given log. name not unique */ 153# define EBFONT 57 /* Bad font file fmt */
154#define EBADFD 81 /* f.d. invalid for this operation */ 154#endif
155#define EREMCHG 82 /* Remote address changed */ 155#if !defined(ENOSTR)
156#define ELIBACC 83 /* Can't access a needed shared lib */ 156# define ENOSTR 60 /* Device not a stream */
157#define ELIBBAD 84 /* Accessing a corrupted shared lib */ 157#endif
158#define ELIBSCN 85 /* .lib section in a.out corrupted */ 158#if !defined(ENODATA)
159#define ELIBMAX 86 /* Attempting to link in too many libs */ 159# define ENODATA 61 /* No data (for no delay io) */
160#define ELIBEXEC 87 /* Attempting to exec a shared library */ 160#endif
161#ifndef ENOSYS 161#if !defined(ETIME)
162 #define ENOSYS 88 /* Function not implemented */ 162# define ETIME 62 /* Timer expired */
163#endif 163#endif
164#define ENMFILE 89 /* No more files */ 164#if !defined(ENOSR)
165#ifndef ENOTEMPTY 165# define ENOSR 63 /* Out of streams resources */
166 #define ENOTEMPTY 90 /* Directory not empty */ 166#endif
167#endif 167#if !defined(ENONET)
168#ifndef ENAMETOOLONG 168# define ENONET 64 /* Machine is not on the network */
169 #define ENAMETOOLONG 91 /* File or path name too long */ 169#endif
170#endif 170#if !defined(ENOPKG)
171#define ELOOP 92 /* Too many symbolic links */ 171# define ENOPKG 65 /* Package not installed */
172#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 172#endif
173#define EPFNOSUPPORT 96 /* Protocol family not supported */ 173#if !defined(EREMOTE)
174#define ECONNRESET 104 /* Connection reset by peer */ 174# define EREMOTE 66 /* The object is remote */
175#define ENOBUFS 105 /* No buffer space available */ 175#endif
176#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ 176#if !defined(ENOLINK)
177#define EPROTOTYPE 107 /* Protocol wrong type for socket */ 177# define ENOLINK 67 /* The link has been severed */
178#define ENOTSOCK 108 /* Socket operation on non-socket */ 178#endif
179#define ENOPROTOOPT 109 /* Protocol not available */ 179#if !defined(EADV)
180#define ESHUTDOWN 110 /* Can't send after socket shutdown */ 180# define EADV 68 /* Advertise error */
181#define ECONNREFUSED 111 /* Connection refused */ 181#endif
182#define EADDRINUSE 112 /* Address already in use */ 182#if !defined(ESRMNT)
183#define ECONNABORTED 113 /* Connection aborted */ 183# define ESRMNT 69 /* Srmount error */
184#define ENETUNREACH 114 /* Network is unreachable */ 184#endif
185#define ENETDOWN 115 /* Network interface is not configured */ 185#if !defined(ECOMM)
186#ifndef ETIMEDOUT 186# define ECOMM 70 /* Communication error on send */
187 #define ETIMEDOUT 116 /* Connection timed out */ 187#endif
188#endif 188#if !defined(EMULTIHOP)
189#define EHOSTDOWN 117 /* Host is down */ 189# define EMULTIHOP 74 /* Multihop attempted */
190#define EHOSTUNREACH 118 /* Host is unreachable */ 190#endif
191#define EINPROGRESS 119 /* Connection already in progress */ 191#if !defined(ELBIN)
192#define EALREADY 120 /* Socket already connected */ 192# define ELBIN 75 /* Inode is remote (not really error) */
193#define EDESTADDRREQ 121 /* Destination address required */ 193#endif
194#define EMSGSIZE 122 /* Message too long */ 194#if !defined(EDOTDOT)
195#define EPROTONOSUPPORT 123 /* Unknown protocol */ 195# define EDOTDOT 76 /* Cross mount point (not really error) */
196#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ 196#endif
197#define EADDRNOTAVAIL 125 /* Address not available */ 197#if !defined(EBADMSG)
198#define ENETRESET 126 /* Connection aborted by network */ 198# define EBADMSG 77 /* Trying to read unreadable message */
199#define EISCONN 127 /* Socket is already connected */ 199#endif
200#define ENOTCONN 128 /* Socket is not connected */ 200#if !defined(ENOTUNIQ)
201#define ETOOMANYREFS 129 /* Too many references: cannot splice */ 201# define ENOTUNIQ 80 /* Given log. name not unique */
202#define EPROCLIM 130 /* Too many processes */ 202#endif
203#define EUSERS 131 /* Too many users */ 203#if !defined(EBADFD)
204#define EDQUOT 132 /* Disk quota exceeded */ 204# define EBADFD 81 /* f.d. invalid for this operation */
205#define ESTALE 133 /* Unknown error */ 205#endif
206#ifndef ENOTSUP 206#if !defined(EREMCHG)
207 #define ENOTSUP 134 /* Not supported */ 207# define EREMCHG 82 /* Remote address changed */
208#endif 208#endif
209#define ENOMEDIUM 135 /* No medium (in tape drive) */ 209#if !defined(ELIBACC)
210#define ENOSHARE 136 /* No such host or network path */ 210# define ELIBACC 83 /* Can't access a needed shared lib */
211#define ECASECLASH 137 /* Filename exists with different case */ 211#endif
212#define EWOULDBLOCK EAGAIN /* Operation would block */ 212#if !defined(ELIBBAD)
213#define EOVERFLOW 139 /* Value too large for defined data type */ 213# define ELIBBAD 84 /* Accessing a corrupted shared lib */
214#endif
215#if !defined(ELIBSCN)
216# define ELIBSCN 85 /* .lib section in a.out corrupted */
217#endif
218#if !defined(ELIBMAX)
219# define ELIBMAX 86 /* Attempting to link in too many libs */
220#endif
221#if !defined(ELIBEXEC)
222# define ELIBEXEC 87 /* Attempting to exec a shared library */
223#endif
224#if !defined(ENOSYS)
225# define ENOSYS 88 /* Function not implemented */
226#endif
227#if !defined(ENMFILE)
228# define ENMFILE 89 /* No more files */
229#endif
230#if !defined(ENOTEMPTY)
231# define ENOTEMPTY 90 /* Directory not empty */
232#endif
233#if !defined(ENAMETOOLONG)
234# define ENAMETOOLONG 91 /* File or path name too long */
235#endif
236#if !defined(EPFNOSUPPORT)
237# define EPFNOSUPPORT 96 /* Protocol family not supported */
238#endif
239#if !defined(ENOSHARE)
240# define ENOSHARE 97 /* No such host or network path */
241#endif
242#if !defined(ENOMEDIUM)
243# define ENOMEDIUM 98 /* No medium (in tape drive) */
244#endif
245#if !defined(ESHUTDOWN)
246# define ESHUTDOWN 99 /* Can't send after socket shutdown */
247#endif
248#if !defined(EADDRINUSE)
249# define EADDRINUSE 100 /* Address already in use */
250#endif
251#if !defined(EADDRNOTAVAIL)
252# define EADDRNOTAVAIL 101 /* Address not available */
253#endif
254#if !defined(EAFNOSUPPORT)
255# define EAFNOSUPPORT 102 /* Address family not supported by protocol family */
256#endif
257#if !defined(EALREADY)
258# define EALREADY 103 /* Socket already connected */
259#endif
260#if !defined(ECANCELED)
261# define ECANCELED 105 /* Connection cancelled */
262#endif
263#if !defined(ECONNABORTED)
264# define ECONNABORTED 106 /* Connection aborted */
265#endif
266#if !defined(ECONNREFUSED)
267# define ECONNREFUSED 107 /* Connection refused */
268#endif
269#if !defined(ECONNRESET)
270# define ECONNRESET 108 /* Connection reset by peer */
271#endif
272#if !defined(EDESTADDRREQ)
273# define EDESTADDRREQ 109 /* Destination address required */
274#endif
275#if !defined(EHOSTUNREACH)
276# define EHOSTUNREACH 110 /* Host is unreachable */
277#endif
278#if !defined(ECONNABORTED)
279# define ECONNABORTED 111 /* Connection aborted */
280#endif
281#if !defined(EINPROGRESS)
282# define EINPROGRESS 112 /* Connection already in progress */
283#endif
284#if !defined(EISCONN)
285# define EISCONN 113 /* Socket is already connected */
286#endif
287#if !defined(ELOOP)
288# define ELOOP 114 /* Too many symbolic links */
289#endif
290#if !defined(EMSGSIZE)
291# define EMSGSIZE 115 /* Message too long */
292#endif
293#if !defined(ENETDOWN)
294# define ENETDOWN 116 /* Network interface is not configured */
295#endif
296#if !defined(ENETRESET)
297# define ENETRESET 117 /* Connection aborted by network */
298#endif
299#if !defined(ENETUNREACH)
300# define ENETUNREACH 118 /* Network is unreachable */
301#endif
302#if !defined(ENOBUFS)
303# define ENOBUFS 119 /* No buffer space available */
304#endif
305#if !defined(EHOSTDOWN)
306# define EHOSTDOWN 120 /* Host is down */
307#endif
308#if !defined(EPROCLIM)
309# define EPROCLIM 121 /* Too many processes */
310#endif
311#if !defined(EDQUOT)
312# define EDQUOT 122 /* Disk quota exceeded */
313#endif
314#if !defined(ENOPROTOOPT)
315# define ENOPROTOOPT 123 /* Protocol not available */
316#endif
317#if !defined(ESOCKTNOSUPPORT)
318# define ESOCKTNOSUPPORT 124 /* Socket type not supported */
319#endif
320#if !defined(ESTALE)
321# define ESTALE 125 /* Unknown error */
322#endif
323#if !defined(ENOTCONN)
324# define ENOTCONN 126 /* Socket is not connected */
325#endif
326#if !defined(ETOOMANYREFS)
327# define ETOOMANYREFS 127 /* Too many references: cannot splice */
328#endif
329#if !defined(ENOTSOCK)
330# define ENOTSOCK 128 /* Socket operation on non-socket */
331#endif
332#if !defined(ENOTSUP)
333# define ENOTSUP 129 /* Not supported */
334#endif
335#if !defined(EOPNOTSUPP)
336# define EOPNOTSUPP 130 /* Operation not supported on transport endpoint */
337#endif
338#if !defined(EUSERS)
339# define EUSERS 131 /* Too many users */
340#endif
341#if !defined(EOVERFLOW)
342# define EOVERFLOW 132 /* Value too large for defined data type */
343#endif
344#if !defined(EOWNERDEAD)
345# define EOWNERDEAD 133 /* Unknown error */
346#endif
347#if !defined(EPROTO)
348# define EPROTO 134 /* Protocol error */
349#endif
350#if !defined(EPROTONOSUPPORT)
351# define EPROTONOSUPPORT 135 /* Unknown protocol */
352#endif
353#if !defined(EPROTOTYPE)
354# define EPROTOTYPE 136 /* Protocol wrong type for socket */
355#endif
356#if !defined(ECASECLASH)
357# define ECASECLASH 137 /* Filename exists with different case */
358#endif
359#if !defined(ETIMEDOUT)
360/* Make sure it's the same as WSATIMEDOUT */
361# define ETIMEDOUT 138 /* Connection timed out */
362#endif
363#if !defined(EWOULDBLOCK) || EWOULBLOCK == 140
364# undef EWOULDBLOCK /* MinGW-w64 defines it as 140, but we want it as EAGAIN */
365# define EWOULDBLOCK EAGAIN /* Operation would block */
366#endif
214 367
215#undef HOST_NOT_FOUND 368#undef HOST_NOT_FOUND
216#define HOST_NOT_FOUND 1 369#define HOST_NOT_FOUND 1
@@ -247,9 +400,6 @@ struct statfs
247 long f_spare[6]; /* spare for later */ 400 long f_spare[6]; /* spare for later */
248}; 401};
249 402
250extern const struct in6_addr in6addr_any; /* :: */
251extern const struct in6_addr in6addr_loopback; /* ::1 */
252
253/* Taken from the Wine project <http://www.winehq.org> 403/* Taken from the Wine project <http://www.winehq.org>
254 /wine/include/winternl.h */ 404 /wine/include/winternl.h */
255enum SYSTEM_INFORMATION_CLASS 405enum SYSTEM_INFORMATION_CLASS
@@ -371,13 +521,17 @@ int inet_pton4(const char *src, u_char *dst, int pton);
371#if USE_IPV6 521#if USE_IPV6
372int inet_pton6(const char *src, u_char *dst); 522int inet_pton6(const char *src, u_char *dst);
373#endif 523#endif
524#if !defined(FTRUNCATE_DEFINED)
374int truncate(const char *fname, int distance); 525int truncate(const char *fname, int distance);
526#endif
375int statfs(const char *path, struct statfs *buf); 527int statfs(const char *path, struct statfs *buf);
376const char *hstrerror(int err); 528const char *hstrerror(int err);
377int mkstemp(char *tmplate); 529int mkstemp(char *tmplate);
378char *strptime (const char *buf, const char *format, struct tm *tm); 530char *strptime (const char *buf, const char *format, struct tm *tm);
379const char *inet_ntop(int af, const void *src, char *dst, size_t size); 531const char *inet_ntop(int af, const void *src, char *dst, size_t size);
532#ifndef gmtime_r
380struct tm *gmtime_r(const time_t *clock, struct tm *result); 533struct tm *gmtime_r(const time_t *clock, struct tm *result);
534#endif
381 535
382int plibc_init(char *pszOrg, char *pszApp); 536int plibc_init(char *pszOrg, char *pszApp);
383int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode); 537int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode);
@@ -404,10 +558,12 @@ int _win_creat(const char *path, mode_t mode);
404char *_win_ctime(const time_t *clock); 558char *_win_ctime(const time_t *clock);
405char *_win_ctime_r(const time_t *clock, char *buf); 559char *_win_ctime_r(const time_t *clock, char *buf);
406int _win_fstat(int handle, struct stat *buffer); 560int _win_fstat(int handle, struct stat *buffer);
561off_t _win_lseek(int fildes, off_t offset, int whence);
407int _win_ftruncate(int fildes, off_t length); 562int _win_ftruncate(int fildes, off_t length);
408void _win_gettimeofday(struct timeval *tp, void *tzp); 563void _win_gettimeofday(struct timeval *tp, void *tzp);
409int _win_kill(pid_t pid, int sig); 564int _win_kill(pid_t pid, int sig);
410int _win_pipe(int *phandles); 565int _win_pipe(int *phandles);
566intptr_t _win_mkfifo(const char *path, mode_t mode);
411int _win_rmdir(const char *path); 567int _win_rmdir(const char *path);
412int _win_access( const char *path, int mode ); 568int _win_access( const char *path, int mode );
413int _win_chmod(const char *filename, int pmode); 569int _win_chmod(const char *filename, int pmode);
@@ -509,15 +665,22 @@ char *index(const char *s, int c);
509#if !HAVE_STRNDUP 665#if !HAVE_STRNDUP
510char *strndup (const char *s, size_t n); 666char *strndup (const char *s, size_t n);
511#endif 667#endif
512#if !HAVE_STRNLEN 668#if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) || !defined(_INC_STRING))
513size_t strnlen (const char *str, size_t maxlen); 669size_t strnlen (const char *str, size_t maxlen);
514#endif 670#endif
671#if !HAVE_STRTOK_R
672char *strtok_r (char *ptr, const char *sep, char **end);
673#endif
515char *stpcpy(char *dest, const char *src); 674char *stpcpy(char *dest, const char *src);
516char *strcasestr(const char *haystack_start, const char *needle_start); 675char *strcasestr(const char *haystack_start, const char *needle_start);
517#ifndef __MINGW64__ 676#ifndef __MINGW64_VERSION_MAJOR
518#define strcasecmp(a, b) stricmp(a, b) 677#define strcasecmp(a, b) stricmp(a, b)
519#define wcscasecmp(a, b) wcsicmp(a, b)
520#define strncasecmp(a, b, c) strnicmp(a, b, c) 678#define strncasecmp(a, b, c) strnicmp(a, b, c)
679#endif
680#ifndef wcscasecmp
681#define wcscasecmp(a, b) wcsicmp(a, b)
682#endif
683#ifndef wcsncasecmp
521#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) 684#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
522#endif 685#endif
523#endif /* WINDOWS */ 686#endif /* WINDOWS */
@@ -603,7 +766,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
603 #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) 766 #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
604 #define SHUTDOWN(s, h) shutdown(s, h) 767 #define SHUTDOWN(s, h) shutdown(s, h)
605 #define SOCKET(a, t, p) socket(a, t, p) 768 #define SOCKET(a, t, p) socket(a, t, p)
606 #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) 769 #define GETHOSTBYADDR(a, l, t) gethostbyaddr(a, l, t)
607 #define GETHOSTBYNAME(n) gethostbyname(n) 770 #define GETHOSTBYNAME(n) gethostbyname(n)
608 #define GETTIMEOFDAY(t, n) gettimeofday(t, n) 771 #define GETTIMEOFDAY(t, n) gettimeofday(t, n)
609 #define INSQUE(e, p) insque(e, p) 772 #define INSQUE(e, p) insque(e, p)
@@ -701,7 +864,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
701 #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) 864 #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
702 #define SHUTDOWN(s, h) _win_shutdown(s, h) 865 #define SHUTDOWN(s, h) _win_shutdown(s, h)
703 #define SOCKET(a, t, p) _win_socket(a, t, p) 866 #define SOCKET(a, t, p) _win_socket(a, t, p)
704 #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) 867 #define GETHOSTBYADDR(a, l, t) _win_gethostbyaddr(a, l, t)
705 #define GETHOSTBYNAME(n) _win_gethostbyname(n) 868 #define GETHOSTBYNAME(n) _win_gethostbyname(n)
706 #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) 869 #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n)
707 #define INSQUE(e, p) _win_insque(e, p) 870 #define INSQUE(e, p) _win_insque(e, p)