Add common function lockfile to apue.h and lock.c