Fix using right functions for file descriptor with MS Visual Studio

This commit is contained in:
kinichiro
2018-03-18 00:38:14 +09:00
parent 639a6629ae
commit 1fb8c9c6be
8 changed files with 59 additions and 2 deletions

View File

@@ -4,6 +4,8 @@
* Kinichiro Inoguchi <inoguchi@openbsd.org>
*/
#ifdef _WIN32
#include <unistd.h>
int
@@ -11,3 +13,5 @@ ftruncate(int fd, off_t length)
{
return _chsize(fd, length);
}
#endif

View File

@@ -4,6 +4,8 @@
* Kinichiro Inoguchi <inoguchi@openbsd.org>
*/
#ifdef _WIN32
#include <unistd.h>
uid_t
@@ -12,3 +14,5 @@ getuid(void)
/* Windows fstat sets 0 as st_uid */
return 0;
}
#endif

View File

@@ -4,6 +4,10 @@
* Kinichiro Inoguchi <inoguchi@openbsd.org>
*/
#ifdef _WIN32
#define NO_REDEF_POSIX_FUNCTIONS
#include <unistd.h>
ssize_t
@@ -21,3 +25,5 @@ pread(int d, void *buf, size_t nbytes, off_t offset)
return -1;
return bytes;
}
#endif

View File

@@ -4,6 +4,10 @@
* Kinichiro Inoguchi <inoguchi@openbsd.org>
*/
#ifdef _WIN32
#define NO_REDEF_POSIX_FUNCTIONS
#include <unistd.h>
ssize_t
@@ -21,3 +25,5 @@ pwrite(int d, const void *buf, size_t nbytes, off_t offset)
return -1;
return bytes;
}
#endif