fl.l_type = F_WRLCK;
fl.l_whence = fl.l_start = 0;
fl.l_len = 0; /* 0 means "to end of file" */
res = fcntl(fd, F_SETLK, &fl);
fl.l_type = F_WRLCK;
fl.l_whence = fl.l_start = 0;
fl.l_len = 0; /* 0 means "to end of file" */
res = fcntl(fd, F_SETLK, &fl);