-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement open file descriptor locks in fcntl #1195
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a CHANGLOG entry. And if possible, you should add tests for the new feature.
I've added the CHANGELOG entry. I'll try to come up with a test. Does the CI run on Linux? I see only FreeBSD mentioned, and |
CI runs on quite a few platforms. Cirrus does FreeBSD, and Travis does Linux, OSX, NetBSD (build only), and Android (build only) |
So, I've added The failing tests in some architectures are caused by fcntl returning Do you think it would be fine for now to simply not run this test for aarch64, arm, armv7, i686, mips64, mips64el and powerpc64? |
Travis now only fails for i686. I don't know why that test is running despite the |
test/test_fcntl.rs
Outdated
#[cfg(not(any(target_arch = "aarch64", | ||
target_arch = "arm", | ||
target_arch = "armv7", | ||
target_arch = "i686", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try "x86" instead of "i686". Also, please explain in a comment why the test is disabled on certain architectures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment and switched to x86.
test/test_fcntl.rs
Outdated
tmp.path().file_name().unwrap(), | ||
OFlag::O_RDONLY, | ||
Mode::empty()).unwrap(); | ||
let dirfd = open(tmp.path().parent().unwrap(), OFlag::empty(), Mode::empty()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you made some formatting changes unrelated to this PR. Could you please back those out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forgot to disable rustfmt while editing. It's fixed.
test/test_fcntl.rs
Outdated
|
||
// This test is disabled for the target architectures below | ||
// due to OFD locks not being available in the kernel/libc | ||
// versions used in the CI environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably related to the fact that CI for these platforms runs under QEMU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've amended the comment.
test/test_fcntl.rs
Outdated
fcntl(fd, FcntlArg::F_OFD_SETLKW(&flock)).expect("write unlock failed"); | ||
assert_eq!(None, lock_info(inode)); | ||
|
||
flock.l_type = libc::F_RDLCK as libc::c_short; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this test is doing two separate things: setting and clearing a write lock, and setting and clearing a read lock. Please split it up into two separate tests. That will make it easier to debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
bors r+
Build succeeded |
Hello
This PR updates libc to 0.2.68, which adds the
F_OFD_*
fcntl commands, and uses them innix::fcntl::fcntl
.