libkvm allows to get the command line used for a process; it's used here as an alternative of reading /proc which is not available on FreeBSD.
Created attachment 229293 [details, diff] libkvm support
style problems: - sys/sysctl.h order is incorrect in configure.ac - HAVE_XXX values should be defined/undefined, not 0/1 ... then use #ifdef - style in sb_get_kvm_cmdline() is broken in many ways - replace sb_get_cmdline instead of a new sb_get_kvm_cmdline() -- have it return a dummy file name - move the contents of sb_get_kvm_cmdline() to your own sb_copy_file_to_fd(). if you want to extend the arguments to also pass in the pid, that's fine.
Created attachment 229423 [details, diff] new version
Created attachment 229425 [details, diff] new patch again missed one #if -> #ifdef
(In reply to comment #2) > style problems: > - sys/sysctl.h order is incorrect in configure.ac > - HAVE_XXX values should be defined/undefined, not 0/1 ... then use #ifdef done > - style in sb_get_kvm_cmdline() is broken in many ways please be more verbose > - replace sb_get_cmdline instead of a new sb_get_kvm_cmdline() -- have it > return a dummy file name > - move the contents of sb_get_kvm_cmdline() to your own sb_copy_file_to_fd(). > if you want to extend the arguments to also pass in the pid, that's fine. done and renamed to match the extra argument
reading the rest of the file shows the correct style ... - you need whitespace between for/if and the paren - whitespace doesnt save code, so you need spaces after the semicolons in for() and commas in function arguments - dont put if statements on the same line - you dont need the paren in the 3rd arg to kvm_getprocs - it's "type *var", not "type * var".
Created attachment 229447 [details, diff] updated version