Fix issue with filelock filename being too long on encrypted filesystems
Infer max filename length in filelock on Unix-like systems. Should fix problems on encrypted filesystems such as eCryptfs.

Fix #2924 

cc: @lmmx