* Added object for automatic unlock on drop.
* Added appropriate changelog file.
* Fixed doc error on `Flock`.
* Requested changes to make `fcntl::flock` private and OwnedFd instead of RawFd.
* Indent fix.
* Removed doc links to private item, updated imports.
* More import fixes.
* Format changes.
* Remove unused import for redox.
* Added `Flockable` trait per discussions, added tests for `Flock`.
* Simplified flock error conditionals.
* Added missing cfg flags for `Flockable`.
* Added missing cfg flags for impl of `Flockable` on `File`.
* Update src/fcntl.rs
Co-authored-by: SteveLauC <stevelauc@outlook.com>
* Updated `Flockable` comment per suggestion.
* Finalized `FlockArg` as enum and removed TODO accordingly, removed flock wrapper entirely.
* Implemented `Flockable` for `OwnedFd` as well.
* Fixed linting error.
* Updated changelog accordingly.
* Corrected errno logic in `Flock::lock`.
* Properly dropped inner type for `Flock`.
* Replaced `ManuallyDrop` with `Option` as inner `Flock` type to avoid double-free.
* Fixed linting errors.
* Removed unnecessary cfg condition, updated documentation.
* Modified Flock behavior for drop() and unlock().
* Reverted changes to original `flock()` and `FlockArg` for deprecation period, added EINVAL case if the unlock operation is given to `Flock::lock()`.
* Refactored `Flock` to wrap T directly and avoid a double-free after `unlock()` is used.
* Fixed linting errors.
* More linting fixes.
* Fixed example code for `Flock::unlock()`.
* Made requested changes.
* Removed duplicate import.
* Format change.
---------
Co-authored-by: SteveLauC <stevelauc@outlook.com>
* Add more cfg aliases
Add cfg aliases for linux_android, bsd, and freebsdlike. Use them in
many places, though not everywhere they could theoretically be used.
Fixes#2188
* Use apple_targets in build.rs
Co-authored-by: SteveLauC <stevelauc@outlook.com>
* whitespace
Co-authored-by: SteveLauC <stevelauc@outlook.com>
* Define a "solarish" target alias.
* Describe cfg aliases in CONVENTIONS.md
* solarish in line 803
* solarish in line 845
* fix fmt
---------
Co-authored-by: SteveLauC <stevelauc@outlook.com>
* refactor: change dirfd arg of xxxat() to Option<fd>
* changelog
* gate at_rawfd() with features fs or process
* fix import
* fix test on Android
* simplify at_rawfd()
* update changelog
Apparently AWS Graviton containers don't support it. socket() retunrs
EAFNOSUPPORT in that environment.
Also, be more selective about skipping tests under QEMU
Instead of skipping them on architectures where we happen to use QEMU,
only skip them when QEMU is actually being used.
For many of Nix's consumers it be convenient to easily convert a Nix
error into a std::io::Error. That's currently not possible because of
the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have
no equivalent in std::io::Error.
However, very few of Nix's public APIs actually return those unusual
errors. So a more useful API would be for Nix's standard error type to
implement Into<std::io::Error>.
This commit makes Error a simple NewType around Errno. For most
functions it's a drop-in replacement. There are only three exceptions:
* clearenv now returns a bespoke error type. It was the only Nix
function whose error couldn't be cleanly mapped onto an Errno.
* sys::signal::signal now returns Error(Errno::ENOTSUP) instead of
Error::UnsupportedOperation when the user passes an incompatible
argument to `handler`.
* When a NixPath exceeds PATH_MAX, it will now return
Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath.
In the latter two cases there is now some abiguity about whether the
error code was generated by Nix or by the OS. But I think the ambiguity
is worth it for the sake of being able to implement Into<io::Error>.
This commit also introduces Error::Sys() as a migration aid. Previously
that as an enum variant. Now it's a function, but it will work in many
of the same contexts as the original.
Fixes#1155
Travis didn't compile check tests on platforms that couldn't run tests
in CI, so they bitrotted. Let's see how bad they are.
Most annoyingly, 32-bit Android defines mode_t as 16 bits, but
stat.st_mode as 32-bits.
Need to use the right cfg option for the conditional compilation.
target_os is the right option to use when targeting FreeBSD. target_env
was used before which seems to be a typo.
Travis has been super-slow lately (> 6 hours per build). Cirrus is much
faster: about 20 minutes. Cirrus also has slightly better test
coverage, mainly because it doesn't use SECCOMP.
Also,
* Fix the Redox CI build. The old Travis configuration didn't actually
build for Redox, so we never noticed that Redox can't be built with a
stable compiler. Thanks to @coolreader18 for finding this.
* Disable the udp_offload tests on cross-tested platforms. These tests
are failing with ENOPROTOOPT in Cirrus-CI. I suspect it's due to a
lack of support in QEMU. These tests were skipped on Travis because
its kernel was too old.
* Fix require_kernel_version on Cirrus-CI. Cirrus reports the Linux
kernel version as 4.19.112+, which the semver crate can't handle.
* Fix test_setfsuid on Cirrus. When run on Cirrus, it seems like the
file in /tmp gets deleted as soon as it's closed. Probably an
overzealous temporary file cleaner. Use /var/tmp, because no
temporary file cleaner should run in there.
* Skip mount tests on Cirrus. They fail for an unknown reason.
Issue #1351
* Skip the AF_ALG tests on Cirrus-CI
Issue #1352
OFD lock functions don't work as expected on overlayfs, which is a type
of union file system. And OVERLAYFS_SUPER_MAGIC isn't defined on musl,
at least not yet.