kernel: Add kqsort_r()

Obtained-from: FreeBSD