mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-29 18:37:41 +08:00
test file lock.
This commit is contained in:
parent
dcce3ea081
commit
28558ae7d7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user