| author | |
| committer | |
| log | 182bec87718dda88406575f0dea18bf11954c88c |
| tree | 782b9bdeef18f97a4a8ac9c48b01c639dbd65916 |
| parent | 86a5edca6238f4c9b861931e40d8cbe005568819 |
This reverts commit c7bf8bab38f8b89c1371eedb9229e00a29b5ca5b.3 files changed, 0 insertions(+), 63 deletions(-)
lib/std/c/linux.zig-5| ... | ... | @@ -13,10 +13,6 @@ pub const ARCH = linux.ARCH; |
| 13 | 13 | pub const AT = linux.AT; |
| 14 | 14 | pub const CLOCK = linux.CLOCK; |
| 15 | 15 | pub const CPU_COUNT = linux.CPU_COUNT; |
| 16 | pub const CPU_SET = linux.CPU_SET; | |
| 17 | pub const CPU_ISSET = linux.CPU_ISSET; | |
| 18 | pub const CPU_CLR = linux.CPU_CLR; | |
| 19 | pub const CPU_ZERO = linux.CPU_ZERO; | |
| 20 | 16 | pub const E = linux.E; |
| 21 | 17 | pub const Elf_Symndx = linux.Elf_Symndx; |
| 22 | 18 | pub const F = linux.F; |
| ... | ... | @@ -249,7 +245,6 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_ |
| 249 | 245 | |
| 250 | 246 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; |
| 251 | 247 | pub extern "c" fn sched_getaffinity(pid: c_int, size: usize, set: *cpu_set_t) c_int; |
| 252 | pub extern "c" fn sched_setaffinity(pid: c_int, size: usize, set: *const cpu_set_t) c_int; | |
| 253 | 248 | pub extern "c" fn eventfd(initval: c_uint, flags: c_uint) c_int; |
| 254 | 249 | pub extern "c" fn epoll_ctl(epfd: fd_t, op: c_uint, fd: fd_t, event: ?*epoll_event) c_int; |
| 255 | 250 | pub extern "c" fn epoll_create1(flags: c_uint) c_int; |
lib/std/os.zig-21| ... | ... | @@ -5494,7 +5494,6 @@ pub fn clock_getres(clk_id: i32, res: *timespec) ClockGetTimeError!void { |
| 5494 | 5494 | } |
| 5495 | 5495 | |
| 5496 | 5496 | pub const SchedGetAffinityError = error{PermissionDenied} || UnexpectedError; |
| 5497 | pub const SchedSetAffinityError = error{ InvalidCpu, PermissionDenied } || UnexpectedError; | |
| 5498 | 5497 | |
| 5499 | 5498 | pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t { |
| 5500 | 5499 | var set: cpu_set_t = undefined; |
| ... | ... | @@ -5522,26 +5521,6 @@ pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t { |
| 5522 | 5521 | } |
| 5523 | 5522 | } |
| 5524 | 5523 | |
| 5525 | pub fn sched_setaffinity(pid: pid_t, cpus: []usize) SchedSetAffinityError!cpu_set_t { | |
| 5526 | var set: cpu_set_t = undefined; | |
| 5527 | if (builtin.os.tag == .linux) { | |
| 5528 | system.CPU_ZERO(&set); | |
| 5529 | for (cpus) |cpu| { | |
| 5530 | system.CPU_SET(cpu, &set); | |
| 5531 | } | |
| 5532 | switch (errno(system.sched_setaffinity(pid, @sizeOf(cpu_set_t), &set))) { | |
| 5533 | .SUCCESS => return set, | |
| 5534 | .FAULT => unreachable, | |
| 5535 | .SRCH => unreachable, | |
| 5536 | .INVAL => return error.InvalidCpu, | |
| 5537 | .PERM => return error.PermissionDenied, | |
| 5538 | else => |err| return unexpectedErrno(err), | |
| 5539 | } | |
| 5540 | } else { | |
| 5541 | @compileError("unsupported platform"); | |
| 5542 | } | |
| 5543 | } | |
| 5544 | ||
| 5545 | 5524 | /// Used to convert a slice to a null terminated slice on the stack. |
| 5546 | 5525 | /// TODO https://github.com/ziglang/zig/issues/287 |
| 5547 | 5526 | pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 { |
lib/std/os/linux.zig-37| ... | ... | @@ -1536,12 +1536,6 @@ pub fn mbind(addr: ?*anyopaque, len: u32, mode: i32, nodemask: *const u32, maxno |
| 1536 | 1536 | return syscall6(.mbind, @intFromPtr(addr), len, @as(usize, @bitCast(@as(isize, mode))), @intFromPtr(nodemask), maxnode, flags); |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | pub fn sched_setaffinity(pid: pid_t, size: usize, set: *const cpu_set_t) usize { | |
| 1540 | const rc = syscall3(.sched_setaffinity, @as(usize, @bitCast(@as(isize, pid))), size, @intFromPtr(set)); | |
| 1541 | if (@as(isize, @bitCast(rc)) < 0) return rc; | |
| 1542 | return 0; | |
| 1543 | } | |
| 1544 | ||
| 1545 | 1539 | pub fn epoll_create() usize { |
| 1546 | 1540 | return epoll_create1(0); |
| 1547 | 1541 | } |
| ... | ... | @@ -3560,11 +3554,6 @@ pub const CPU_SETSIZE = 128; |
| 3560 | 3554 | pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize; |
| 3561 | 3555 | pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8)); |
| 3562 | 3556 | |
| 3563 | fn cpu_mask(s: usize) cpu_count_t { | |
| 3564 | var x = s & (CPU_SETSIZE * 8); | |
| 3565 | return @as(cpu_count_t, @intCast(1)) << @as(u4, @intCast(x)); | |
| 3566 | } | |
| 3567 | ||
| 3568 | 3557 | pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 3569 | 3558 | var sum: cpu_count_t = 0; |
| 3570 | 3559 | for (set) |x| { |
| ... | ... | @@ -3573,32 +3562,6 @@ pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 3573 | 3562 | return sum; |
| 3574 | 3563 | } |
| 3575 | 3564 | |
| 3576 | pub fn CPU_ZERO(set: *cpu_set_t) void { | |
| 3577 | @memset(set, 0); | |
| 3578 | } | |
| 3579 | ||
| 3580 | pub fn CPU_SET(cpu: usize, set: *cpu_set_t) void { | |
| 3581 | const x = cpu / @sizeOf(usize); | |
| 3582 | if (x < @sizeOf(cpu_set_t)) { | |
| 3583 | (set.*)[x] |= cpu_mask(x); | |
| 3584 | } | |
| 3585 | } | |
| 3586 | ||
| 3587 | pub fn CPU_ISSET(cpu: usize, set: cpu_set_t) bool { | |
| 3588 | const x = cpu / @sizeOf(usize); | |
| 3589 | if (x < @sizeOf(cpu_set_t)) { | |
| 3590 | return set[x] & cpu_mask(x) != 0; | |
| 3591 | } | |
| 3592 | return false; | |
| 3593 | } | |
| 3594 | ||
| 3595 | pub fn CPU_CLR(cpu: usize, set: *cpu_set_t) void { | |
| 3596 | const x = cpu / @sizeOf(usize); | |
| 3597 | if (x < @sizeOf(cpu_set_t)) { | |
| 3598 | (set.*)[x] &= !cpu_mask(x); | |
| 3599 | } | |
| 3600 | } | |
| 3601 | ||
| 3602 | 3565 | pub const MINSIGSTKSZ = switch (native_arch) { |
| 3603 | 3566 | .x86, .x86_64, .arm, .mipsel => 2048, |
| 3604 | 3567 | .aarch64 => 5120, |