shared: add readlink_value

Reads the basename of the target of a symlink.