Skip to content

Commit

Permalink
Merge pull request #1238 from scop/spelling
Browse files Browse the repository at this point in the history
Spelling and grammar fixes
  • Loading branch information
shirou authored Jan 31, 2022
2 parents 696bb11 + 1e56c6f commit e0ec1b9
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


-------
internal/common/binary.go in the gopsutil is copied and modifid from golang/encoding/binary.go.
internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go.



Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ challenge is porting all psutil functions on some architectures.

## v3 migration

from v3.20.10, gopsutil becomes v3 which breaks backwards compatiblity.
from v3.20.10, gopsutil becomes v3 which breaks backwards compatibility.
See [v3Changes.md](_tools/v3migration/v3Changes.md) more detail changes.

## Tag semantics
Expand All @@ -21,7 +21,7 @@ for example, v2.17.04 means
- 17: release year, 2017
- 04: release month

gopsutil aims to keep backwards-compatiblity until major version change.
gopsutil aims to keep backwards compatibility until major version change.

Tagged at every end of month, but if there are only a few commits, it
can be skipped.
Expand Down Expand Up @@ -229,7 +229,7 @@ Some code is ported from Ohai. many thanks.
|**HostInfo** | | | | | | |
|hostname |x |x |x |x |x |x |
|uptime |x |x |x |x | |x |
|proces |x |x |x | | |x |
|process |x |x |x | | |x |
|os |x |x |x |x |x |x |
|platform |x |x |x |x | |x |
|platformfamily |x |x |x |x | |x |
Expand Down
6 changes: 3 additions & 3 deletions docker/docker_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func GetDockerStatWithContext(ctx context.Context) ([]CgroupDockerStat, error) {
return ret, nil
}

// GetDockerIDList returnes a list of DockerID.
// GetDockerIDList returns a list of DockerID.
// This requires certain permission.
func GetDockerIDList() ([]string, error) {
return GetDockerIDListWithContext(context.Background())
Expand Down Expand Up @@ -86,15 +86,15 @@ func GetDockerIDListWithContext(ctx context.Context) ([]string, error) {
return ret, nil
}

// CgroupCPU returnes specified cgroup id CPU status.
// CgroupCPU returns specified cgroup id CPU status.
// containerID is same as docker id if you use docker.
// If you use container via systemd.slice, you could use
// containerID = docker-<container id>.scope and base=/sys/fs/cgroup/cpuacct/system.slice/
func CgroupCPU(containerID string, base string) (*CgroupCPUStat, error) {
return CgroupCPUWithContext(context.Background(), containerID, base)
}

// CgroupCPUUsage returnes specified cgroup id CPU usage.
// CgroupCPUUsage returns specified cgroup id CPU usage.
// containerID is same as docker id if you use docker.
// If you use container via systemd.slice, you could use
// containerID = docker-<container id>.scope and base=/sys/fs/cgroup/cpuacct/system.slice/
Expand Down
4 changes: 2 additions & 2 deletions docker/docker_notlinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetDockerStatWithContext(ctx context.Context) ([]CgroupDockerStat, error) {
return nil, ErrDockerNotAvailable
}

// GetDockerIDList returnes a list of DockerID.
// GetDockerIDList returns a list of DockerID.
// This requires certain permission.
func GetDockerIDList() ([]string, error) {
return GetDockerIDListWithContext(context.Background())
Expand All @@ -29,7 +29,7 @@ func GetDockerIDListWithContext(ctx context.Context) ([]string, error) {
return nil, ErrDockerNotAvailable
}

// CgroupCPU returnes specified cgroup id CPU status.
// CgroupCPU returns specified cgroup id CPU status.
// containerid is same as docker id if you use docker.
// If you use container via systemd.slice, you could use
// containerid = docker-<container id>.scope and base=/sys/fs/cgroup/cpuacct/system.slice/
Expand Down
2 changes: 1 addition & 1 deletion internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (i Invoke) CommandWithContext(ctx context.Context, name string, arg ...stri

type FakeInvoke struct {
Suffix string // Suffix species expected file name suffix such as "fail"
Error error // If Error specfied, return the error.
Error error // If Error specified, return the error.
}

// Command in FakeInvoke returns from expected file if exists.
Expand Down
2 changes: 1 addition & 1 deletion load/load_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func AvgWithContext(ctx context.Context) (*AvgStat, error) {
return ret, nil
}

// Misc returnes miscellaneous host-wide statistics.
// Misc returns miscellaneous host-wide statistics.
// darwin use ps command to get process running/blocked count.
// Almost same as FreeBSD implementation, but state is different.
// U means 'Uninterruptible Sleep'.
Expand Down
2 changes: 1 addition & 1 deletion load/load_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func fileAvgWithContext() (*AvgStat, error) {
return ret, nil
}

// Misc returnes miscellaneous host-wide statistics.
// Misc returns miscellaneous host-wide statistics.
// Note: the name should be changed near future.
func Misc() (*MiscStat, error) {
return MiscWithContext(context.Background())
Expand Down
6 changes: 3 additions & 3 deletions mem/mem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func fillFromMeminfoWithContext() (*VirtualMemoryStat, *VirtualMemoryExStat, err

if !memavail {
if activeFile && inactiveFile && sReclaimable {
ret.Available = calcuateAvailVmem(ret, retEx)
ret.Available = calculateAvailVmem(ret, retEx)
} else {
ret.Available = ret.Cached + ret.Free
}
Expand Down Expand Up @@ -387,10 +387,10 @@ func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) {
return ret, nil
}

// calcuateAvailVmem is a fallback under kernel 3.14 where /proc/meminfo does not provide
// calculateAvailVmem is a fallback under kernel 3.14 where /proc/meminfo does not provide
// "MemAvailable:" column. It reimplements an algorithm from the link below
// https://github.com/giampaolo/psutil/pull/890
func calcuateAvailVmem(ret *VirtualMemoryStat, retEx *VirtualMemoryExStat) uint64 {
func calculateAvailVmem(ret *VirtualMemoryStat, retEx *VirtualMemoryExStat) uint64 {
var watermarkLow uint64

fn := common.HostProc("zoneinfo")
Expand Down
2 changes: 1 addition & 1 deletion net/net_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return iocounters, nil
}

// NetIOCountersByFile is an method which is added just a compatibility for linux.
// IOCountersByFile exists just for compatibility with Linux.
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersByFileWithContext(context.Background(), pernic, filename)
}
Expand Down
2 changes: 1 addition & 1 deletion net/net_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}

// NetIOCountersByFile is an method which is added just a compatibility for linux.
// IOCountersByFile exists just for compatibility with Linux.
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersByFileWithContext(context.Background(), pernic, filename)
}
Expand Down
2 changes: 1 addition & 1 deletion net/net_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}

// NetIOCountersByFile is an method which is added just a compatibility for linux.
// IOCountersByFile exists just for compatibility with Linux.
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersByFileWithContext(context.Background(), pernic, filename)
}
Expand Down
8 changes: 4 additions & 4 deletions net/net_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ( // Conntrack Column numbers
ctSEARCH_RESTART
)

// NetIOCounters returnes network I/O statistics for every network
// NetIOCounters returns network I/O statistics for every network
// interface installed on the system. If pernic argument is false,
// return only sum of all information (which name is 'all'). If true,
// every network interface installed on the system is returned
Expand Down Expand Up @@ -188,7 +188,7 @@ func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoC
line := lines[i]
r := strings.IndexRune(line, ':')
if r == -1 {
return nil, errors.New(filename + " is not fomatted correctly, expected ':'.")
return nil, errors.New(filename + " is not formatted correctly, expected ':'.")
}
proto := strings.ToLower(line[:r])
if !protos[proto] {
Expand All @@ -204,7 +204,7 @@ func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoC
i++
statValues := strings.Split(lines[i][r+2:], " ")
if len(statNames) != len(statValues) {
return nil, errors.New(filename + " is not fomatted correctly, expected same number of columns.")
return nil, errors.New(filename + " is not formatted correctly, expected same number of columns.")
}
stat := ProtoCountersStat{
Protocol: proto,
Expand Down Expand Up @@ -539,7 +539,7 @@ func statsFromInodes(root string, pid int32, tmap []netConnectionKindType, inode
return ret, nil
}

// getProcInodes returnes fd of the pid.
// getProcInodes returns fd of the pid.
func getProcInodes(root string, pid int32, max int) (map[string][]inodeMap, error) {
ret := make(map[string][]inodeMap)

Expand Down
2 changes: 1 addition & 1 deletion net/net_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}

// NetIOCountersByFile is an method which is added just a compatibility for linux.
// IOCountersByFile exists just for compatibility with Linux.
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersByFileWithContext(context.Background(), pernic, filename)
}
Expand Down
2 changes: 1 addition & 1 deletion net/net_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return counters, nil
}

// NetIOCountersByFile is an method which is added just a compatibility for linux.
// IOCountersByFile exists just for compatibility with Linux.
func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersByFileWithContext(context.Background(), pernic, filename)
}
Expand Down
6 changes: 3 additions & 3 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ type Process struct {
const (
// Running marks a task a running or runnable (on the run queue)
Running = "running"
// Blocked marks a task waiting on a short, uninterruptable operation (usually IO)
// Blocked marks a task waiting on a short, uninterruptible operation (usually I/O)
Blocked = "blocked"
// Idle marks a task sleeping for more than about 20 seconds
Idle = "idle"
// Lock marks a task waiting to acquire a lock
Lock = "lock"
// Sleep marks task waiting for short, interruptable operation
// Sleep marks task waiting for short, interruptible operation
Sleep = "sleep"
// Stop marks a stopped process
Stop = "stop"
Expand Down Expand Up @@ -230,7 +230,7 @@ func (p *Process) BackgroundWithContext(ctx context.Context) (bool, error) {
}

// If interval is 0, return difference from last call(non-blocking).
// If interval > 0, wait interval sec and return diffrence between start and end.
// If interval > 0, wait interval sec and return difference between start and end.
func (p *Process) Percent(interval time.Duration) (float64, error) {
return p.PercentWithContext(context.Background(), interval)
}
Expand Down
2 changes: 1 addition & 1 deletion process/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (p *Process) fillFromLimitsWithContext() ([]RlimitStat, error) {
// Assert that last item is a Hard limit
statItem.Hard, err = limitToUint(str[len(str)-1])
if err != nil {
// On error remove last item an try once again since it can be unit or header line
// On error remove last item and try once again since it can be unit or header line
str = str[:len(str)-1]
statItem.Hard, err = limitToUint(str[len(str)-1])
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions process/process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ type winLUIDAndAttributes struct {
}

// TOKEN_PRIVILEGES
type winTokenPriviledges struct {
type winTokenPrivileges struct {
PrivilegeCount winDWord
Privileges [1]winLUIDAndAttributes
}
Expand Down Expand Up @@ -218,23 +218,23 @@ func init() {
}
defer token.Close()

tokenPriviledges := winTokenPriviledges{PrivilegeCount: 1}
tokenPrivileges := winTokenPrivileges{PrivilegeCount: 1}
lpName := syscall.StringToUTF16("SeDebugPrivilege")
ret, _, _ := procLookupPrivilegeValue.Call(
0,
uintptr(unsafe.Pointer(&lpName[0])),
uintptr(unsafe.Pointer(&tokenPriviledges.Privileges[0].Luid)))
uintptr(unsafe.Pointer(&tokenPrivileges.Privileges[0].Luid)))
if ret == 0 {
return
}

tokenPriviledges.Privileges[0].Attributes = 0x00000002 // SE_PRIVILEGE_ENABLED
tokenPrivileges.Privileges[0].Attributes = 0x00000002 // SE_PRIVILEGE_ENABLED

procAdjustTokenPrivileges.Call(
uintptr(token),
0,
uintptr(unsafe.Pointer(&tokenPriviledges)),
uintptr(unsafe.Sizeof(tokenPriviledges)),
uintptr(unsafe.Pointer(&tokenPrivileges)),
uintptr(unsafe.Sizeof(tokenPrivileges)),
0,
0)
}
Expand Down

0 comments on commit e0ec1b9

Please sign in to comment.