refs.c: convert it to use lockfile interface.