Skip to content

Commit

Permalink
remove unneeded methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwolf committed May 15, 2024
1 parent 2da9c7d commit 0b5885c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions x-pack/auditbeat/processors/sessionmd/processdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func interactiveFromTTY(tty types.TTYDev) bool {
return TTYUnknown != getTTYType(tty.Major, tty.Minor)
}

func (db *DB) fullProcessFromDBProcess(p Process) types.Process {
func fullProcessFromDBProcess(p Process) types.Process {
reducedPrecisionStartTime := timeutils.ReduceTimestampPrecision(p.PIDs.StartTimeNS)
interactive := interactiveFromTTY(p.CTTY)

Expand Down Expand Up @@ -465,7 +465,7 @@ func (db *DB) fullProcessFromDBProcess(p Process) types.Process {
return ret
}

func (db *DB) fillParent(process *types.Process, parent Process) {
func fillParent(process *types.Process, parent Process) {
reducedPrecisionStartTime := timeutils.ReduceTimestampPrecision(parent.PIDs.StartTimeNS)

interactive := interactiveFromTTY(parent.CTTY)
Expand All @@ -490,7 +490,7 @@ func (db *DB) fillParent(process *types.Process, parent Process) {
}
}

func (db *DB) fillGroupLeader(process *types.Process, groupLeader Process) {
func fillGroupLeader(process *types.Process, groupLeader Process) {
reducedPrecisionStartTime := timeutils.ReduceTimestampPrecision(groupLeader.PIDs.StartTimeNS)

interactive := interactiveFromTTY(groupLeader.CTTY)
Expand All @@ -515,7 +515,7 @@ func (db *DB) fillGroupLeader(process *types.Process, groupLeader Process) {
}
}

func (db *DB) fillSessionLeader(process *types.Process, sessionLeader Process) {
func fillSessionLeader(process *types.Process, sessionLeader Process) {
reducedPrecisionStartTime := timeutils.ReduceTimestampPrecision(sessionLeader.PIDs.StartTimeNS)

interactive := interactiveFromTTY(sessionLeader.CTTY)
Expand All @@ -540,7 +540,7 @@ func (db *DB) fillSessionLeader(process *types.Process, sessionLeader Process) {
}
}

func (db *DB) fillEntryLeader(process *types.Process, entryType EntryType, entryLeader Process) {
func fillEntryLeader(process *types.Process, entryType EntryType, entryLeader Process) {
reducedPrecisionStartTime := timeutils.ReduceTimestampPrecision(entryLeader.PIDs.StartTimeNS)

interactive := interactiveFromTTY(entryLeader.CTTY)
Expand Down Expand Up @@ -623,12 +623,12 @@ func (db *DB) GetProcess(pid uint32) (types.Process, error) {
return types.Process{}, errors.New("process not found")
}

ret := db.fullProcessFromDBProcess(process)
ret := fullProcessFromDBProcess(process)

if process.PIDs.Ppid != 0 {
for i := 0; i < retryCount; i++ {
if parent, ok := db.processes[process.PIDs.Ppid]; ok {
db.fillParent(&ret, parent)
fillParent(&ret, parent)
break
}
}
Expand All @@ -637,7 +637,7 @@ func (db *DB) GetProcess(pid uint32) (types.Process, error) {
if process.PIDs.Pgid != 0 {
for i := 0; i < retryCount; i++ {
if groupLeader, ok := db.processes[process.PIDs.Pgid]; ok {
db.fillGroupLeader(&ret, groupLeader)
fillGroupLeader(&ret, groupLeader)
break
}
}
Expand All @@ -646,7 +646,7 @@ func (db *DB) GetProcess(pid uint32) (types.Process, error) {
if process.PIDs.Sid != 0 {
for i := 0; i < retryCount; i++ {
if sessionLeader, ok := db.processes[process.PIDs.Sid]; ok {
db.fillSessionLeader(&ret, sessionLeader)
fillSessionLeader(&ret, sessionLeader)
break
}
}
Expand All @@ -655,7 +655,7 @@ func (db *DB) GetProcess(pid uint32) (types.Process, error) {
if entryLeaderPID, foundEntryLeaderPID := db.entryLeaderRelationships[process.PIDs.Tgid]; foundEntryLeaderPID {
if entryLeader, foundEntryLeader := db.processes[entryLeaderPID]; foundEntryLeader {
// if there is an entry leader then there is a matching member in the entryLeaders table
db.fillEntryLeader(&ret, db.entryLeaders[entryLeaderPID], entryLeader)
fillEntryLeader(&ret, db.entryLeaders[entryLeaderPID], entryLeader)
} else {
db.logger.Debugf("failed to find entry leader entry %d for %d (%s)", entryLeaderPID, pid, db.processes[pid].Filename)
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/auditbeat/processors/sessionmd/processdb/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func getUserName(id string) (string, bool) {
user, err := user.LookupId(id)
if err != nil {
return "", false
return "", false
}
return user.Username, true
}
Expand All @@ -23,7 +23,7 @@ func getUserName(id string) (string, bool) {
func getGroupName(id string) (string, bool) {
group, err := user.LookupGroupId(id)
if err != nil {
return "", false
return "", false
}
return group.Name, true
}

0 comments on commit 0b5885c

Please sign in to comment.