Skip to content

Commit

Permalink
handle EOPNOTSUPP when checking for hw.smt
Browse files Browse the repository at this point in the history
if hw.smt is not applicable for the current platform (e.g. i386),
pretend it's enabled
  • Loading branch information
omar-polo committed Mar 19, 2019
1 parent c28fe78 commit 53ce014
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cpu/cpu_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os/exec"
"strconv"
"strings"
"syscall"

"github.com/shirou/gopsutil/internal/common"
"golang.org/x/sys/unix"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 53ce014

Please sign in to comment.