Skip to content

Commit

Permalink
fix checks
Browse files Browse the repository at this point in the history
  • Loading branch information
edeNFed committed Jul 6, 2023
1 parent 377bd66 commit 0aa196e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/instrumentors/bpffs/bpfsfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import (
// BPFFsPath is the system path to the BPF file-system.
const bpfFsPath = "/sys/fs/bpf"

// PathForTargetApplication returns the path to the BPF file-system for the given target.
func PathForTargetApplication(target *process.TargetDetails) string {
return fmt.Sprintf("%s/%d", bpfFsPath, target.PID)
}

// Mount mounts the BPF file-system for the given target.
func Mount(target *process.TargetDetails) error {
if !isBPFFSMounted() {
// Directory does not exist, create it and mount
Expand Down Expand Up @@ -59,6 +61,7 @@ func isBPFFSMounted() bool {
return stat.Type == unix.BPF_FS_MAGIC
}

// Cleanup removes the BPF file-system for the given target.
func Cleanup(target *process.TargetDetails) error {
return os.RemoveAll(PathForTargetApplication(target))
}

0 comments on commit 0aa196e

Please sign in to comment.