Skip to content

Commit fd88377

Browse files
committed
internal/pwru: replace unmaintained mitchellh/go-ps dependency
Mitchell Hashimoto has announced [1] that he'll be archiving his Go repositories in early 2024. This change updates the github.com/mitchellh/go-ps dependency with github.com/tklauser/ps which I've started a while ago as a replacement with additional features. [1] https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc Note that as a nice side effect this also changes the output to print the full path to the executable, not just the executable name which might be ambiguous. Before this change: 0xffff9137d7d2c6e0 4 [curl(239350)] ip_local_out 0xffff9137d7d2c6e0 4 [curl(239350)] __ip_local_out 0xffff9137d7d2c6e0 4 [curl(239350)] nf_hook_slow 0xffff9137d7d2c6e0 4 [curl(239350)] ip_output 0xffff9137d7d2c6e0 4 [curl(239350)] nf_hook_slow 0xffff9137d7d2c6e0 4 [curl(239350)] apparmor_ipv4_postroute 0xffff9137d7d2c6e0 4 [curl(239350)] ip_finish_output 0xffff9137d7d2c6e0 4 [curl(239350)] __cgroup_bpf_run_filter_skb 0xffff9137d7d2c6e0 4 [curl(239350)] __ip_finish_output 0xffff9137d7d2c6e0 4 [curl(239350)] ip_finish_output2 0xffff9137d7d2c6e0 4 [curl(239350)] dev_queue_xmit 0xffff9137d7d2c6e0 4 [curl(239350)] __dev_queue_xmit 0xffff9137d7d2c6e0 4 [curl(239350)] qdisc_pkt_len_init 0xffff9137d7d2c6e0 4 [curl(239350)] netdev_core_pick_tx 0xffff9137d7d2c6e0 4 [curl(239350)] validate_xmit_skb 0xffff9137d7d2c6e0 4 [curl(239350)] netif_skb_features 0xffff9137d7d2c6e0 4 [curl(239350)] skb_network_protocol 0xffff9137d7d2c6e0 4 [curl(239350)] validate_xmit_vlan 0xffff9137d7d2c6e0 4 [curl(239350)] skb_csum_hwoffload_help 0xffff9137d7d2c6e0 4 [curl(239350)] validate_xmit_xfrm 0xffff9137d7d2c6e0 4 [curl(239350)] dev_hard_start_xmit 0xffff9137d7d2c6e0 4 [curl(239350)] skb_push After this change: 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] ip_local_out 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] __ip_local_out 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] nf_hook_slow 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] ip_output 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] nf_hook_slow 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] apparmor_ipv4_postroute 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] ip_finish_output 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] __cgroup_bpf_run_filter_skb 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] __ip_finish_output 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] ip_finish_output2 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] dev_queue_xmit 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] __dev_queue_xmit 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] qdisc_pkt_len_init 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] netdev_core_pick_tx 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] validate_xmit_skb 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] netif_skb_features 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] skb_network_protocol 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] validate_xmit_vlan 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] skb_csum_hwoffload_help 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] validate_xmit_xfrm 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] dev_hard_start_xmit 0xffff9137cb2ebae0 2 [/usr/bin/curl(250468)] skb_push Signed-off-by: Tobias Klauser <[email protected]>
1 parent d86733b commit fd88377

33 files changed

+1188
-894
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require (
77
github.com/cilium/ebpf v0.12.3
88
github.com/cloudflare/cbpfc v0.0.0-20221017140110-11acb56438a2
99
github.com/jsimonetti/rtnetlink v1.4.0
10-
github.com/mitchellh/go-ps v1.0.0
1110
github.com/spf13/pflag v1.0.5
11+
github.com/tklauser/ps v0.0.2
1212
github.com/vishvananda/netns v0.0.4
1313
golang.org/x/net v0.19.0
1414
golang.org/x/sys v0.15.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/
3737
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
3838
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
3939
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
40-
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
41-
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
4240
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4341
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4442
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
@@ -47,6 +45,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
4745
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
4846
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
4947
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
48+
github.com/tklauser/ps v0.0.2 h1:Y+9ZQkxeqRGGzaMgW1hca3/aiwpSHfIDArsU468HSbo=
49+
github.com/tklauser/ps v0.0.2/go.mod h1:F5GRwSO+0665vbwHx7j/bPdxFuJEoTXghQYCWKRHZls=
5050
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
5151
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
5252
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=

internal/pwru/output.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"github.com/cilium/ebpf"
2222
"github.com/cilium/ebpf/btf"
2323
"github.com/jsimonetti/rtnetlink"
24-
ps "github.com/mitchellh/go-ps"
24+
"github.com/tklauser/ps"
2525
"github.com/vishvananda/netns"
2626
"golang.org/x/sys/unix"
2727

@@ -99,7 +99,7 @@ func (o *output) Print(event *Event) {
9999
p, err := ps.FindProcess(int(event.PID))
100100
execName := fmt.Sprintf("<empty>(%d)", event.PID)
101101
if err == nil && p != nil {
102-
execName = fmt.Sprintf("%s(%d)", p.Executable(), event.PID)
102+
execName = fmt.Sprintf("%s(%d)", p.ExecutablePath(), event.PID)
103103
}
104104
ts := event.Timestamp
105105
if o.flags.OutputTS == "relative" {

vendor/github.com/mitchellh/go-ps/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/mitchellh/go-ps/.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

vendor/github.com/mitchellh/go-ps/LICENSE.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

vendor/github.com/mitchellh/go-ps/README.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

vendor/github.com/mitchellh/go-ps/Vagrantfile

Lines changed: 0 additions & 43 deletions
This file was deleted.

vendor/github.com/mitchellh/go-ps/process.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

vendor/github.com/mitchellh/go-ps/process_darwin.go

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)