lsof-org / lsof

LiSt Open Files
https://lsof.readthedocs.io
Other
432 stars 107 forks source link

Expose functionality as a re-usable library - Part 2 #284

Closed jiegec closed 1 year ago

jiegec commented 1 year ago

Part 2 of #279: add lsof_context * ctx argument to functions. Remove _PROTOTYPE macro to allow clang-format to recognize function prototypes.

jiegec commented 1 year ago

Still a lot of functions missing the ctx argument … Please report back, once you have completed that cleanup.

Thanks, I don't have AIX, HP-UX or UnixWare environment, It is hard to enumerate those places without compilers' help.

Update: I managed to install AIX in VM.

jiegec commented 1 year ago

I installed SCO OpenServer 5 in VM, but it is too hard to use from 2023's perspective.. I installed git, make etc. but was unable to build lsof. I surrender.

Update: SCO OpenServer 6 & UnixWare 7 installation failed...

BenBE commented 1 year ago

Looking through the diff, there are (still) several (easy to spot) places, where the ctx is used, but not provided as an argument. This will likely give a warning, but given that there's a global variable in the main process somewhat compile nonetheless. This is extremely unclean code style, and does not usually require to compile the code (TBF: I did just have a look at the code and spotted those issues). I know hpux, aix and several other platforms are rare to come by for testing, but a minimum of diligence should be used when working on such patch sets.

jiegec commented 1 year ago

The global variable in the main process is removed.

BenBE commented 1 year ago

Thanks for this note.

Seems as if GH was showing me some outdated (partial) version of the diff earlier for this patch; looks much cleaner now.