pid/lock file functions