authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:05:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:05:21-07:00
log6d7c6f4da7a1bdcd2c2527cccb9c1a4423439012
tree0faa2d0c287a9790cfefa30933d666a10cf399a2
parentf3fa47a984a890fe7d341a8230c76592703710e6

Revert "std.c: adding freebsd's ioctl base operands."

This reverts commit cd7e2bf57a4da6965df9a2d8662a9b95f63cf595.

1 files changed, 0 insertions(+), 28 deletions(-)

lib/std/c/freebsd.zig-28
...@@ -2607,31 +2607,3 @@ pub const domainset = extern struct {...@@ -2607,31 +2607,3 @@ pub const domainset = extern struct {
26072607
2608pub extern "c" fn cpuset_getdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *domainset_t, r: *c_int) c_int;2608pub extern "c" fn cpuset_getdomain(level: cpulevel_t, which: cpuwhich_t, id: id_t, len: usize, domain: *domainset_t, r: *c_int) c_int;
2609pub 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;2609pub 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
2611const 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
2619fn 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
2623pub fn IO(op: u8, nr: u8) u32 {
2624 return ioImpl(ioctl_cmd.VOID, op, nr, 0);
2625}
2626
2627pub fn IOR(op: u8, nr: u8, comptime IT: type) u32 {
2628 return ioImpl(ioctl_cmd.OUT, op, nr, @sizeOf(IT));
2629}
2630
2631pub fn IOW(op: u8, nr: u8, comptime IT: type) u32 {
2632 return ioImpl(ioctl_cmd.IN, op, nr, @sizeOf(IT));
2633}
2634
2635pub fn IOWR(op: u8, nr: u8, comptime IT: type) u32 {
2636 return ioImpl(ioctl_cmd.INOUT, op, nr, @sizeOf(IT));
2637}