1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-28 13:48:49 +08:00

golint on freebsd.

This commit is contained in:
WAKAYAMA shirou 2014-04-30 16:19:39 +09:00
parent d511748bfd
commit e4cee3c190
5 changed files with 29 additions and 29 deletions

View File

@ -23,7 +23,7 @@ const (
// TODO: get per cpus
func CPUTimes(percpu bool) ([]CPUTimesStat, error) {
var ret []CPU_TimesStat
var ret []CPUTimesStat
cpuTime, err := doSysctrl("kern.cp_time")
if err != nil {

View File

@ -9,7 +9,7 @@ import (
)
func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
var ret []Disk_partitionStat
var ret []DiskPartitionStat
// get length
count, err := syscall.Getfsstat(nil, MNT_WAIT)
@ -22,56 +22,56 @@ func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
for _, stat := range fs {
opts := "rw"
if stat.F_flags&MNT_RDONLY != 0 {
if stat.FFlags&MNT_RDONLY != 0 {
opts = "ro"
}
if stat.F_flags&MNT_SYNCHRONOUS != 0 {
if stat.FFlags&MNT_SYNCHRONOUS != 0 {
opts += ",sync"
}
if stat.F_flags&MNT_NOEXEC != 0 {
if stat.FFlags&MNT_NOEXEC != 0 {
opts += ",noexec"
}
if stat.F_flags&MNT_NOSUID != 0 {
if stat.FFlags&MNT_NOSUID != 0 {
opts += ",nosuid"
}
if stat.F_flags&MNT_UNION != 0 {
if stat.FFlags&MNT_UNION != 0 {
opts += ",union"
}
if stat.F_flags&MNT_ASYNC != 0 {
if stat.FFlags&MNT_ASYNC != 0 {
opts += ",async"
}
if stat.F_flags&MNT_SUIDDIR != 0 {
if stat.FFlags&MNT_SUIDDIR != 0 {
opts += ",suiddir"
}
if stat.F_flags&MNT_SOFTDEP != 0 {
if stat.FFlags&MNT_SOFTDEP != 0 {
opts += ",softdep"
}
if stat.F_flags&MNT_NOSYMFOLLOW != 0 {
if stat.FFlags&MNT_NOSYMFOLLOW != 0 {
opts += ",nosymfollow"
}
if stat.F_flags&MNT_GJOURNAL != 0 {
if stat.FFlags&MNT_GJOURNAL != 0 {
opts += ",gjounalc"
}
if stat.F_flags&MNT_MULTILABEL != 0 {
if stat.FFlags&MNT_MULTILABEL != 0 {
opts += ",multilabel"
}
if stat.F_flags&MNT_ACLS != 0 {
if stat.FFlags&MNT_ACLS != 0 {
opts += ",acls"
}
if stat.F_flags&MNT_NOATIME != 0 {
if stat.FFlags&MNT_NOATIME != 0 {
opts += ",noattime"
}
if stat.F_flags&MNT_NOCLUSTERR != 0 {
if stat.FFlags&MNT_NOCLUSTERR != 0 {
opts += ",nocluster"
}
if stat.F_flags&MNT_NOCLUSTERW != 0 {
if stat.FFlags&MNT_NOCLUSTERW != 0 {
opts += ",noclusterw"
}
if stat.F_flags&MNT_NFS4ACLS != 0 {
if stat.FFlags&MNT_NFS4ACLS != 0 {
opts += ",nfs4acls"
}
d := Disk_partitionStat{
d := DiskPartitionStat{
Mountpoint: byteToString(stat.FMntonname[:]),
Fstype: byteToString(stat.FFstypename[:]),
Opts: opts,

View File

@ -68,10 +68,10 @@ func Users() ([]UserStat, error) {
continue
}
user := UserStat{
User: byteToString(u.Ut_name[:]),
Terminal: byteToString(u.Ut_line[:]),
Host: byteToString(u.Ut_host[:]),
Started: int(u.Ut_time),
User: byteToString(u.UtName[:]),
Terminal: byteToString(u.UtLine[:]),
Host: byteToString(u.UtHost[:]),
Started: int(u.UtTime),
}
ret = append(ret, user)
}

View File

@ -3,13 +3,13 @@
package gopsutil
func VirtualMemory() (VirtualMemoryStat, error) {
ret := Virtual_memoryStat{}
ret := VirtualMemoryStat{}
return ret, nil
}
func SwapMemory() (SwapMemoryStat, error) {
ret := Swap_memoryStat{}
ret := SwapMemoryStat{}
return ret, nil
}

View File

@ -132,7 +132,7 @@ func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) {
return &ret, errors.New("not implemented yet")
}
func copyParams(k *Kinfo_proc, p *Process) error {
func copyParams(k *KinfoProc, p *Process) error {
return nil
}
@ -147,7 +147,7 @@ func processes() ([]Process, error) {
}
// get kinfo_proc size
k := Kinfo_proc{}
k := KinfoProc{}
procinfoLen := int(unsafe.Sizeof(k))
count := int(length / uint64(procinfoLen))
@ -158,7 +158,7 @@ func processes() ([]Process, error) {
if err != nil {
continue
}
p, err := NewProcess(int32(k.Ki_pid))
p, err := NewProcess(int32(k.KiPid))
if err != nil {
continue
}
@ -223,7 +223,7 @@ func NewProcess(pid int32) (*Process, error) {
p := &Process{Pid: pid}
mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PID, p.Pid}
buf, length, err := call_syscall(mib)
buf, length, err := callSyscall(mib)
if err != nil {
return nil, err
}