Antoine Toulme
842e4da755
apply code review
2023-06-02 01:31:05 -07:00
Antoine Toulme
38b94668ea
allow to pass context values to override environment variables
2023-06-02 01:31:05 -07:00
Ville Skyttä
70a8f589c6
Detect Docker also using /.dockerenv
2022-12-28 23:12:58 +02:00
Aman Gupta Karmani
34cc43d282
[android][host] fix Info() failure due to forbidden /proc/stat and /proc/uptime ( #1361 )
...
* [android][host] fallback to sysinfo() syscall for uptime
with Android O, /proc/{stat,uptime} both return permission denied
2022-11-19 04:17:18 +01:00
Johan Burati
e7034b47f2
Add hostinfo Virtualization hyperv
2022-08-02 16:23:43 +09:00
shirou
80c890dc4c
fix(host,linux): when platform is detected to be 'amazon' cleanup os-release ID
2022-07-12 09:53:22 +00:00
Ville Skyttä
f7e1f36418
refactor: remove unnecessary exec.LookPath calls
...
Executing the command does the lookup if needed and returns the same
error when not found, no need to do it separately.
2022-03-04 18:56:33 +02:00
Matthieu MOREL
b0469a470b
Merge branch 'master' into master
2022-02-01 19:28:26 +01:00
Matthieu MOREL
8ba220d241
enable contextcheck linter
2022-01-24 09:26:50 +01:00
shirou
b4808b3e94
Merge pull request #1204 from YangKeao/fix-unstable-boottime
...
fix unstable boot time because of float conversion
2022-01-06 21:09:53 +09:00
mmorel-35
1e6b445a8a
gofumpt
2021-12-22 21:54:41 +00:00
YangKeao
1b5757b7d1
fix unstable boot time because of float conversion
...
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
2021-12-21 16:14:07 +08:00
shirou
0969c9436b
delete v2 directory, move v3 to top #1078
2021-11-30 23:47:59 +00:00
Ville Skyttä
a21240a319
Simplify some if blocks
2021-08-18 17:09:11 +03:00
Ville Skyttä
5d0724f42f
Comment convention fixes
2021-08-18 17:09:03 +03:00
Ville Skyttä
65616500e8
Remove unnecessary empty lines
2021-08-18 16:42:17 +03:00
Ville Skyttä
a9b1ce2dec
Remove unnecessary conversions
2021-08-18 16:42:11 +03:00
Ville Skyttä
7743265113
Rewrite if-else chains as switches
2021-08-18 16:37:51 +03:00
Atakan
3504ea07b0
simplify virt cache
2020-10-13 11:06:20 +03:00
Ryan Fitzpatrick
8046134504
Fix VirtualizationWithContext() race in linux
2020-10-06 17:03:49 +00:00
Ata
ba243b1d14
removed explicit set to nil
2020-09-29 10:12:48 +03:00
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
2020-09-11 10:41:01 +03:00
Mihir Singh
92d6df6d8f
Attempted LXC guest detection from environ procfile
2020-06-21 09:13:34 +00:00
Guillaume Bienkowski
aeb3b6b1c7
Do not cache boot time for linux. Fix #837
2020-04-15 13:52:34 +02:00
shirou
a21ed69d3a
Revert "Merge pull request #763 from Iqoqo/add-android-support-for-host"
...
This reverts commit f58b2e367743e24f7d4e5b69fa04cf738e15ce86, reversing
changes made to 84e6215770ea4a60ebed2284c4b5e57432891f22.
2019-09-15 09:49:07 +09:00
Ilya Guterman
11244886bb
add android support for host
2019-09-08 19:45:04 +03:00
Kris Watts
c3720007e4
Fixes issue #730
2019-07-26 12:05:16 -06:00
Arturo Reuschenbach Puncernau
eb15d06a52
trim quotes when reading from os-release
2019-06-03 14:21:04 +02:00
shirou
07863cab0c
[host]linux: add #688 diff which is removed after merging #689
2019-06-01 11:31:00 +09:00
Tyler Dixon
4e81681ab3
code review
2019-05-24 09:48:27 -07:00
Tyler Dixon
a02925055c
Remove cycle between process and host packages
...
gopsutil is a transitive dependency of another project that I am integrating
into an internal build system. We target multiple platforms and as a part
of the build system for the large internal repo, we calculate the build
graph used to determine what targets have changed and need to be build /
tested as a single DAG for all platforms.
gopsutil currently does not form a DAG if linux and any other platform are
considered at the same time. linux is the only platform where the process
package imports the host package.
To remove this cycle, the relevant methods have been moved to internal/common
with the linux build tag and are consumed the host and process packages.
2019-05-22 17:45:50 -07:00
Segflow
86c7289ccc
Fix: use filename in exec.LookPath instead of full path
...
exec.LookPath searches for the file in the $PATH, which mean giving it an absolute path is against it's own purposes.
2019-05-05 20:45:07 +01:00
Michael Schurter
042305ee4a
Remove SetEnv on all platforms
2017-08-16 15:32:21 -07:00
Michael Schurter
565f5c8c5e
Alter subprocess's environment instead of the hosts
...
Fixes #415
2017-08-16 14:54:50 -07:00
Asato Wakisaka
16a38100b3
NumProcs() just counts files under f, so use f.Readdirnames to avoid lstat
syscall inside f.Readdir.
2017-05-25 00:04:41 +09:00
tycho garen
22c56d292e
close open files
2017-02-22 08:46:23 -05:00
Sean Chittenden
613ada987d
Add DoSysctrl() to Linux's common utilities.
2016-08-11 00:48:24 -07:00
Sean Chittenden
e0b5f86113
Spell error
like err
. *facepalm*
2016-07-11 14:07:55 -04:00
Sean Chittenden
a3f57b1314
Resolve cyclic import and create a common helper func, NumProcs()
2016-07-11 14:05:30 -04:00
Daniel Theophanes
0af895258e
common: rename package common to internal/common. Add ENV helper funcs.
...
Package common wasn't used for public functions. Place it in an
internal directory to prevent other packages from using.
Remove the distributed references to "HOST_PROC" and "HOST_SYS"
consts and combine into a common function. This also helps so that
if a env var is defined with a trailing slash all will continue to
work as expected.
Fixes #100
2015-10-18 20:40:01 -07:00