diff options
Diffstat (limited to 'include/compat/unistd.h')
-rw-r--r-- | include/compat/unistd.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/compat/unistd.h b/include/compat/unistd.h new file mode 100644 index 0000000..4676dc8 --- /dev/null +++ b/include/compat/unistd.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * unistd.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H | ||
7 | #define LIBCRYPTOCOMPAT_UNISTD_H | ||
8 | |||
9 | #ifndef _MSC_VER | ||
10 | #include_next <unistd.h> | ||
11 | #else | ||
12 | |||
13 | #include <stdlib.h> | ||
14 | #include <io.h> | ||
15 | #include <process.h> | ||
16 | |||
17 | #define R_OK 4 | ||
18 | #define W_OK 2 | ||
19 | #define X_OK 0 | ||
20 | #define F_OK 0 | ||
21 | |||
22 | #define access _access | ||
23 | |||
24 | static inline unsigned int sleep(unsigned int seconds) | ||
25 | { | ||
26 | Sleep(seconds * 1000); | ||
27 | return seconds; | ||
28 | } | ||
29 | |||
30 | #endif | ||
31 | |||
32 | #ifndef HAVE_GETENTROPY | ||
33 | int getentropy(void *buf, size_t buflen); | ||
34 | #endif | ||
35 | |||
36 | #endif | ||