1
Fork 0
turbonss/lib/cgroup.zig

16 lines
598 B
Zig
Raw Normal View History

2022-04-19 07:18:41 +03:00
const meta = @import("std").meta;
2022-04-19 10:29:14 +03:00
// Name type should be 0-terminated, members should be null-terminated, but
// sentinel is not part of the type (but is always there). Adding sentinel
// crashes zig compiler in pre-0.10. https://github.com/ziglang/zig/issues/7517
2022-04-19 07:18:41 +03:00
pub const CGroup = struct {
gid: u32,
// should be [*:0]const u8
2022-04-19 10:24:32 +03:00
name: [*]const u8,
2022-04-19 07:18:41 +03:00
// Should be [*:null]align(1) const ?[*:0]const u8
2022-04-19 10:29:14 +03:00
members: [*]align(1) const ?[*:0]const u8,
2022-04-19 07:18:41 +03:00
};
// size of the pointer to a single member.
pub const ptr_size = @sizeOf(meta.Child(meta.fieldInfo(CGroup, .members).field_type));