You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would let us get rid of most of exfile.c(), and replace it with just open / lock / close.
The issue with normal F_SETLK is that they are process specific. So two threads can't lock the same file. With F_OFD_SETLK, different threads should be able to lock the same file without an issue.
The text was updated successfully, but these errors were encountered:
F_OFD_SETLK (struct flock *)
Acquire an open file description lock (when l_type is
F_RDLCK or F_WRLCK) or release an open file description
lock (when l_type is F_UNLCK) on the bytes specified by
the l_whence, l_start, and l_len fields of lock. If a
conflicting lock is held by another process, this call
returns -1 and sets [errno](https://man7.org/linux/man-pages/man3/errno.3.html) to EAGAIN.
Open file description locks are useful in the same sorts of situations as process-associated locks. They can also be used to synchronize file access between threads within the same process by having each thread perform its own open of the file, to obtain its own open file description.
Message
Linux and apparently OSX support F_OFD_SETLK, which is what you would really expect from F_SETLK.
https://lwn.net/Articles/586904/
https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html
https://man7.org/linux/man-pages/man2/fcntl.2.html
https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h
It's not clear if FreeBSD has them.
This would let us get rid of most of exfile.c(), and replace it with just open / lock / close.
The issue with normal F_SETLK is that they are process specific. So two threads can't lock the same file. With F_OFD_SETLK, different threads should be able to lock the same file without an issue.
The text was updated successfully, but these errors were encountered: