added read and write lock of file via fcntl