update libressl to 2.8.2
[unleashed.git] / lib / libcrypto / compat / include / unistd.h
blobf521b943b3ad480d941d9b71e14d253b9cc0bfac
1 /*
2 * Public domain
3 * unistd.h compatibility shim
4 */
6 #ifndef LIBCRYPTOCOMPAT_UNISTD_H
7 #define LIBCRYPTOCOMPAT_UNISTD_H
9 #ifndef _MSC_VER
11 #include_next <unistd.h>
13 #ifdef __MINGW32__
14 int ftruncate(int fd, off_t length);
15 uid_t getuid(void);
16 ssize_t pread(int d, void *buf, size_t nbytes, off_t offset);
17 ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
18 #endif
20 #else
22 #include <stdlib.h>
23 #include <io.h>
24 #include <process.h>
26 #define STDOUT_FILENO 1
27 #define STDERR_FILENO 2
29 #define R_OK 4
30 #define W_OK 2
31 #define X_OK 0
32 #define F_OK 0
34 #define SEEK_SET 0
35 #define SEEK_CUR 1
36 #define SEEK_END 2
38 #define access _access
40 unsigned int sleep(unsigned int seconds);
42 int ftruncate(int fd, off_t length);
43 uid_t getuid(void);
44 ssize_t pread(int d, void *buf, size_t nbytes, off_t offset);
45 ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
47 #endif
49 #ifndef HAVE_GETENTROPY
50 int getentropy(void *buf, size_t buflen);
51 #else
53 * Solaris 11.3 adds getentropy(2), but defines the function in sys/random.h
55 #if defined(__sun)
56 #include <sys/random.h>
57 #endif
58 #endif
60 #ifndef HAVE_GETPAGESIZE
61 int getpagesize(void);
62 #endif
64 #define pledge(request, paths) 0
65 #define unveil(path, permissions) 0
67 #ifndef HAVE_PIPE2
68 int pipe2(int fildes[2], int flags);
69 #endif
71 #endif