Annotation of embedaddon/libpdel/ports/Linux/hacks.h, revision 1.1.1.1
1.1 misho 1:
2: #define _XOPEN_SOURCE 600
3: #define _GNU_SOURCE 1
4: #define _BSD_SOURCE 1
5: #define _ISOC99_SOURCE 1
6:
7: #include <string.h> /* memcpy(), etc. */
8: #include <netinet/in.h> /* htonl(), etc. */
9:
10: /* Linux does not have these 'errno' values */
11: #define EFTYPE EINVAL
12: #define EPROGMISMATCH EINVAL
13:
14: #define LLONG_MAX 9223372036854775807LL
15: #define LLONG_MIN (-LLONG_MAX - 1LL)
16:
17: #define INFTIM (-1)
18:
19: #define REG_STARTEND 0
20:
21: #define ALIGNBYTES (sizeof(size_t) - 1) /* ?? */
22: #define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
23:
24: #define mergesort(a,b,c,d) (qsort(a,b,c,d), 0)
25: #define strlcpy(dst, src, size) snprintf(dst, size, "%s", src)
26: #define strlcat(dst, src, size) snprintf((dst) + strlen(dst), \
27: (size) - strlen(dst), "%s", src)
28:
29: #include <libio.h>
30: #define funopen1(c, m, rf, wf, sf, cf) \
31: fopencookie(c, m, \
32: ({ \
33: _IO_cookie_io_functions_t _funcs; \
34: _funcs.read = (cookie_read_function_t *)(rf); \
35: _funcs.write = (cookie_write_function_t *)(wf); \
36: _funcs.seek = (cookie_seek_function_t *)(sf); \
37: _funcs.close = (cookie_close_function_t *)(cf); \
38: _funcs; \
39: }))
40: #define funopen(c, rf, wf, sf, cf) \
41: funopen1(c, "r+", rf, wf, sf, cf)
42: #define fropen(c, rf) funopen1(c, "r", rf, NULL, NULL, NULL)
43: #define fwopen(c, rf) funopen1(c, "w", NULL, wf, NULL, NULL)
44:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>