Change get_real_filename() to unix syscall conventions, make it non-static