Commit Graph

26 Commits

Author SHA1 Message Date
Ville Skyttä 0306525d78 [process] implement ParentWithContext using PpidWithContext
Removes need for redundant ParentWithContext implementations. It had led
to it being unsupported on FreeBSD and OpenBSD even though
PpidWithContext was available for them, and different implementations
for getting the parent info used in ParentWithContext and
PpidWithContext on Darwin and Linux.
2022-01-22 18:27:52 +02:00
mmorel-35 1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
shirou 0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
Max Altgelt b02b92e16b
feat: Add support for environment variable read
Add support (for Linux and Windows for now) for reading the
environment variables of a process, with a similar syntax to
os.Environ().
For Windows, this includes some refactoring for clean access to the
RTL_USER_PROCESS_PARAMETERS structure which points to the command
line and the environment variables.
2021-07-13 15:11:29 +02:00
Ville Skyttä e35ae34dce [process][solaris] process basics 2021-05-08 16:54:12 +03:00
Sergey Vinogradov 065e609cbf Refactor "process" package
* All context-less wrapping functions (the ones without WithContext
suffix) were moved into process.go since they all are the same.
* Call context is now passed to all underlying functions in
*WithContext() functions.
* All common *BSD bits were moved to process_bsd.go.
* Process.Tgid() method lacked a WithContext counterpart, so
Process.TgidWithContext() was added for uniformity.
* NewProcessWithContext() function was added since NewProcess() is
used a lot throughout the module, and there is no way to pass a
context to it.

This is a part of #761 effort.
2020-10-12 18:15:29 +03:00
TakayukiB Goto a93796494b [Process] Define the Groups() only once 2019-10-24 18:42:13 +09:00
TakayukiB Goto f55f202e81 [Process] Implement Groups() to get additional gids. 2019-10-07 12:59:36 +09:00
Lomanic 547679f88e [process] Fix #760 implement IsRunning by checking process with same PID has same CreateTime as current process 2019-09-07 18:54:49 +02:00
Lomanic 3eefe64948 [process] Fix #752 sort PIDS returned by process.Pids() 2019-08-24 09:08:28 +02:00
Lomanic 3465186bca [process] Fix #729 check process existence in NewProcess() 2019-08-01 21:12:48 +02:00
Lomanic 5b15bc623c [process][posix] Fix #607 check pid existence with a signal instead of listing every pids
Reference 0d6b91e916/lockfile_unix.go
2019-07-07 16:41:13 +02:00
Lomanic 41e774419f
Merge pull request #643 from wcc526/master
Update process_linux.go for Add process ConnectionsMax
2019-02-23 21:23:09 +01:00
wcc526 462e0f6c2f Update process_linux.go for Add process ConnectionsMax 2019-02-23 18:55:31 +08:00
David Naylor 414c76f159 [process][linux] Export process page fault info
Add a function for retrieving page fault counts from /proc/[pid]/stat on
Linux.
2018-12-13 16:19:40 -08:00
shirou cce2d16538 [process]: add missing argment to process_fallback. 2018-12-10 20:20:53 +09:00
Lomanic 878e0a701b Fix #596 Implement process.Background and process.Foreground functions 2018-11-08 20:52:01 +01:00
Sam Zaydel 391d5ecf7d Fix undefined process.Processes when building telegraf on Solaris-based system 2018-07-26 15:10:44 -07:00
shirou cd61c36c4f
Merge branch 'master' into feature/add_context_support 2018-01-09 11:18:25 +09:00
Nick Kirsch 482ca3af6d Parses the tgid field, which is the thread group id (aka user-space process id) on Linux. Returns error on other platforms. 2018-01-04 11:30:39 -08:00
shirou 4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
Leonid Podolny 7ee4a4c6ff Fix Threads() signature to better match python original 2017-10-04 15:38:01 -04:00
Leonid Podolny 7ad3836ad3 Implement Threads() for Linux 2017-10-04 15:38:01 -04:00
Patrick Hemmer 60c32eb847 add current values to rlimit retrieval 2017-06-01 16:38:44 -04: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
Lukas Fittl da9fa1162b Add fallback code for all unsupported operating systems.
This enables using gopsutil in a codebase that gets built on other OSes
than the ones supported. Instead of a build failure as before, due to
the build tags, gopsutil will now throw an "not implemented" runtime
error.

Fixes #234.
2016-08-22 15:31:26 -07:00