diff --git a/host/host.go b/host/host.go index b69d2f6..ebb22b8 100644 --- a/host/host.go +++ b/host/host.go @@ -39,6 +39,8 @@ type UserStat struct { Terminal string `json:"terminal"` Host string `json:"host"` Started int `json:"started"` + Type int `json:"type"` + Pid int `json:"pid"` } func (h InfoStat) String() string { diff --git a/host/host_darwin.go b/host/host_darwin.go index 068f106..a0847fc 100644 --- a/host/host_darwin.go +++ b/host/host_darwin.go @@ -88,6 +88,8 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) { Terminal: common.IntToString(u.Line[:]), Host: common.IntToString(u.Host[:]), Started: int(u.Tv.Sec), + Type: int(u.Type), + Pid: int(u.Pid), } ret = append(ret, user) } diff --git a/host/host_freebsd.go b/host/host_freebsd.go index 52364f1..b952819 100644 --- a/host/host_freebsd.go +++ b/host/host_freebsd.go @@ -77,6 +77,8 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) { Terminal: common.IntToString(u.Line[:]), Host: common.IntToString(u.Host[:]), Started: int(sec), + Type: int(u.Type), + Pid: int(u.Pid), } ret = append(ret, user) diff --git a/host/host_linux.go b/host/host_linux.go index dd03f15..58787dd 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -113,6 +113,8 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) { Terminal: common.IntToString(u.Line[:]), Host: common.IntToString(u.Host[:]), Started: int(u.Tv.Sec), + Type: int(u.Type), + Pid: int(u.Pid), } ret = append(ret, user) } diff --git a/host/host_openbsd.go b/host/host_openbsd.go index d5a5cd1..260d1cf 100644 --- a/host/host_openbsd.go +++ b/host/host_openbsd.go @@ -88,6 +88,8 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) { Terminal: common.IntToString(u.Line[:]), Host: common.IntToString(u.Host[:]), Started: int(u.Time), + Type: int(u.Type), + Pid: int(u.Pid), } ret = append(ret, user) diff --git a/host/host_test.go b/host/host_test.go index 24b1371..9a2f657 100644 --- a/host/host_test.go +++ b/host/host_test.go @@ -129,8 +129,10 @@ func TestUserStat_String(t *testing.T) { Terminal: "term", Host: "host", Started: 100, + Pid: 0, + Type: 0, } - e := `{"user":"user","terminal":"term","host":"host","started":100}` + e := `{"user":"user","terminal":"term","host":"host","started":100,"type":0,"pid":0}` if e != fmt.Sprintf("%v", v) { t.Errorf("UserStat string is invalid: %v", v) }