shirou / gopsutil

psutil for golang
Other
10.61k stars 1.59k forks source link

replace lsof to platform dependent method #164

Open shirou opened 8 years ago

shirou commented 8 years ago

142 , #143 are related to using lsof to get Network connection info.

To replace lsof, we needs at least these functions. inet_ntop porting, sysctl decode functions, and so on are little bit heavy to implement. I will update this issue step by step.

vrecan commented 8 years ago

:+1: great to see that you are taking this on!

sparrc commented 8 years ago

looking forward to this, thanks for your work @shirou!

shirou commented 8 years ago

OK. now I have implemented linux version at #169. The output is same as psutil, but more tests are required.

shirou commented 8 years ago

FreeBSD

sysctl net.inet.tcp.pcblist returnes xtcpcb struct. But since it is complicated to parse to golang struct, time should be required.

Darwin

To get NetConnections, proc_pidinfo() is required and it seems to invoke by only CGO. I am thinking net is also use CGO or not. Or, the net.inet.tcp.pcblist is exists on Darwin also, the FreeBSD code may be used on Darwin, too. I will challenge after FreeBSD.

windows

not yet...

v2 migration

It takes a time to implement, I think prioritize v2.

NullSoldier commented 7 years ago

Is this dead in the water? I'm seeing flakiness with using lsof where the command never finishes.

shirou commented 7 years ago

@NullSoldier what platform do you want to replace lsof?