Changed locking scheme.

Well.. after lot of reading of glibc, openssh, freebsd libc code I
decided to just use fcntl file locks.