implement realpath directly instead of using procfs readlink