added mkstemp usage
exclude write lock of fcntl
add usage of F_SETLKW