From 98cc2209b5c1690a8d181d372c6a248fbd3b2134 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 7 Feb 2025 21:29:23 +0100 Subject: [PATCH] FreeBSD regtest: Implement setaffinity in gdb sleepers for nlvgdbsigqueue Doesn't seem to help, the test is still very flaky on recent (2025) hardware. --- gdbserver_tests/sleepers.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gdbserver_tests/sleepers.c b/gdbserver_tests/sleepers.c index b433c19847..e884c9b8fe 100644 --- a/gdbserver_tests/sleepers.c +++ b/gdbserver_tests/sleepers.c @@ -15,7 +15,7 @@ static int sleepms = 1000; // in each loop, will sleep "sleepms" milliseconds static int burn = 0; // after each sleep, will burn cpu in a tight 'burn' loop static void setup_sigusr_handler(void); // sigusr1 and 2 sigaction setup. -static pid_t gettid_sys() +static pid_t gettid_sys(void) { #ifdef __NR_gettid return syscall(__NR_gettid); @@ -32,7 +32,7 @@ void whoami(char *msg) } -static void do_burn () +static void do_burn(void) { int i; int loopnr = 0; @@ -126,6 +126,12 @@ static void setaffinity(void) CPU_ZERO(&single_cpu); CPU_SET(1, &single_cpu); (void) sched_setaffinity(0, sizeof(single_cpu), &single_cpu); +#endif +#ifdef VGO_freebsd + cpu_set_t single_cpu; + CPU_ZERO(&single_cpu); + CPU_SET(1, &single_cpu); + pthread_setaffinity_np(pthread_self(), sizeof(single_cpu), &single_cpu); #endif // GDBTD: equivalent for Darwin ? } -- 2.47.2