| ... | @@ -146,12 +146,7 @@ pub const addrinfo = system.addrinfo; | ... | @@ -146,12 +146,7 @@ pub const addrinfo = system.addrinfo; |
| 146 | pub const blkcnt_t = system.blkcnt_t; | 146 | pub const blkcnt_t = system.blkcnt_t; |
| 147 | pub const blksize_t = system.blksize_t; | 147 | pub const blksize_t = system.blksize_t; |
| 148 | pub const clock_t = system.clock_t; | 148 | pub const clock_t = system.clock_t; |
| 149 | pub const cpu_set_t = if (builtin.os.tag == .linux) | 149 | pub const cpu_set_t = system.cpu_set_t; |
| 150 | system.cpu_set_t | | |
| 151 | else if (builtin.os.tag == .freebsd) | | |
| 152 | freebsd.cpuset_t | | |
| 153 | else | | |
| 154 | u32; | | |
| 155 | pub const dev_t = system.dev_t; | 150 | pub const dev_t = system.dev_t; |
| 156 | pub const dl_phdr_info = system.dl_phdr_info; | 151 | pub const dl_phdr_info = system.dl_phdr_info; |
| 157 | pub const empty_sigset = system.empty_sigset; | 152 | pub const empty_sigset = system.empty_sigset; |
| ... | @@ -5492,27 +5487,13 @@ pub const SchedGetAffinityError = error{PermissionDenied} || UnexpectedError; | ... | @@ -5492,27 +5487,13 @@ pub const SchedGetAffinityError = error{PermissionDenied} || UnexpectedError; |
| 5492 | | 5487 | |
| 5493 | pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t { | 5488 | pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t { |
| 5494 | var set: cpu_set_t = undefined; | 5489 | var set: cpu_set_t = undefined; |
| 5495 | if (builtin.os.tag == .linux) { | 5490 | switch (errno(system.sched_getaffinity(pid, @sizeOf(cpu_set_t), &set))) { |
| 5496 | switch (errno(system.sched_getaffinity(pid, @sizeOf(cpu_set_t), &set))) { | 5491 | .SUCCESS => return set, |
| 5497 | .SUCCESS => return set, | 5492 | .FAULT => unreachable, |
| 5498 | .FAULT => unreachable, | 5493 | .INVAL => unreachable, |
| 5499 | .INVAL => unreachable, | 5494 | .SRCH => unreachable, |
| 5500 | .SRCH => unreachable, | 5495 | .PERM => return error.PermissionDenied, |
| 5501 | .PERM => return error.PermissionDenied, | 5496 | else => |err| return unexpectedErrno(err), |
| 5502 | else => |err| return unexpectedErrno(err), | | |
| 5503 | } | | |
| 5504 | } else if (builtin.os.tag == .freebsd) { | | |
| 5505 | switch (errno(freebsd.cpuset_getaffinity(freebsd.CPU_LEVEL_WHICH, freebsd.CPU_WHICH_PID, pid, @sizeOf(cpu_set_t), &set))) { | | |
| 5506 | .SUCCESS => return set, | | |
| 5507 | .FAULT => unreachable, | | |
| 5508 | .INVAL => unreachable, | | |
| 5509 | .SRCH => unreachable, | | |
| 5510 | .EDEADLK => unreachable, | | |
| 5511 | .PERM => return error.PermissionDenied, | | |
| 5512 | else => |err| return unexpectedErrno(err), | | |
| 5513 | } | | |
| 5514 | } else { | | |
| 5515 | @compileError("unsupported platform"); | | |
| 5516 | } | 5497 | } |
| 5517 | } | 5498 | } |
| 5518 | | 5499 | |