aboutsummaryrefslogtreecommitdiff
path: root/include/compat
diff options
context:
space:
mode:
authorkinichiro <kinichiro.inoguchi@gmail.com>2018-02-25 01:59:39 +0900
committerkinichiro <kinichiro.inoguchi@gmail.com>2018-02-25 21:56:05 +0900
commit3681d02253d29229e265720984ce81a35206de4c (patch)
tree95590bed234fb09e40e14feb5cdb6c0120f07334 /include/compat
parent47781e69e2946011ea7bd0723e98a2fedff88980 (diff)
downloadportable-3681d02253d29229e265720984ce81a35206de4c.tar.gz
portable-3681d02253d29229e265720984ce81a35206de4c.tar.bz2
portable-3681d02253d29229e265720984ce81a35206de4c.zip
Add compat bits for libtls on Windows
Diffstat (limited to 'include/compat')
-rw-r--r--include/compat/sys/types.h2
-rw-r--r--include/compat/unistd.h18
2 files changed, 20 insertions, 0 deletions
diff --git a/include/compat/sys/types.h b/include/compat/sys/types.h
index 473d6da..2107119 100644
--- a/include/compat/sys/types.h
+++ b/include/compat/sys/types.h
@@ -21,6 +21,7 @@
21#ifdef __MINGW32__ 21#ifdef __MINGW32__
22#include <_bsd_types.h> 22#include <_bsd_types.h>
23typedef uint32_t in_addr_t; 23typedef uint32_t in_addr_t;
24typedef uint32_t uid_t;
24#endif 25#endif
25 26
26#ifdef _MSC_VER 27#ifdef _MSC_VER
@@ -29,6 +30,7 @@ typedef unsigned short u_short;
29typedef unsigned int u_int; 30typedef unsigned int u_int;
30typedef uint32_t in_addr_t; 31typedef uint32_t in_addr_t;
31typedef uint32_t mode_t; 32typedef uint32_t mode_t;
33typedef uint32_t uid_t;
32 34
33#include <basetsd.h> 35#include <basetsd.h>
34typedef SSIZE_T ssize_t; 36typedef SSIZE_T ssize_t;
diff --git a/include/compat/unistd.h b/include/compat/unistd.h
index d596043..e70a390 100644
--- a/include/compat/unistd.h
+++ b/include/compat/unistd.h
@@ -7,7 +7,16 @@
7#define LIBCRYPTOCOMPAT_UNISTD_H 7#define LIBCRYPTOCOMPAT_UNISTD_H
8 8
9#ifndef _MSC_VER 9#ifndef _MSC_VER
10
10#include_next <unistd.h> 11#include_next <unistd.h>
12
13#ifdef __MINGW32__
14int ftruncate(int fd, off_t length);
15uid_t getuid(void);
16ssize_t pread(int d, void *buf, size_t nbytes, off_t offset);
17ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
18#endif
19
11#else 20#else
12 21
13#include <stdlib.h> 22#include <stdlib.h>
@@ -22,10 +31,19 @@
22#define X_OK 0 31#define X_OK 0
23#define F_OK 0 32#define F_OK 0
24 33
34#define SEEK_SET 0
35#define SEEK_CUR 1
36#define SEEK_END 2
37
25#define access _access 38#define access _access
26 39
27unsigned int sleep(unsigned int seconds); 40unsigned int sleep(unsigned int seconds);
28 41
42int ftruncate(int fd, off_t length);
43uid_t getuid(void);
44ssize_t pread(int d, void *buf, size_t nbytes, off_t offset);
45ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
46
29#endif 47#endif
30 48
31#ifndef HAVE_GETENTROPY 49#ifndef HAVE_GETENTROPY