Commit Graph

41 Commits

Author SHA1 Message Date
Lomanic ef54649286 [windows] Use windows.NewLazySystemDLL to (possibly) prevent DLL hijacking
Might be useless because of https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
but better be safe than sorry.

Ref: https://github.com/shirou/gopsutil/issues/570#issuecomment-413951653
2018-08-18 22:52:41 +02:00
Jaime Soriano Pastor 61902bc2a5 Use HOST_* environment variables for getting disk serial number in Linux 2018-07-02 10:04:57 +02:00
shirou 145dca90f7 change to use CommandContext. 2018-03-31 21:35:53 +09:00
sada 8dd42707e2 windows: fix WithContext functions
set timeout only if parent context doesn't set.
2018-02-12 13:26:17 -08:00
shirou 079e1cb22f [internal]Windows: skip Host test. 2018-01-11 11:34:14 +09:00
leaf 65598d98cc To prevent hang if wmi.Query hangs, add a context-aware wrapper for it. 2017-11-20 10:13:27 -08:00
Daniel Nelson df2f1a8dd1
Add HOST_VAR envvar and use to locate utmp on Linux. 2017-10-16 14:53:14 -07:00
Derek Brown 7c807c86e4 Add implementation of SwapMemory() for windows 2017-09-18 18:14:29 -07: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
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}` 2017-06-02 13:51:00 -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
Sean Chittenden d0e40ff723
Fix issues reported by golint. 2017-04-27 14:21:34 -07:00
Sean Chittenden 3834908232
Improve Command() handling and signal handling for launched processes. 2017-04-27 14:11:25 -07:00
WAKAYAMA Shirou 30ebb9ca3a rename expected dir to testdata. 2017-03-15 23:01:06 +09:00
tycho garen 22c56d292e close open files 2017-02-22 08:46:23 -05:00
Cameron Sparr a213bf5e6d
run go fmt ./... 2017-02-01 23:05:29 +00:00
shirou 93564b3142 Merge pull request #271 from botherder/master
Obtain executable path from macOS process (fix #270)
2017-01-02 14:11:51 +09:00
Marco Pfatschbacher b4846b445b Add support for OpenBSD/amd64
This code is based on the FreeBSD version
and implements roughly the same feature set.
2016-11-24 22:30:29 +01:00
Nex 5c0ac28fed Changing a little the return values 2016-10-21 13:19:19 +02:00
Nex d9b355f75e Added proper piping of commands 2016-10-21 13:16:22 +02:00
Sean Chittenden e4f857a9ca
Fix a linter issue: s/TimeoutErr/ErrTimeout/g 2016-08-11 00:49:29 -07: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
Shirou WAKAYAMA 57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
Shirou WAKAYAMA 0787e8ba3e [host]linux-arm: update type_liux.go. Test will fail. 2016-04-10 10:07:35 +00:00
Shirou WAKAYAMA adf2f03a48 fix build and path error 2016-04-01 22:28:07 +09:00
Shirou WAKAYAMA bce9212def fix build bugs. 2016-04-01 22:22:03 +09:00
Shirou WAKAYAMA d21ed2b40d search path via exec.LookPath before actual invoke. 2016-04-01 22:13:05 +09:00
Shirou WAKAYAMA 613a8a90e1 fixed by golint. 2016-04-01 21:34:39 +09:00
Shirou WAKAYAMA 944429d994 fixed by errcheck 2016-04-01 21:02:20 +09:00
Shirou WAKAYAMA fa3e1cc196 [common]linux: add HostEtc to switch '/etc' See #175. 2016-03-13 23:42:06 +09:00
Shirou WAKAYAMA 6c352016d8 [net]linux: start replacing lsof. still work in progress. 2016-03-01 23:38:13 +09:00
Shirou WAKAYAMA 3166d41538 set LC_ALL to C in order to avoid number formatting problem. 2016-02-17 16:29:35 +09:00
WAKAYAMA shirou 0af91ba32b [disk,process]freebsd: binary.go moved to internal. 2016-02-12 23:10:40 +09:00
elij d1380cba29 try to fix diskio stats on FreeBSD-10.x
FreeBSD apparently changed the magic sysctl mib values for devstats.

    --- FAIL: TestDisk_io_counters (0.00s)
    disk_test.go:39: error no such file or directory
    disk_test.go:42: ret is empty, map[]

This code uses an undocumented, but exported, go stdlib method to fetch
the sysctl by string instead of mib.
2016-02-06 06:20:52 -08:00
Shawn Smith 9cc9e82920 fix typos 2015-12-31 14:23:13 +09:00
James Lamb 22f35fd518 add netfilter counter support 2015-12-08 09:32:45 +11:00
Shirou WAKAYAMA dd13300833 process[linux,freebsd,darwin]: implements Children using pgrep. 2015-11-24 00:04:20 +09: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