1 #ifndef OPENAFS_ROKEN_H
2 #define OPENAFS_ROKEN_H
8 /* Declarations for Microsoft Visual C runtime in Windows */
13 #ifndef __BITS_TYPES_DEFINED__
14 #define __BITS_TYPES_DEFINED__
16 typedef __int8 int8_t;
17 typedef __int16 int16_t;
18 typedef __int32 int32_t;
19 typedef __int64 int64_t;
20 typedef unsigned __int8 uint8_t;
21 typedef unsigned __int16 uint16_t;
22 typedef unsigned __int32 uint32_t;
23 typedef unsigned __int64 uint64_t;
24 typedef uint8_t u_int8_t;
25 typedef uint16_t u_int16_t;
26 typedef uint32_t u_int32_t;
27 typedef uint64_t u_int64_t;
29 #endif /* __BITS_TYPES_DEFINED__ */
33 typedef __int64 ssize_t;
40 #endif /* AFS_NT40_ENV */
42 #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
45 #define min(a,b) (((a)<(b))?(a):(b))
48 #ifndef ROKEN_LIB_FUNCTION
50 #define ROKEN_LIB_FUNCTION
51 #define ROKEN_LIB_CALL __cdecl
53 #define ROKEN_LIB_FUNCTION
54 #define ROKEN_LIB_CALL
58 #ifndef HAVE___ATTRIBUTE__
59 #define __attribute__(x)
62 typedef int rk_socket_t;
64 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
65 ct_memcmp(const void *, const void *, size_t);
67 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec(int);
69 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec_file(FILE *);
71 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
72 net_write (rk_socket_t, const void *, size_t);
74 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
75 net_read (rk_socket_t, void *, size_t);
77 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void);
79 #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
81 #define snprintf rk_snprintf
83 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
84 rk_snprintf (char *, size_t, const char *, ...)
85 __attribute__ ((format (printf, 3, 4)));
88 #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
89 #ifndef HAVE_VSNPRINTF
90 #define vsnprintf rk_vsnprintf
92 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
93 rk_vsnprintf (char *, size_t, const char *, va_list)
94 __attribute__((format (printf, 3, 0)));
97 #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
99 #define asprintf rk_asprintf
101 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
102 rk_asprintf (char **, const char *, ...)
103 __attribute__ ((format (printf, 2, 3)));
106 #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
107 #ifndef HAVE_VASPRINTF
108 #define vasprintf rk_vasprintf
110 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
111 rk_vasprintf (char **, const char *, va_list)
112 __attribute__((format (printf, 2, 0)));
115 #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
116 #ifndef HAVE_ASNPRINTF
117 #define asnprintf rk_asnprintf
119 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
120 rk_asnprintf (char **, size_t, const char *, ...)
121 __attribute__ ((format (printf, 3, 4)));
124 #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
125 #ifndef HAVE_VASNPRINTF
126 #define vasnprintf rk_vasnprintf
128 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
129 vasnprintf (char **, size_t, const char *, va_list)
130 __attribute__((format (printf, 3, 0)));
134 #define strlcpy rk_strlcpy
135 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
136 strlcpy (char *, const char *, size_t);
140 # ifdef HAVE_DIR_DD_FD
141 # define dirfd(x) ((x)->dd_fd)
143 # ifndef _WIN32 /* Windows code never calls dirfd */
144 # error Missing dirfd() and ->dd_fd
149 /* This is a bodge, but it's only used by the tests */
150 #define emalloc(x) malloc(x)
152 #ifndef HAVE_GETPROGNAME
153 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void);
156 #ifndef _PATH_DEVNULL
157 #define _PATH_DEVNULL "/dev/null"
161 #endif /* OPENAFS_ROKEN_H */