Files
termux-packages/packages/nnn/pthread_setaffinity_np.patch
termux-pacman-bot ac369fc925 bump(main/nnn): v5.2
2026-02-16 21:47:31 +00:00

29 lines
990 B
Diff

diff --git a/src/nnn.c b/src/nnn.c
index 108e2995..9f7a832e 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -30,6 +30,9 @@
#define _FILE_OFFSET_BITS 64 /* Support large files on 32-bit glibc */
+#define _GNU_SOURCE
+#include <assert.h>
+#include <sched.h>
#if defined(__linux__) || defined(MINGW) || defined(__MINGW32__) \
|| defined(__MINGW64__) || defined(__CYGWIN__)
#ifndef _GNU_SOURCE
@@ -978,6 +981,13 @@ static uchar_t xchartohex(uchar_t c)
* Source: https://elixir.bootlin.com/linux/latest/source/arch/alpha/include/asm/bitops.h
* Optimized: atomic test-and-set per word so different inodes (different words) don't contend.
*/
+#if defined(__BIONIC__)
+static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+ cpu_set_t *cpuset) {
+ assert(pthread_equal(pthread_self(), thread));
+ return sched_setaffinity(0, cpusetsize, cpuset);
+}
+#endif
static inline bool test_set_bit(uint_t nr)
{
nr &= HASH_BITS;