| ... | @@ -2607,31 +2607,3 @@ pub const domainset = extern struct { | ... | @@ -2607,31 +2607,3 @@ pub const domainset = extern struct { |
| 2607 | | 2607 | |
| 2608 | pub extern "c" fn cpuset_getdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *domainset_t, r: *c_int) c_int; | 2608 | pub extern "c" fn cpuset_getdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *domainset_t, r: *c_int) c_int; |
| 2609 | pub extern "c" fn cpuset_setdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *const domainset_t, r: c_int) c_int; | 2609 | pub extern "c" fn cpuset_setdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *const domainset_t, r: c_int) c_int; |
| 2610 | | | |
| 2611 | const ioctl_cmd = enum(u32) { | | |
| 2612 | VOID = 0x20000000, | | |
| 2613 | OUT = 0x40000000, | | |
| 2614 | IN = 0x80000000, | | |
| 2615 | INOUT = ioctl_cmd.IN | ioctl_cmd.OUT, | | |
| 2616 | DIRMASK = ioctl_cmd.VOID | ioctl_cmd.IN | ioctl_cmd.OUT, | | |
| 2617 | }; | | |
| 2618 | | | |
| 2619 | fn ioImpl(cmd: ioctl_cmd, op: u8, nr: u8, comptime IT: type) u32 { | | |
| 2620 | return @as(u32, @bitCast(@intFromEnum(cmd) | @as(u32, @intCast(@as(u8, @truncate(@sizeOf(IT))))) << 16 | @as(u32, @intCast(op)) << 8 | nr)); | | |
| 2621 | } | | |
| 2622 | | | |
| 2623 | pub fn IO(op: u8, nr: u8) u32 { | | |
| 2624 | return ioImpl(ioctl_cmd.VOID, op, nr, 0); | | |
| 2625 | } | | |
| 2626 | | | |
| 2627 | pub fn IOR(op: u8, nr: u8, comptime IT: type) u32 { | | |
| 2628 | return ioImpl(ioctl_cmd.OUT, op, nr, @sizeOf(IT)); | | |
| 2629 | } | | |
| 2630 | | | |
| 2631 | pub fn IOW(op: u8, nr: u8, comptime IT: type) u32 { | | |
| 2632 | return ioImpl(ioctl_cmd.IN, op, nr, @sizeOf(IT)); | | |
| 2633 | } | | |
| 2634 | | | |
| 2635 | pub fn IOWR(op: u8, nr: u8, comptime IT: type) u32 { | | |
| 2636 | return ioImpl(ioctl_cmd.INOUT, op, nr, @sizeOf(IT)); | | |
| 2637 | } | | |