There are different ways depending on what you need. "commit all workdir" doesn't convey which one.
If you want to update the version of every file that is tracked, you can loop over the entries in the index and call git_index_add_bypath
for each.
For anything else, things get murky, as you may or may not want to take ignore rules into account. The general solution would be to use the status API to see which files have been changed or added and add those to the index according to the result you're looking for (ignore rules, adding new files or not, removing files that aren't in the worktree anymore).