handle EOPNOTSUPP when checking for hw.smt

if hw.smt is not applicable for the current platform (e.g. i386),
pretend it's enabled
pull/647/head
Omar Polo 6 years ago
parent c28fe78291
commit 53ce014b14
No known key found for this signature in database
GPG Key ID: E483C355499D960D

@ -10,6 +10,7 @@ import (
"os/exec"
"strconv"
"strings"
"syscall"
"github.com/shirou/gopsutil/internal/common"
"golang.org/x/sys/unix"
@ -101,7 +102,11 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
}
smt, err := smt()
if err != nil {
if err == syscall.EOPNOTSUPP {
// if hw.smt is not applicable for this platform (e.g. i386),
// pretend it's enabled
smt = true
} else if err != nil {
return nil, err
}

Loading…
Cancel
Save