Implement library for lockfiles and use it in cfg code.