test file lock.

This commit is contained in:
shuxin   zheng 2024-04-22 16:52:03 +08:00
parent dcce3ea081
commit 28558ae7d7

View File

@ -76,14 +76,18 @@ int acl_myflock(ACL_FILE_HANDLE fd, int lock_style, int operation)
};
memset((char *) &lock, 0, sizeof(lock));
lock.l_type = lock_ops[operation & ~ACL_FLOCK_OP_NOWAIT];
lock.l_type = lock_ops[operation & ~ACL_FLOCK_OP_NOWAIT];
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0;;
request = (operation & ACL_FLOCK_OP_NOWAIT) ? F_SETLK : F_SETLKW;
while ((status = fcntl(fd, request, &lock)) < 0
&& request == F_SETLKW
&& (acl_last_error() == ACL_EINTR
|| acl_last_error() == ENOLCK
|| acl_last_error() == EDEADLK))
|| acl_last_error() == EDEADLK)) {
sleep(1);
}
break;
}
#endif