Permalink
Browse files

Merge ionice_win

  • Loading branch information...
luke-jr committed Sep 14, 2017
2 parents 6a8229f + bd5b64d commit c590dfa43d30865e2d8c63150b6c6b9b0eccb235
Showing with 57 additions and 33 deletions.
  1. +27 −1 configure.ac
  2. +0 −7 src/compat.h
  3. +0 −9 src/qt/guiutil.cpp
  4. +0 −5 src/support/lockedpool.cpp
  5. +0 −11 src/util.cpp
  6. +22 −0 src/utilioprio.cpp
  7. +6 −0 src/utilioprio.h
  8. +2 −0 src/validation.cpp
View
@@ -383,7 +383,7 @@ case $host in
AC_MSG_ERROR("windres not found")
fi
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB"
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0600 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_THREAD_USE_LIB"
LEVELDB_TARGET_FLAGS="-DOS_WINDOWS"
if test "x$CXXFLAGS_overridden" = "xno"; then
CXXFLAGS="$CXXFLAGS -w"
@@ -680,6 +680,31 @@ else
have_ioprio_syscall=no
fi
AC_MSG_CHECKING(for Windows file I/O priority functions)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <io.h>
#include <stdio.h>
]],[[
static const FILE_IO_PRIORITY_HINT_INFO priorityHint = {
.PriorityHint = IoPriorityHintLow,
};
FILE * const F = fopen("test", "r");
HANDLE hFile = _get_osfhandle(_fileno(F));
SetFileInformationByHandle(hFile, FileIoPriorityHintInfo, &priorityHint, sizeof(priorityHint));
]])
],[
have_windows_ioprio=yes
AC_DEFINE(HAVE_WINDOWS_IOPRIO,1,[Define this symbol if you have Windows I/O priority functions])
],[
have_windows_ioprio=no
])
AC_MSG_RESULT($have_windows_ioprio)
dnl Check for MSG_NOSIGNAL
AC_MSG_CHECKING(for MSG_NOSIGNAL)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
@@ -1363,6 +1388,7 @@ AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
AM_CONDITIONAL([HAVE_IOPOLICY],[test x$have_iopolicy = xyes])
AM_CONDITIONAL([HAVE_IOPRIO_SYSCALL],[test x$have_ioprio_syscall = xyes])
AM_CONDITIONAL([HAVE_WINDOWS_IOPRIO],[test x$have_windows_ioprio = xyes])
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
AM_CONDITIONAL([ENABLE_HWCRC32],[test x$enable_hwcrc32 = xyes])
AM_CONDITIONAL([EXPERIMENTAL_ASM],[test x$experimental_asm = xyes])
View
@@ -11,13 +11,6 @@
#endif
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
View
@@ -19,15 +19,6 @@
#include "util.h"
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
@@ -10,11 +10,6 @@
#endif
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
View
@@ -49,17 +49,6 @@
#pragma warning(disable:4717)
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
View
@@ -55,3 +55,25 @@ int ioprio_set_idle() {
}
#endif
#ifdef HAVE_WINDOWS_IOPRIO
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <io.h>
bool ioprio_set_file_idle(FILE * const F) {
static const FILE_IO_PRIORITY_HINT_INFO priorityHint = {
.PriorityHint = IoPriorityHintLow,
};
HANDLE hFile = _get_osfhandle(_fileno(F));
return SetFileInformationByHandle(hFile, FileIoPriorityHintInfo, &priorityHint, sizeof(priorityHint));
}
#endif
View
@@ -54,4 +54,10 @@ class ioprio_idler {
#define IOPRIO_IDLER(actually_idle) (void)actually_idle;
#endif
#ifdef HAVE_WINDOWS_IOPRIO
bool ioprio_set_file_idle(FILE *);
#else
#define ioprio_set_file_idle(f) ((void)false)
#endif
#endif // BITCOIN_UTIL_IOPRIO_H
View
@@ -996,6 +996,8 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus:
if (filein.IsNull())
return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString());
ioprio_set_file_idle(filein.Get());
// Read block
try {
filein >> block;

0 comments on commit c590dfa

Please sign in to comment.