diff options
Diffstat (limited to 'pkg/sentry/state')
-rw-r--r-- | pkg/sentry/state/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/state/state_unsafe.go | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/pkg/sentry/state/BUILD b/pkg/sentry/state/BUILD index 563d60578..3e801182c 100644 --- a/pkg/sentry/state/BUILD +++ b/pkg/sentry/state/BUILD @@ -21,5 +21,6 @@ go_library( "//pkg/sentry/watchdog", "//pkg/state/statefile", "//pkg/syserror", + "@org_golang_x_sys//unix:go_default_library", ], ) diff --git a/pkg/sentry/state/state_unsafe.go b/pkg/sentry/state/state_unsafe.go index d271c6fc9..a3da028c4 100644 --- a/pkg/sentry/state/state_unsafe.go +++ b/pkg/sentry/state/state_unsafe.go @@ -16,17 +16,17 @@ package state import ( "fmt" - "syscall" "time" "unsafe" + "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" ) // CPUTime returns the CPU time usage by Sentry and app. func CPUTime() (time.Duration, error) { - var ts syscall.Timespec - _, _, errno := syscall.RawSyscall(syscall.SYS_CLOCK_GETTIME, uintptr(linux.CLOCK_PROCESS_CPUTIME_ID), uintptr(unsafe.Pointer(&ts)), 0) + var ts unix.Timespec + _, _, errno := unix.RawSyscall(unix.SYS_CLOCK_GETTIME, uintptr(linux.CLOCK_PROCESS_CPUTIME_ID), uintptr(unsafe.Pointer(&ts)), 0) if errno != 0 { return 0, fmt.Errorf("failed calling clock_gettime(CLOCK_PROCESS_CPUTIME_ID): errno=%d", errno) } |