The value for `ClockTicks` is defined as `100` by the Linux kernel for
all currently supported architectures in Go. Therefore, there is no need
to define this constant for each architecture separately.
This fixes #260.
Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
Instead of hard-coding the page size for linux systems, use Go's
`Getpagesize` function.
This resolves #258.
Signed-off-by: Thomas Hipp <thipp@suse.de>
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.
- Creating a slice of length numFDs and later appending elements to it
results in a slice whose first numFDs elements are all nil. It is
sufficient to create a slice of zero length since we are appending
elements to it.
- The current allocation will make ret a slice of length 0. What's
needed is a slice of length len(ofs).
darwin will not perform correctly if there are spaces in the actual
arguments, in which case a single argument will be reported as
multple. Some CGO would be needed to get around this I think.
I couldn't find any good documentation on how windows handles
command line arguments with spaces inside the actual arguments, so
this implementation merely just splits on spaces.
Before it was doing a fillFromStatus() call which was much slower
and none of the information was needed, except by the Name() func
which now will call fillFromStatus() if p.name is not set.
This allows for getting more exact information about each argument
especially if there are arguments that have spaces in them.
This was not implemented for darwin or for windows because they
both currently have not way of properly parsing the cmdline string.
Darwin parses the output of 'ps' which is already whitespace
segmented, and windows just has the cmdline string.