Skip to contentSkip to conversation

libtracefs: Use getpid instead of gettid

PATCH In review Tzvetomir Stoyanov (VMware) 2 participants 2 messages Nov 18, 2021 – Nov 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Use getpid instead of gettid

The gettid() call is not available on Jetson Nano running Ubuntu 18.04 for aarch64. This function is used to compose a random seed, replaced it with getpid().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203871

---
 src/tracefs-hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/tracefs-hist.c +1 -1
index 005fa8f..085c10b 100644
@@ -1121,7 +1121,7 @@ static unsigned int make_rand(void)
 	unsigned long seed;
 
 	gettimeofday(&tv, NULL);
-	seed = (tv.tv_sec + tv.tv_usec) + gettid();
+	seed = (tv.tv_sec + tv.tv_usec) + getpid();
 
 	/* taken from the rand(3) man page */
 	seed = seed * 1103515245 + 12345;
Signature · 1 line
2.33.1
#1 lore raw
Quoted 8 lines · On Thu, 18 Nov 2021 18:57:27 +0200 "Tzvetomir Stoyanov (VMware)"…

The gettid() call is not available on Jetson Nano running Ubuntu 18.04 for aarch64. This function is used to compose a random seed, replaced it with getpid().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203871

---

I guess I hit this earlier but never applied my fix :-/

https://patchwork.kernel.org/project/linux-trace-devel/patch/[email protected]/

-- Steve