Implement open file descriptor locks in fcntl#1195
Implement open file descriptor locks in fcntl#1195bors[bot] merged 14 commits intonix-rust:masterfrom
Conversation
asomers
left a comment
There was a problem hiding this comment.
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 |
| #[cfg(not(any(target_arch = "aarch64", | ||
| target_arch = "arm", | ||
| target_arch = "armv7", | ||
| target_arch = "i686", |
There was a problem hiding this comment.
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.
I've added a comment and switched to x86.
| 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.
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.
Sorry, forgot to disable rustfmt while editing. It's fixed.
|
|
||
| // 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.
It's probably related to the fact that CI for these platforms runs under QEMU.
There was a problem hiding this comment.
I've amended the comment.
| 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.
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.
Build succeeded |
Hello
This PR updates libc to 0.2.68, which adds the
F_OFD_*fcntl commands, and uses them innix::fcntl::fcntl.