Revert r255672, it has some serious flaws, leaking file references etc.

Approved by:	re (delphij)
Regen.

Approved by:	re (delphij)
Fix panic in ktrcapfail() when no capability rights are passed.
While here, correct all consumers to pass NULL instead of 0 as we pass
capability rights as pointers now, not uint64_t.

Reported by:	Daniel Peyrolon
Tested by:	Daniel Peyrolon
Approved by:	re (marius)