c830eae8e5c694301ee6b3d2cc4bbdd79dffb58e
[openafs.git] / src / crypto / hcrypto / roken.h
1 #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
2
3 #ifndef min
4 #define min(a,b) (((a)<(b))?(a):(b))
5 #endif
6
7 #ifndef ROKEN_LIB_FUNCTION
8 #ifdef _WIN32
9 #define ROKEN_LIB_FUNCTION
10 #define ROKEN_LIB_CALL     __cdecl
11 #else
12 #define ROKEN_LIB_FUNCTION
13 #define ROKEN_LIB_CALL
14 #endif
15 #endif
16
17 typedef int rk_socket_t;
18
19 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
20     ct_memcmp(const void *, const void *, size_t);
21
22 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec(int);
23
24 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec_file(FILE *);
25
26 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
27     net_write (rk_socket_t, const void *, size_t);
28
29 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
30     net_read (rk_socket_t, void *, size_t);
31
32 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void);
33
34 #ifndef HAVE_STRLCPY
35 #define strlcpy rk_strlcpy
36 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
37     strlcpy (char *, const char *, size_t);
38 #endif
39
40 #ifndef HAVE_DIRFD
41 # ifdef HAVE_DIR_DD_FD
42 #  define dirfd(x) ((x)->dd_fd)
43 # else
44 #  ifndef _WIN32 /* Windows code never calls dirfd */
45 #   error Missing dirfd() and ->dd_fd
46 #  endif
47 # endif
48 #endif
49
50 /* This is a bodge, but it's only used by the tests */
51 #define emalloc(x) malloc(x)