Skip to content

Commit 27f1ea1

Browse files
committed
Replace gettid() with syscall(SYS_gettid) for earlier glibc versions
1 parent 45a60cd commit 27f1ea1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spdlog/src/record.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ fn get_current_tid() -> u64 {
261261
#[cfg(target_os = "linux")]
262262
#[must_use]
263263
fn get_current_tid_inner() -> u64 {
264-
let tid = unsafe { libc::gettid() };
264+
// https://github.com/SpriteOvO/spdlog-rs/issues/31
265+
//
266+
// We don't use `gettid` since earlier glibc versions (before v2.30) did not
267+
// provide a wrapper for this system call.
268+
let tid = unsafe { libc::syscall(libc::SYS_gettid) };
265269
tid as u64
266270
}
267271

0 commit comments

Comments
 (0)