问题描述
- 关于fcntl函数的奇怪现象,求大神解决
-
memset(&wflk,0,sizeof(struct flock)); wflk.l_type = F_WRLCK; wflk.l_whence = 0; wflk.l_start = SEEK_SET; wflk.l_len = 0;
fcntl(fd, F_SETLK, &wflk);
if(wflk.l_type==F_UNLCK){
printf("lock has F-UNLCK1n");}
else{
printf("1n");
}if(fcntl(fd, F_GETLK, &wflk)==0){ if(wflk.l_type==F_UNLCK){ printf("lock has F-UNLCK2n"); } } 为什么输出会是1和lock has F-UNLCK2 这是什么情况求解决呀
时间: 2024-12-11 00:00:56