Uh oh!
There was an error while loading. Please reload this page.
Basic fcntl-style locking. - #555
Conversation
35909b1 to
b030c43CompareAdd an `fcntl_lock` function implementing fcntl-style process-associated locking. Currently this only supports locking the entire file.
b030c43 to
5390d82Compare
cgwalters
left a comment
There was a problem hiding this comment.
Somewhat superficial LGTM
| #[cfg(target_pointer_width = "32")] | ||
| { | ||
| ret(syscall_readonly!( | ||
| __NR_fcntl64, |
There was a problem hiding this comment.
How about if cfg!(target_pointer_width = "32") { __NR_fcntl64 } else { __NR_fcntl } here and dedup the blocks?
There was a problem hiding this comment.
Unfortunately syscall_readonly! is a macro that does special things with the first parameter and needs it to be a __NR_* literal.
| l_whence: 0, | ||
| l_start: 0, | ||
| l_len: 0, | ||
| ..core::mem::zeroed() |
There was a problem hiding this comment.
Feels like we could rely on core::mem::zeroed() also handling the zero-init for the other members?
There was a problem hiding this comment.
Setting l_len to zero is a special case in the documented behavior of fcntl, so I like keeping it explicit. I've now added more comments about this though.
Add an
fcntl_lockfunction implementing fcntl-style process-associated locking. Currently this only supports locking the entire file.