kcmp(2): implement for generic file types
(cherry picked from commit f28526e9466cd60ed33053e922238ba1c9040341)