v29.4-roots.2 · Commit 1: [PATCH 01/21] build: port platform and dependency support
cmake/iopriority.cmake
Before: /dev/null · After: cmake/iopriority.cmake
File metadata
new file mode 100644 index 0000000000000000000000000000000000000000..29b60c380a09fb182d5b667f669051599eb76cc3
Download original patch · Release notes
Diff rows 1–55 of 55. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
cmake/iopriority.cmake
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2025-present The Bitcoin Roots developers
|
| 2 |
+
# Distributed under the MIT software license, see the accompanying
|
| 3 |
+
# file COPYING or https://opensource.org/license/mit/.
|
| 4 |
+
|
| 5 |
+
include(CheckCXXSourceCompiles)
|
| 6 |
+
|
| 7 |
+
check_cxx_source_compiles([[
|
| 8 |
+
#include <sys/resource.h>
|
| 9 |
+
|
| 10 |
+
int main()
|
| 11 |
+
{
|
| 12 |
+
int x = getiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD);
|
| 13 |
+
setiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD, x);
|
| 14 |
+
return x;
|
| 15 |
+
}
|
| 16 |
+
]] HAVE_IOPOLICY
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
check_cxx_source_compiles([[
|
| 20 |
+
#define _GNU_SOURCE
|
| 21 |
+
#include <unistd.h>
|
| 22 |
+
#include <sys/syscall.h>
|
| 23 |
+
|
| 24 |
+
int main()
|
| 25 |
+
{
|
| 26 |
+
int x = syscall(SYS_ioprio_get, 1, 0);
|
| 27 |
+
syscall(SYS_ioprio_set, 1, 0, x);
|
| 28 |
+
return x;
|
| 29 |
+
}
|
| 30 |
+
]] HAVE_IOPRIO_SYSCALL
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
check_cxx_source_compiles([[
|
| 34 |
+
#define _WIN32_WINNT 0x0601
|
| 35 |
+
#include <windows.h>
|
| 36 |
+
#include <io.h>
|
| 37 |
+
#include <stddef.h>
|
| 38 |
+
#include <stdint.h>
|
| 39 |
+
#include <stdio.h>
|
| 40 |
+
|
| 41 |
+
int main()
|
| 42 |
+
{
|
| 43 |
+
FILE_IO_PRIORITY_HINT_INFO priorityHint = {
|
| 44 |
+
.PriorityHint = IoPriorityHintLow,
|
| 45 |
+
};
|
| 46 |
+
FILE * const F = fopen("test", "r");
|
| 47 |
+
intptr_t osfhandle = _get_osfhandle(_fileno(F));
|
| 48 |
+
if (osfhandle == (intptr_t)INVALID_HANDLE_VALUE) osfhandle = 0;
|
| 49 |
+
HANDLE hFile = (HANDLE)osfhandle;
|
| 50 |
+
|
| 51 |
+
bool rv = SetFileInformationByHandle(hFile, FileIoPriorityHintInfo, &priorityHint, sizeof(priorityHint));
|
| 52 |
+
return rv;
|
| 53 |
+
}
|
| 54 |
+
]] HAVE_WINDOWS_IOPRIO
|
| 55 |
+
)
|