show running process in process viewer and add limiting to the notification system
This commit is contained in:
@@ -6,6 +6,7 @@ package handlers
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -15,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func listProcesses() ([]wire.ProcessInfo, error) {
|
||||
selfPID := int32(os.Getpid())
|
||||
|
||||
cmd := exec.Command("ps", "aux")
|
||||
output, err := cmd.Output()
|
||||
@@ -78,6 +80,7 @@ func listProcesses() ([]wire.ProcessInfo, error) {
|
||||
Memory: memBytes,
|
||||
Username: username,
|
||||
Type: procType,
|
||||
Self: int32(pid) == selfPID,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
@@ -37,6 +38,7 @@ type PROCESS_MEMORY_COUNTERS struct {
|
||||
}
|
||||
|
||||
func listProcesses() ([]wire.ProcessInfo, error) {
|
||||
selfPID := int32(os.Getpid())
|
||||
var pids [4096]uint32
|
||||
var bytesReturned uint32
|
||||
|
||||
@@ -157,6 +159,7 @@ func listProcesses() ([]wire.ProcessInfo, error) {
|
||||
Memory: memory,
|
||||
Username: username,
|
||||
Type: procType,
|
||||
Self: pid == selfPID,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ type ProcessInfo struct {
|
||||
Memory uint64 `msgpack:"memory"`
|
||||
Username string `msgpack:"username,omitempty"`
|
||||
Type string `msgpack:"type,omitempty"`
|
||||
Self bool `msgpack:"self,omitempty"`
|
||||
}
|
||||
|
||||
type ProcessListResult struct {
|
||||
|
||||
Reference in New Issue
Block a user