diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2023-04-10 19:06:39 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-04-12 15:36:03 -0400 |
| commit | 490a411fd4e00fee65bc014fa7b1af59042d269b (patch) | |
| tree | c825687c6b277e64ee844fa5944e8751abed5b56 /lib/std | |
| parent | ccf670c2b04ebeb9db43eb9f5c47c6cf03e4b1d0 (diff) | |
| download | zig-490a411fd4e00fee65bc014fa7b1af59042d269b.tar.gz zig-490a411fd4e00fee65bc014fa7b1af59042d269b.zip | |
openbsd: fix thread name buffer size
OpenBSD 7.3 changed its implementation of
pthread_get_name_np/pthread_set_name_np to wrap new libc functions
getthrname/setthrname and lowered the max buffer size from 32 to 24.
This is not a backwards-compatible change because if we were to put in
comptime version logic to use size 32 when target < 7.3 the binaries
would be undefined when running on >= 7.3. It also could simply be that
OpenBSD has a policy to not support older binaries running on newer
releases? Regardless, the safest course is to simply use the smallest
known buffer size.
As an aside, this bug manifested as a "hung" std.Thread test because 7.3
pthread API never checks for error result when wrapping getthrname/setthrname.
This is not a problem in std.Thread when we use the correct max buffer
size because ERANGE/EINVAL become unreachable.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/Thread.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index e3345e4a42..45ab4d36e3 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -40,7 +40,7 @@ pub const max_name_len = switch (target.os.tag) { .macos, .ios, .watchos, .tvos => 63, .netbsd => 31, .freebsd => 15, - .openbsd => 31, + .openbsd => 23, .dragonfly => 1023, .solaris => 31, else => 0, |
