Commit Graph

37 Commits (3b417071a5835600ae0d654231cfb9ce226f2b6b)

Author SHA1 Message Date
Daniel Stutz 9916462c47 use ioreg to read IOPlatformUUID as HostID 4 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
Alessandro De Angelis 65a2e0e9bb Restored temperature info for macOS 5 years ago
Lomanic 4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 6 years ago
Kent 'picat' Gruber e507f44421 Update host_darwin.go
Copy+pasta got me again! 🍝

No new variable on the left of `:=` 😂
6 years ago
Kent 'picat' Gruber d13ba02ef0 Update host_darwin.go
The /System/Library/CoreServices/ServerVersion.plist exists on macOS servers , but not on a workstation such as my laptop. The actual terminoly is mostly borrowed from the windows equivalent as @Lomanic suggested. In theory, this should make interpreting the results from the two platforms a bit more consistent.

Note: The macOS server application can be installed on almost any macOS workstation to make it a server that can manage other apple devices.
6 years ago
Lomanic d110536e10 [host][darwin] Remove calls to sysctl binary in host/host_darwin.go #639 6 years ago
Lomanic 738b966ed1 [host][darwin] Use unix.Sysctl to get kernel version and platform name 6 years ago
Lomanic 18b2744df2 [host][darwin] Fix #574, use 'uname -r' in KernelVersion() 7 years ago
shirou c95755e4bc [host]darwin: remove GPL code 7 years ago
shirou 145dca90f7 change to use CommandContext. 7 years ago
shirou 4c73494c78 Add WithContext functions. 7 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 e49a95f3d5 [host]darwin: PlatformInformation has been 5 values other is 4. 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
Shirou WAKAYAMA b9067179ef [host]darwin: change to use sw_vers to get platform version 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
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
Robin Burchell 55cacb4730 host_darwin: Use a named constant for USER_PROCESS.
Matches the host_linux change.
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
Shirou WAKAYAMA 8f05d68a09 host: forget to convert to uint64. 10 years ago
Shirou WAKAYAMA 515398a6f6 host: Boottime return type was wrong on darwin #40 10 years ago
若山史郎 f2435bc8de host: skip if utmp.Type is not USERPROCESS (defined in utmpx.h) 10 years ago
若山史郎 a5d366a70c host: Users() on darwin works. but Started is not correct. 10 years ago
Shirou WAKAYAMA 13cd195a7e change package name. 10 years ago
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 10 years ago