Commit Graph

1983 Commits (8ba220d241a0581f1771b8111b340ac44ece3590)
 

Author SHA1 Message Date
Lomanic 8784f48735
Merge pull request #940 from Lomanic/issue985
[process][darwin] Fix #925 remove references to removed const unix.SYS___SYSCTL from x/sys/unix
Sergey Vinogradov 5209442b3c Refactor "host" package
Ata 5fd5d64304
Cache common/common_linux.Virtualization()
By assuming virtualization environment won't change during a the program's runtime, we can cache common/common_linux.Virtualization() with a simple map to reduce amount of system calls. I first mentioned this issue at https://github.com/shirou/gopsutil/pull/890#issuecomment-690211919
Lomanic e1082dabb6 [process][darwin] Fix #925 remove references to removed const unix.SYS___SYSCTL from x/sys/unix
More like a workaround, wanted to port process.getKProcWithContext() to use unix.SysctlRaw() to get rid of exec calls to ps
in the same time but didn't have time.
Lomanic 8a625ec054 [host][process][darwin] Go-fmt code from mktypes.sh from #917
Lomanic 2e4fcbb8c4
Merge pull request #917 from amdprophet/darwin-arm64
Add support for Darwin/ARM64
Lomanic 401aff67d3 Make mktypes.sh generate go-fmt-ed code and make it shellcheck-compliant
See https://github.com/shirou/gopsutil/pull/917#issuecomment-683911339
Lomanic 4cfc60d68b
Merge pull request #928 from Lomanic/skip-tests-when-not-implemented
shirou e25aa96aad
Merge pull request #936 from ninedraft/fix-context-usage
Use cancelable sleep
ninedraft baf3495197 use legacy error check in the common.TestSleep
ninedraft 34df4904f6 use cancelable sleep in cpu.PercentWithContext and process.Process.PercentWithContext
Lomanic e1925b853e
Merge pull request #935 from Lomanic/issue900
[linux] Fix #900, skip or fix failing tests in docker
Lomanic 1b3e0c6643 [linux] Fix #900, skip or fix failing tests in docker
TestGetProcInodesAll: create a server so there are some opened inodes
TestUsers: skip if Users is empty, because of an empty /var/run/utmp
Test_Process_Groups: skip if Groups is empty
TestConnectionsMax: skip on CI, not only CircleCI
Lomanic ffaff45e9c
Merge pull request #932 from tklauser/openbsd-cpu
Use unix.SysctlUint32("hw.ncpuonline") on OpenBSD
Tobias Klauser 548c500117 Use unix.SysctlUin32("hw.ncpuonline") on OpenBSD
Use SysctlUvmexp from golang.org/x/sys/unix to avoid having to simplify
the implementation of cpu.InfoWithContext

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Lomanic 9aa2bee419
Merge pull request #933 from Lomanic/openbsd-host-mem-process-types
[host][mem][process][openbsd] Add 386 const and types definitions
Lomanic 84afaae670 [host][mem][process][openbsd] Add 386 const and types definitions
Continuation of #721, this type using mktypes.sh that I didn't know at the time.
Weirdly, `go tool cgo -godefs` doesn't produce propery go-fmt-ed code, had to do run go-fmt manually afterwards.
Lomanic 7f588ac380
Merge pull request #930 from tklauser/openbsd-uvmpexp
Use unix.SysctlUvmexp on OpenBSD
Lomanic e643eaefcc
Merge pull request #931 from tklauser/openbsd-mem-test-fix
Fix TestVirtual_memory on OpenBSD
Tobias Klauser 62354ea032 Fix TestVirtual_memory on OpenBSD
On OpenBSD, the total is used + free + cached + inactive like on macOS.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Tobias Klauser aacbba22ae Use unix.SysctlUvmexp on OpenBSD
Use SysctlUvmexp from golang.org/x/sys/unix to avoid having to define
the type Uvmexp and the sysctl consts. This will also allow to build on
GOOS=openbsd with e.g. GOARCH=arm64.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Lomanic c4663018cc
Merge pull request #923 from disconnect3d/patch-2
net_linux.go: decode port as uint16 instead of int64
Lomanic d9f9a85e75
Merge pull request #924 from nightmared/fix-utf16-windows
fix an invalid shift in windows processes name UTF16 conversion
Lomanic ab084b525c [net] Skip tests on non-implemented platforms #446
Lomanic ea86cbc3ff [mem] Skip tests on non-implemented platforms #446
Lomanic 78a65a67a9 [load] Skip tests on non-implemented platforms #446
Lomanic 8110480793 [host] Skip tests on non-implemented platforms #446
Lomanic b7781f5858 [disk] Skip tests on non-implemented platforms #446
Lomanic 38f6ed0e0c [cpu] Skip tests on non-implemented platforms #446
Disconnect3d 5c1a9e709d net_linux.go: decode port as 16-bit uint
Changes the port parsing from `/proc/net/*` files records from parsing them as 64-bit integers to parse them as 16-bit unsigned integers.

While this is mostly a cosmetic change, it will also make so that the code fails faster in case the entry is malformed (for whatever reason).

Note that the returned value is still casted to uint32 when an  `Addr` object is created.
It seems to me that the `Addr.port` field should be changed to `uint16` but maybe some other APIs/systems wants it to be `uint32` and also changing it there may require changes in users code if they update. This being said I am not changing that field's type.
Simon Thoby 04a6f81e9f fix an invalid shift in windows processes name UTF16 conversion
Justin Kolberg 53ffb0cece Add support for Darwin/ARM64
Signed-off-by: Justin Kolberg <amd.prophet@gmail.com>
shirou 7e94bb8bcd
Merge pull request #775 from TakayukiBGoto/add_additional_gids_support
[Process] Implement Groups() to get additional gids.
shirou 4e6138ae09
Merge pull request #901 from nightmared/expose-available-memory-as-free-win
Set the 'free' memory value to the 'available' memory on windows
shirou bbcb80cd3f
Merge pull request #891 from tribes/master
[process][windows] implement suspending and resuming with ntdll library
shirou efc768ada6
Merge pull request #898 from tyldavis/master
Fix MemoryMaps on ARM
shirou 7a4809ba68
Merge pull request #908 from tklauser/host-bsd-boottime
Use common implementation for BootTime/Uptime on all BSDs
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>
Simon Thoby 3b64944534 Set the 'free' memory value to the 'available' memory on windows
Tyler Davis 8d28f1b305 Clean up boolean condition
Tyler Davis 9473d01f0f Fix MemoryMaps on ARM
ARM has some tab characters in smaps instead of spaces, hence switching to strings.Fields instead of strings.Split which handles splitting on all whitespace instead of just spaces.
shirou 6d64cd6d43
Merge pull request #882 from james-bebbington/mem-linux-pgmajfault
Add pgmajfault to data returned by vmstat on Linux
James Bebbington 28b2246b5b Add processes created to misc stats
James Bebbington 61cb122a84
Added comment noting that PgMajFault is Linux specific
shirou 10a398abdd add RISC-V and DragonFlyBSD to partial support.
shirou c8251cf603
Merge pull request #896 from tklauser/host-linux-riscv64-support
Add linux/riscv64 support
Tobias Klauser 1934eadfcb Add linux/riscv64 build test
Tobias Klauser 1e61ed79fa host: add support for linux/riscv64
shirou 01afd763e6
Merge pull request #893 from gballet/cpu-add-dragonflybsd-support
cpu: support for DragonflyBSD
shirou 7d13aa15fc
Merge pull request #895 from tklauser/freebsd-statvfs-type
Fix FreeBSD build with latest x/sys/unix