Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177835960
D56722.1795394981.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
615 B
Referenced Files
None
Subscribers
None
D56722.1795394981.diff
View Options
diff --git a/usr.bin/lockf/lockf.c b/usr.bin/lockf/lockf.c
--- a/usr.bin/lockf/lockf.c
+++ b/usr.bin/lockf/lockf.c
@@ -317,13 +317,15 @@
static int
acquire_lock(union lock_subject *subj, int flags, int silent)
{
- int fd;
+ int fd, lflags = LOCK_EX;
if (fdlock) {
+ if ((flags & O_NONBLOCK) == O_NONBLOCK)
+ lflags |= LOCK_NB;
assert(subj->subj_fd >= 0 && subj->subj_fd <= INT_MAX);
fd = (int)subj->subj_fd;
- if (flock(fd, LOCK_EX | LOCK_NB) == -1) {
+ if (flock(fd, lflags) == -1) {
if (errno == EAGAIN || errno == EINTR)
return (-1);
err(EX_CANTCREAT, "cannot lock fd %d", fd);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 12:49 AM (4 h, 14 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41919306
Default Alt Text
D56722.1795394981.diff (615 B)
Attached To
Mode
D56722: lockf: Avoid spinning when operating on an fd
Attached
Detach File
Event Timeline