Replace flock with fctnl to fix portability issues on Solaris.