Resilient to surprising situations

I've spent a lot of time making getargv able to handle edge cases

Correctness as the First Priority

My impetus for building getargv was to parse a PID's arguments that I didn't control, in a script; which required me to consider the different ways that the process could have been created. In doing so, I found some surprising edge cases which no-one else seems to have handled correctly, but getargv does.

The test suite for getargv is currently 1.770× as big as the source for the program itself. With 100% line, function, and branch coverage. And I'm still expanding the test suite.

Out of curiosity I went and looked for every use of KERN_PROCARGS2 I could find on the internet. Every single case where the arguments are considered, is incorrect. 89 projects, and every project that uses them as dependencies, all wrong.

Hall of Fame

The following projects are using KERN_PROCARGS2 correctly to view processes' arguments, if you'd like to be on the list, might I suggest using libgetargv, alternatively you can point me to your repo so that I can verify and add you to the list.

  • getargv and libgetargv

Edge cases handled by getargv

  • Target process has an empty argv[0]
  • Target process has empty arguments
  • Target process has no arguments
  • Target process has huge arguments
  • Invalid target PID
  • Insufficient permissions to target PID
  • Incorrect flags for getargv
  • System out of memory
  • Any argument encoding that doesn't use as a valid char
homepage link