Source
pub const pthread_rwlock_t = switch (native_os) {
.linux => switch (native_abi) {
.android, .androideabi => switch (@sizeOf(usize)) {
4 => extern struct {
data: [40]u8 align(@alignOf(usize)) = [_]u8{0} ** 40,
},
8 => extern struct {
data: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56,
},
else => @compileError("impossible pointer size"),
},
else => extern struct {
data: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56,
},
},
.macos, .ios, .tvos, .watchos, .visionos => extern struct {
sig: c_long = 0x2DA8B3B4,
data: [192]u8 = [_]u8{0} ** 192,
},
.freebsd, .dragonfly, .openbsd => extern struct {
ptr: ?*anyopaque = null,
},
.hermit => extern struct {
ptr: usize = maxInt(usize),
},
.netbsd => extern struct {
magic: c_uint = 0x99990009,
interlock: switch (builtin.cpu.arch) {
.aarch64, .sparc, .x86_64, .x86 => u8,
.arm, .powerpc => c_int,
else => unreachable,
} = 0,
rblocked_first: ?*u8 = null,
rblocked_last: ?*u8 = null,
wblocked_first: ?*u8 = null,
wblocked_last: ?*u8 = null,
nreaders: c_uint = 0,
owner: ?pthread_t = null,
private: ?*anyopaque = null,
},
.solaris, .illumos => extern struct {
readers: i32 = 0,
type: u16 = 0,
magic: u16 = 0x5257,
mutex: pthread_mutex_t = .{},
readercv: pthread_cond_t = .{},
writercv: pthread_cond_t = .{},
},
.fuchsia => extern struct {
size: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56,
},
.emscripten => extern struct {
size: [32]u8 align(4) = [_]u8{0} ** 32,
},
// https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L86
.serenity => extern struct {
inner: u64 = 0,
},
else => void,
}