|
@@ -6,8 +6,6 @@ import (
|
|
|
"runtime"
|
|
|
"syscall"
|
|
|
"unsafe"
|
|
|
-
|
|
|
- "golang.org/x/sys/unix"
|
|
|
)
|
|
|
|
|
|
// numCPU queries the system for the count of threads available
|
|
@@ -17,10 +15,10 @@ import (
|
|
|
// Returns 0 on errors. Use |runtime.NumCPU| in that case.
|
|
|
func numCPU() int {
|
|
|
// Gets the affinity mask for a process: The very one invoking this function.
|
|
|
- pid, _, _ := syscall.RawSyscall(unix.SYS_GETPID, 0, 0, 0)
|
|
|
+ pid, _, _ := syscall.RawSyscall(syscall.SYS_GETPID, 0, 0, 0)
|
|
|
|
|
|
var mask [1024 / 64]uintptr
|
|
|
- _, _, err := syscall.RawSyscall(unix.SYS_SCHED_GETAFFINITY, pid, uintptr(len(mask)*8), uintptr(unsafe.Pointer(&mask[0])))
|
|
|
+ _, _, err := syscall.RawSyscall(syscall.SYS_SCHED_GETAFFINITY, pid, uintptr(len(mask)*8), uintptr(unsafe.Pointer(&mask[0])))
|
|
|
if err != 0 {
|
|
|
return 0
|
|
|
}
|