Skip to content

Commit

Permalink
cgen: patch missing gettid() on glibc < 2.30 (#22987)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp authored Nov 27, 2024
1 parent 8703dc1 commit 273adcc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,12 @@ pub fn (mut g Gen) init() {
g.cheaders.writeln('#define __TARGET_IOS__ 1')
g.cheaders.writeln('#include <spawn.h>')
}
if g.pref.os == .linux {
g.cheaders.writeln('#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 30')
g.cheaders.writeln('#include <sys/syscall.h>')
g.cheaders.writeln('#define gettid() syscall(SYS_gettid)')
g.cheaders.writeln('#endif')
}
g.write_builtin_types()
g.options_pos_forward = g.type_definitions.len
g.write_typedef_types()
Expand Down

0 comments on commit 273adcc

Please sign in to comment.