mirror of
https://github.com/henrygd/beszel.git
synced 2026-08-19 08:47:46 +02:00
gopsutil's host.Uptime() calls the sysinfo(2) syscall. Inside an LXC container lxcfs virtualizes /proc/uptime but cannot intercept a syscall, so every container reported the host's uptime. Reads /proc/uptime on linux and falls back to host.Uptime() if the file is missing or unparseable, so other platforms are unchanged.
11 lines
189 B
Go
11 lines
189 B
Go
//go:build !linux
|
|
|
|
package agent
|
|
|
|
import "github.com/shirou/gopsutil/v4/host"
|
|
|
|
// getUptime returns the system uptime in seconds.
|
|
func getUptime() (uint64, error) {
|
|
return host.Uptime()
|
|
}
|