From b909bdac4648a27c7a4cde2cb991d90221a36949 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 18 Dec 2025 00:03:24 -0800 Subject: [PATCH] add gettid --- mod.zig | 5 +++++ test.zig | 1 + 2 files changed, 6 insertions(+) diff --git a/mod.zig b/mod.zig index 5685fe81d3044ba743014cd2ad7978ecbee7cb5c..21ba365cb2731c4c961c4141af41db6d26b8f0e4 100644 --- a/mod.zig +++ b/mod.zig @@ -1388,6 +1388,7 @@ pub const libc = struct { // pub extern fn __errno_location() *c_int; + pub extern fn gettid() pid_t; }; pub const clock_t = c_long; @@ -1533,3 +1534,7 @@ pub fn mkdirat(fd: c_int, path: [*:0]const u8, mode: mode_t) errno.Error!void { pub fn pthread_self() pthread_t { return libc.pthread_self(); } + +pub fn gettid() pid_t { + return libc.gettid(); +} diff --git a/test.zig b/test.zig index c21b915c17682faa1ce0ab784002cbfe39769efc..83928ca2c648cc816cd4f929ede051decafafedd 100644 --- a/test.zig +++ b/test.zig @@ -14,4 +14,5 @@ test { _ = &linux.readv; _ = &linux.mkdirat; _ = &linux.pthread_self; + _ = &linux.gettid; } -- 2.54.0