diff mbox series

libtracefs: Use getpid instead of gettid

Message ID 20211118165727.75994-1-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit 98a40dd3b149e8b6c073c22b7e7f5c13bdb9c232
Delegated to: Steven Rostedt
Headers show
Series libtracefs: Use getpid instead of gettid | expand

Commit Message

Tzvetomir Stoyanov (VMware) Nov. 18, 2021, 4:57 p.m. UTC
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
Reported-by: Alan Mikhak <amikhak@wirelessfabric.com>
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 src/tracefs-hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Rostedt Nov. 21, 2021, 9:25 p.m. UTC | #1
On Thu, 18 Nov 2021 18:57:27 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> 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
> Reported-by: Alan Mikhak <amikhak@wirelessfabric.com>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---

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

https://patchwork.kernel.org/project/linux-trace-devel/patch/20210825195300.0f15d98a@rorschach.local.home/

-- Steve
diff mbox series

Patch

diff --git a/src/tracefs-hist.c b/src/tracefs-hist.c
index 005fa8f..085c10b 100644
--- a/src/tracefs-hist.c
+++ b/src/tracefs-hist.c
@@ -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;