Skip to contentSkip to conversation

erofs-utils: lib: fix undeclared gettid()

PATCH New Gao Xiang 1 participant 1 message Jul 14

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: fix undeclared gettid()

gettid() is only available since glibc 2.30.

Fixes 799c933bbefb ("erofs-utils: add ublk userspace block device backend")
---
 configure.ac        | 1 +
 lib/backends/ublk.c | 5 +++++
 2 files changed, 6 insertions(+)
configure.ac +1 -0
index ddee374b6e85..25a48922c1dc 100644
@@ -284,6 +284,7 @@ AC_CHECK_FUNCS(m4_flatten([
 	fallocate
 	getrandom
 	getrlimit
+	gettid
 	gettimeofday
 	lgetxattr
 	llistxattr
lib/backends/ublk.c +5 -0
index b63d121e54ac..d2c5e1968014 100644
@@ -29,6 +29,11 @@
 #include <liburing.h>
 #endif
 
+#ifndef HAVE_GETTID
+#include <sys/syscall.h>
+#define gettid() syscall(__NR_gettid)
+#endif
+
 /* (Legacy) Admin commands, issued by ublk server, and handled by ublk driver */
 #define UBLK_CMD_GET_QUEUE_AFFINITY	0x01
 #define UBLK_CMD_GET_DEV_INFO		0x02
Signature · 1 line
2.43.5