Commit Graph

36 Commits (30aff030d0edbef6c4a54172a038358405eb3829)

Author SHA1 Message Date
shirou 37f531010d fix golangcilint errors, ignore gosec G115 7 months ago
shirou ab0d977709 [sensors] move Temperatures from host to sensors. 10 months ago
shirou bc060cc227 add SPDX License, remove old build tag, and replace import 10 months ago
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io 2 years ago
mmorel-35 1e6b445a8a gofumpt 3 years ago
shirou 0969c9436b delete v2 directory, move v3 to top #1078 3 years ago
Sergey Vinogradov 5209442b3c Refactor "host" package 5 years ago
Tobias Klauser 28890b0482 Use common implementation for BootTime/Uptime on all BSDs
All BSDs use the same implementation to get BootTime{,WithContext} and
Uptime{,WithContext} based on the kern.boottime sysctl. Move this
implementation to a separate host/host_bsd.go file shared by darwin,
freebsd and openbsd. Also use SysctlTimeval to get
the boot time directly as a type Timeval instead of manually
extracting it using package unsafe. It will also allow for easier reuse
to support package host on e.g. Dragonfly BSD or NetBSD.

This requires updating the golang.org/x/sys/unix dependency to the
latest revision.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
5 years ago
Lomanic 4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 6 years ago
WAKAYAMA shirou 2fd3f03f84 [freebsd][host]: fix Users() return start secs. 6 years ago
Steven Hartland f846eda923 Eliminate call to uname on FreeBSD
Improve performance by eliminating the fork out to uname on FreeBSD which also helps prevent crashes / hangs due to the outstanding fork crash bug:
golang/go#15658

Also added a test for PlatformInformation.
7 years ago
shirou 4c73494c78 Add WithContext functions. 7 years ago
Steven Hartland 6450c60b61 Eliminate use of sysctl command on FreeBSD
In order to improve performance and help prevent crashes due to the outstanding fork crash bug:
https://github.com/golang/go/issues/15658

Replace string parsed values from the sysctl command with native reads of sysctl values using unix.SysctlRaw and unix.SysctlUint32.

This also merges OpenBSD and FreeBSD load implementations which are identical.
8 years ago
WAKAYAMA Shirou 114c78c777 [host]: add not implemented methods. 8 years ago
Frank Schroeder a9e803ef6a
Fix data race in host.BootTime 8 years ago
WAKAYAMA Shirou dfbb3e40da fix build bugs. 8 years ago
Eric Gourlaouen 8b08ca5fdc added temperatures 8 years ago
tycho garen 22c56d292e close open files 8 years ago
Sean Chittenden 36f5033d97
Unconditionally lowercase the `HostID` from all supported platforms. 8 years ago
Conor Branagan 5afd6f21c9 Cache the boot time after first query.
When fetching stats on all processes at once there's a non-trivial amount of
time spent in the `BootTime` call. But since this value should never change
during a live process, we can use a cached version for all subsequent calls.
9 years ago
Lukas Fittl 13aedadcde Add separate kernelVersion field to host information.
This is mostly intended for Linux, where we are returning the OS version
in the PlatformVersion field, which seems reasonable. Often it is still
useful to know which Linux kernel is running.

For FreeBSD and Darwin the kernel version matches the platform version,
since they previously used the kernel version for the platform version.

For Windows the kernel version is empty, since there is no clear way
to determine it.
9 years ago
Sean Chittenden 59094cd5b7
Add HostID to the Host InfoStat struct returned from host.Info().
On supported hosts the value returned is a UUID (case preserving
from the value of the underlying OS).

For Linux this is generated once, randomly per boot.  For FreeBSD and
Darwin this is a more durable value that should persist across reboots.
9 years ago
Sean Chittenden fcd296ea11
Merge branch 'master' of github.com:shirou/gopsutil 9 years ago
Sean Chittenden 69f7f8eaeb
Update host.Info() to return the number of processes on all platforms.
Fixes: #227
9 years ago
Shirou WAKAYAMA 57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 9 years ago
WAKAYAMA shirou d9e994bec8 [host]freebsd: update freebsd_amd64 9 years ago
Shirou WAKAYAMA d21ed2b40d search path via exec.LookPath before actual invoke. 9 years ago
Shirou WAKAYAMA ea152ea901 [BREAKING CHANGE] rename functions to pass golint. ex) net.NetIOCounters -> net.IOCounters 9 years ago
WAKAYAMA shirou 54a6c186c1 host[freebsd]: BREAKING CHANGE. Boottime() should return uint64 same as other. 9 years ago
Cameron Sparr 444ee723c3 Fix HostInfo.Uptime, which has been returning boot time
Also adding a HostInfo.BootTime field for holding the boot time
9 years ago
Shirou WAKAYAMA 7288e9a5af common[all]: add internal 10 years ago
Nick Galbreath 99d93f93b2 shirou/gopsutil#90 make hostinfo more robust 10 years ago
WAKAYAMA shirou abb4086531 host[freebsd]: change to use utmpx for 9.0 or later. 10 years ago
WAKAYAMA shirou b0c9f81246 host_freebsd now use godefs 10 years ago
Shirou WAKAYAMA 13cd195a7e change package name. 10 years ago
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 10 years ago