readdir: move compat syscalls from compat.c