]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD regtest: Implement setaffinity in gdb sleepers for nlvgdbsigqueue
authorPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 7 Feb 2025 20:29:23 +0000 (21:29 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 7 Feb 2025 20:29:23 +0000 (21:29 +0100)
Doesn't seem to help, the test is still very flaky on recent (2025) hardware.

gdbserver_tests/sleepers.c

index b433c19847afa3abecd1282c6f03ed54b87c9763..e884c9b8fe170d19c28586a2e0a8cfc1ad2ab890 100644 (file)
@@ -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 ?
 }