Merge branch 'v0.20.x'

This commit is contained in:
Max Kellermann
2017-12-16 20:50:53 +01:00
105 changed files with 270 additions and 240 deletions

View File

@@ -19,7 +19,7 @@
#include "Clock.hxx"
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
gcc_const

View File

@@ -22,7 +22,7 @@
#include "Compiler.h"
#ifdef WIN32
#ifdef _WIN32
/**
* Returns the uptime of the current process in seconds.

View File

@@ -22,7 +22,7 @@
#include "EPollFD.hxx"
#include "Error.hxx"
#ifdef __BIONIC__
#if defined(__BIONIC__) && __ANDROID_API__ < 21
#include <sys/syscall.h>
#include <fcntl.h>

View File

@@ -47,7 +47,7 @@ FormatSystemError(std::error_code code, const char *fmt,
return std::system_error(code, buffer);
}
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
@@ -90,7 +90,7 @@ FormatLastError(const char *fmt, Args&&... args) noexcept
std::forward<Args>(args)...);
}
#endif /* WIN32 */
#endif /* _WIN32 */
#include <errno.h>
#include <string.h>
@@ -106,7 +106,7 @@ FormatLastError(const char *fmt, Args&&... args) noexcept
static inline const std::error_category &
ErrnoCategory() noexcept
{
#ifdef WIN32
#ifdef _WIN32
/* on Windows, the generic_category() is used for errno
values */
return std::generic_category();
@@ -151,7 +151,7 @@ gcc_pure
static inline bool
IsFileNotFound(const std::system_error &e) noexcept
{
#ifdef WIN32
#ifdef _WIN32
return e.code().category() == std::system_category() &&
e.code().value() == ERROR_FILE_NOT_FOUND;
#else
@@ -164,7 +164,7 @@ gcc_pure
static inline bool
IsPathNotFound(const std::system_error &e) noexcept
{
#ifdef WIN32
#ifdef _WIN32
return e.code().category() == std::system_category() &&
e.code().value() == ERROR_PATH_NOT_FOUND;
#else
@@ -177,7 +177,7 @@ gcc_pure
static inline bool
IsAccessDenied(const std::system_error &e) noexcept
{
#ifdef WIN32
#ifdef _WIN32
return e.code().category() == std::system_category() &&
e.code().value() == ERROR_ACCESS_DENIED;
#else

View File

@@ -27,20 +27,20 @@
#include <assert.h>
#include <unistd.h>
#ifdef WIN32
#ifdef _WIN32
#include "net/IPv4Address.hxx"
#include "net/StaticSocketAddress.hxx"
#include "net/UniqueSocketDescriptor.hxx"
#include "net/SocketError.hxx"
#endif
#ifdef WIN32
#ifdef _WIN32
static void PoorSocketPair(int fd[2]);
#endif
EventPipe::EventPipe()
{
#ifdef WIN32
#ifdef _WIN32
PoorSocketPair(fds);
#else
FileDescriptor r, w;
@@ -54,7 +54,7 @@ EventPipe::EventPipe()
EventPipe::~EventPipe()
{
#ifdef WIN32
#ifdef _WIN32
closesocket(fds[0]);
closesocket(fds[1]);
#else
@@ -70,7 +70,7 @@ EventPipe::Read()
assert(fds[1] >= 0);
char buffer[256];
#ifdef WIN32
#ifdef _WIN32
return recv(fds[0], buffer, sizeof(buffer), 0) > 0;
#else
return read(fds[0], buffer, sizeof(buffer)) > 0;
@@ -83,14 +83,14 @@ EventPipe::Write()
assert(fds[0] >= 0);
assert(fds[1] >= 0);
#ifdef WIN32
#ifdef _WIN32
send(fds[1], "", 1, 0);
#else
gcc_unused ssize_t nbytes = write(fds[1], "", 1);
#endif
}
#ifdef WIN32
#ifdef _WIN32
/* Our poor man's socketpair() implementation
* Due to limited protocol/address family support

View File

@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#else
#include <errno.h>
@@ -61,7 +61,7 @@ FormatFatalError(const char *fmt, ...)
Abort();
}
#ifdef WIN32
#ifdef _WIN32
void
FatalSystemError(const char *msg, DWORD code)
@@ -79,7 +79,7 @@ FatalSystemError(const char *msg, DWORD code)
void
FatalSystemError(const char *msg)
{
#ifdef WIN32
#ifdef _WIN32
FatalSystemError(msg, GetLastError());
#else
const char *system_error = strerror(errno);

View File

@@ -23,7 +23,7 @@
#include "check.h"
#include "Compiler.h"
#ifdef WIN32
#ifdef _WIN32
#include <windef.h>
#endif
@@ -47,7 +47,7 @@ gcc_noreturn
void
FatalSystemError(const char *msg);
#ifdef WIN32
#ifdef _WIN32
gcc_noreturn
void