file: add a lockf() replacement