Files
termux-packages/packages/fex/getcpu_emulation.patch
2022-09-05 23:40:28 +00:00

28 lines
670 B
Diff

diff --git a/Source/Tests/VDSO_Emulation.cpp b/Source/Tests/VDSO_Emulation.cpp
index d03cfa4b6..cb12a352a 100644
--- a/Source/Tests/VDSO_Emulation.cpp
+++ b/Source/Tests/VDSO_Emulation.cpp
@@ -12,6 +12,22 @@
#include <sys/time.h>
#include <unistd.h>
+#ifdef TERMUX_BUILD
+// getcpu doesn't exist in termux. Expectation is to use sched_getcpu.
+#include <sched.h>
+int getcpu(uint32_t *cpu, uint32_t *node) {
+ if (cpu) {
+ *cpu = ::sched_getcpu();
+ }
+ if (node) {
+ // No node information
+ *node = 0;
+ }
+
+ return 0;
+}
+#endif
+
namespace FEX::VDSO {
using TimeType = decltype(::time)*;
using GetTimeOfDayType = decltype(::gettimeofday)*;