upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/process.cpp
diff options
context:
space:
mode:
authorKam471 <115741199+Kam471@users.noreply.github.com>2026-11-23 16:13:00 +0000
committerubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com>2026-11-23 19:43:04 -0500
commitbb71bb4b4ca113e0750e8838595cf045c1f68678 (patch)
tree56bf324c8e524e52a682c08f9869f6946a328245 /runtime/shims/process.cpp
parentf35d19cb861d00154dbeadd16035af7a79095d4c (diff)
fixup: #6942 tests need fcntl/io and an explicit empty-mask refusal
(cherry picked from commit 6680cd1afce95352e428f2bf7f5772a1ab3cf936)
Diffstat (limited to 'runtime/shims/process.cpp')
-rw-r--r--runtime/shims/process.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index 407cea8ad..08023ea78 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -213,8 +213,14 @@ DWORD_PTR __stdcall game_set_thread_affinity_mask(HANDLE thread, DWORD_PTR mask)
213// the call returns TRUE and the out parameter gets the affinity the thread had. An empty mask names no CPU on any 213// the call returns TRUE and the out parameter gets the affinity the thread had. An empty mask names no CPU on any
214// machine and a bad handle is the host's own error: both are passed to the host and fail as on Windows. 214// machine and a bad handle is the host's own error: both are passed to the host and fail as on Windows.
215BOOL __stdcall game_set_thread_group_affinity(HANDLE thread, const GROUP_AFFINITY* requested, PGROUP_AFFINITY previous) { 215BOOL __stdcall game_set_thread_group_affinity(HANDLE thread, const GROUP_AFFINITY* requested, PGROUP_AFFINITY previous) {
216 // An empty mask names no CPU on any machine. Some Windows builds accept it and clear the affinity instead of
217 // failing, so answer the documented error before the host call rather than depending on the build.
218 if (!requested || requested->Mask == 0) {
219 SetLastError(ERROR_INVALID_PARAMETER);
220 return FALSE;
221 }
216 if (SetThreadGroupAffinity(thread, requested, previous)) return TRUE; 222 if (SetThreadGroupAffinity(thread, requested, previous)) return TRUE;
217 if (!requested || requested->Mask == 0 || GetLastError() != ERROR_INVALID_PARAMETER) return FALSE; 223 if (GetLastError() != ERROR_INVALID_PARAMETER) return FALSE;
218 GROUP_AFFINITY actual = {}; 224 GROUP_AFFINITY actual = {};
219 if (!GetThreadGroupAffinity(thread, &actual)) return FALSE; // the host's error stands 225 if (!GetThreadGroupAffinity(thread, &actual)) return FALSE; // the host's error stands
220 if (previous) *previous = actual; 226 if (previous) *previous = actual;