summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-08-22Merge #1282bors[bot]
1282: `ioctl-number.rst` moved. Update the link. r=asomers a=SolraBizna <!-- This space deliberately left blank --> Co-authored-by: Solra Bizna <solra@bizna.name>
2020-08-22Merge #1289bors[bot]
1289: Add Netlink Protocol Families to SockProtocol enum r=asomers a=sinkingpoint Currently the SockProtocol enum is rather scarce. This commit adds the Netlink protocols defined in netlink(7) to the SockProtocol enum allowing us to use the Nix socket library for more in-depth Netlink work. Because of the way libc sockets work, this is a bit more annoying than it has any right to be - the Socket Family and the Socket protocol are intertwined in that a given c_int protocol can represent different things depending on the family. This means that as we add values to this enum we're going to get collisions (Indeed, I've left out a few values that collided with the existing TCP/UDP Protocols). I'm not sure how we would want to handle this going forward - maybe different Protocol enums for different Familys, with `Into<SockProtocol>` methods? I followed the existing pattern in this file when adding these, but perhaps as this enum gets bigger, we should use the libc_enum macro for cleanliness? Co-authored-by: sinkingpoint <colin@quirl.co.nz>
2020-08-18Add Netlink Protocol Families to SockProtocol enumsinkingpoint
Currently the SockProtocol enum is rather scarce. This commit adds the Netlink protocols defined in netlink(7) to the SockProtocol enum allowing us to use the Nix socket library for more indepth Netlink work
2020-08-17Merge #1291bors[bot]
1291: doc typo in fchmodat r=asomers a=edneville fchmod should be fchmodat Signed-off-by: ed neville <ed@s5h.net> Co-authored-by: ed neville <ed@s5h.net>
2020-08-13doc typo in fchmodated neville
fchmod should be fchmodat Signed-off-by: ed neville <ed@s5h.net>
2020-08-02`ioctl-number.rst` moved. Update the link.Solra Bizna
2020-07-27Merge #1277bors[bot]
1277: Release version 0.18.0 r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2020-07-26Release version 0.18.0Alan Somers
2020-07-26Merge #1270bors[bot]
1270: Support nullable timeout in ppoll r=asomers a=MikailBag Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru>
2020-07-26Support nullable timeout in ppollMikail Bagishov
2020-07-26Merge #1276bors[bot]
1276: Raise libc dependecy to 0.2.73 r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2020-07-26Raise libc dependecy to 0.2.73Alan Somers
2020-07-25Merge #1224bors[bot]
1224: Update the Linux CI environment to Ubuntu Bionic r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com> Co-authored-by: Alan Somers <asomers@axcient.com>
2020-07-24Merge #1261bors[bot]
1261: Adding an implementation for timerfd. r=asomers a=vdagonneau-anssi Hello, I have encountered a situation where I needed to use timerfd in addition to other fd with nix implementation of epoll. Here is a basic implementation of this feature, I also added some documentation and tests. Note: currently testing works by pausing for 1-3 seconds. Obviously it is pretty bad if we want tests to run quickly but that was my best idea at the time. Feel free to suggest any other way. Thank you! Co-authored-by: Vincent Dagonneau <vincent.dagonneau@ssi.gouv.fr>
2020-07-07Adding an implementation and some basic tests for timerfd.Vincent Dagonneau
Removed support for timerfd on Android as it seems to have been deprecated? See https://android.googlesource.com/platform/development/+/73a5a3b/ndk/platforms/android-20/include/sys/timerfd.h or https://github.com/rust-lang/libc/issues/1589 Removed the public status of `TimerSpec`, as it should not be exposed to the user. Implemented `FromRawFd` for `TimerFd` as it already implements `AsRawFd`. Addressed comments from the latest code review: - Removed upper bound assertions on timer expirations in tests. - Made the main example runnable and added code to show how to wait for the timer. - Refactored `ClockId` to use `libc_enum`. - Added comments for all public parts of the module. - Wrapped to 80 cols. - Changed the size of the buffer in the tests to the minimum required. * Ran rustfmt. * Added a `From` implementation for `libc::timespec` -> `TimeSpec`. * Reworked the example with the new changes and changed the timer from 5 to 1 second. * Added a constructor for a 0-initialized `TimerSpec`. * Added a new method to get the timer configured expiration (based on timerfd_gettime). * Added an helper method to unset the expiration of the timer. * Added a `wait` method to actually read from the timer. * Renamed `settime` into just `set`. * Refactored the tests and added a new one that tests both the `unset` and the `get` method. Modified CHANGELOG.
2020-07-07Merge #1265bors[bot]
1265: Expose IP_PKTINFO Control Message on Android and iOS r=asomers a=bltavares The commit https://github.com/nix-rust/nix/pull/1222 added the very useful Ipv4PktInfo to allow `sendmsg` to define the origin of the ip. Unfortunattely, it didn't add the struct to Android target devices as well. This commit adds the `target_os = "android"` and `target_os =" ios"` checks on the same place to allow the compilation to work for the following archs tested: - `cross build --target aarch64-linux-android` - `cross build --target x86_64-linux-android` - `cross build --target armv7-linux-androideabi` - `cross build --target aarch64-apple-ios` - `cross build --target x86_64-apple-ios` Co-authored-by: Bruno Tavares <connect+github@bltavares.com>
2020-07-04Expose IP_PKTINFO Control Message on AndroidBruno Tavares
The commit https://github.com/nix-rust/nix/pull/1222 added the very useful Ipv4PktInfo to allow `sendmsg` to define the origin of the ip. Unfortunattely, it didn't add the struct to Android target devices as well. This commit adds the `target_os = "android"` checks on the same place to allow the compilation to work for the following archs tested: - `cross build --target aarch64-linux-android` - `cross build --target x86_64-linux-android` - `cross build --target armv7-linux-androideabi` Also introduces iOS to allow using on libs for those platforms
2020-07-04Merge #1266bors[bot]
1266: Add FsType for cgroupfs r=asomers a=KentaTada `CGROUP_SUPER_MAGIC` and `CGROUP2_SUPER_MAGIC` are not supported currently. Signed-off-by: Kenta Tada <Kenta.Tada@sony.com> Co-authored-by: Kenta Tada <Kenta.Tada@sony.com>
2020-07-04Add FsType for cgroupfsKenta Tada
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-07-03Merge #1259bors[bot]
1259: implement ttyname and ttyname_r r=asomers a=doy this fixes #1204. i know this at least works on linux, but i'm not super sure about other platforms - happy to add conditionals if it makes sense. Co-authored-by: Jesse Luehrs <doy@tozt.net>
2020-07-03implement ttynameJesse Luehrs
2020-07-03Merge #1244bors[bot]
1244: Clippy cleanup r=asomers a=asomers Reported-by: Clippy Co-authored-by: Alan Somers <asomers@gmail.com>
2020-07-03Merge #1264bors[bot]
1264: Update the FreeBSD test image to 11.4-release r=asomers a=asomers And temporarily disable travis targets Co-authored-by: Alan Somers <asomers@gmail.com>
2020-07-03Update the Linux CI environment to Ubuntu BionicAlan Somers
2020-07-03Skip the OFD locks tests on OverlayFS and muslAlan Somers
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.
2020-07-03Add a missing require_capability! to a testAlan Somers
2020-07-03Factor out common code from the various skip macrosAlan Somers
2020-07-03Update the FreeBSD test image to 11.4-releaseAlan Somers
2020-07-03Merge #1268bors[bot]
1268: Drop support for powerpc64-unknown-linux-gnu r=asomers a=asomers The build is failing due to no fault of Nix. Even rust-embedded/cross has given up on fixing it, so there's no hope for us. Fixes #1267 See also https://github.com/rust-embedded/cross/pull/440 Co-authored-by: Alan Somers <asomers@gmail.com>
2020-07-02Drop support for powerpc64-unknown-linux-gnuAlan Somers
The build is failing due to no fault of Nix. Even rust-embedded/cross has given up on fixing it, so there's no hope for us. Fixes #1267 See also https://github.com/rust-embedded/cross/pull/440
2020-06-30Merge #1263bors[bot]
1263: Don't run redoxer in CI r=asomers a=asomers It's unreliable. It frequently hangs starting the Docker image, before Cargo gets involved. Instead, use cargo to do a cross-build for Redox. Do it manually, since rust-embedded/cross doesn't support Redox. https://github.com/nix-rust/nix/issues/1258 https://github.com/rust-embedded/cross/issues/427 Co-authored-by: Alan Somers <asomers@gmail.com>
2020-06-27Fix an "unused import" warning on muslAlan Somers
2020-06-27misc clippy cleanupAlan Somers
2020-06-27Make SockAddr::as_ffi_pair safeAlan Somers
It was only marked unsafe because it did a pointer cast, but that particular pointer cast is always allowed by C.
2020-06-27Make Errno::clear safeAlan Somers
All it does is assign a value to a thread-local int. There's nothing unsafe about that.
2020-06-27Prefer to pass Inotify by value instead of by referenceAlan Somers
It's small and `Copy`, so pass by value is more efficient. This is technically a breaking change, but most code should compile without changes.
2020-06-27implement Default for UnixCredentials on LinuxAlan Somers
2020-06-27implement `Default` for `CpuSet`.Alan Somers
2020-06-27Make sys::socket::sockaddr_storage a safe functionAlan Somers
It already fully validated its arguments, so there's no need for it to be `unsafe`.
2020-06-27Fix an unaligned pointer read in Inotify::read_eventsAlan Somers
Reported-by: Clippy
2020-06-27Don't run redoxer in CIAlan Somers
It's unreliable. It frequently hangs starting the Docker image, before Cargo gets involved. Instead, use cargo to do a cross-build for Redox. Do it manually, since rust-embedded/cross doesn't support Redox. https://github.com/nix-rust/nix/issues/1258 https://github.com/rust-embedded/cross/issues/427
2020-06-27Merge #1222bors[bot]
1222: Add Ipv{4,6}PacketInfo support to ControlMessage for send{m,}msg. r=asomers a=isomer This adds Ipv4PacketInfo and Ipv6PacketInfo to ControlMessage, allowing these to be used with sendmsg/sendmmsg. Co-authored-by: Perry Lorier <perryl@google.com>
2020-06-26Add Ipv{4,6}PacketInfo support to ControlMessage for send{m,}msgPerry Lorier
This adds Ipv4PacketInfo and Ipv6PacketInfo to ControlMessage, allowing these to be used with sendmsg/sendmmsg. This change contains the following squashed commits: Add Ipv{4,6}PacketInfo to ControlMessage. Add documentation links to Ipv{4,6}PacketInfo Add changelog entry for Ipv{4,6}PacketInfo Add link to PR in the Changelog. Add extra build environments. Add tests for Ipv{4,6}PacketInfo. Swap #[test] and #[cfg] The CI appears to be running the test, even though it's not cfg'd for that platform. I _think_ this might be due to these being in the wrong order. So lets try swapping them. s/freebsd/netbsd/ for Ipv4PacketInfo netbsd supports in_pktinfo, not freebsd. Fix the cfg for Ipv{4,6}PacketInfo usage. Ah, I see what I did wrong. I had fixed the definitions, but I had the wrong cfg() in the usage. This has the usage match the definitions. Change SOL_IPV6 to IPPROTO_IPV6. FreeBSD doesn't have SOL_IPV6, but does have IPPROTO_IPV6, and the two constants are defined as being equal. So change to use IPPROTO_IPV6. Skip Ipv6PacketInfo test if v6 is not available. If IPv6 is not available, then when we try and bind to ip6-localhost, we'll get a EADDRNOTAVAIL, so skip the test. This should mean that the test will run on any machine that has a v6 loopback address. More architecture cfg() fixes. These all need to be the same, and they were not. Make them them all the same. Attempt III. Fix up mismatched cfg's again. Take IV. Make sure the cfg's that use a enum variant match the enum definition.
2020-06-12Merge #1255bors[bot]
1255: Remove several deprecated constants and functions r=asomers a=asomers * `unistd::daemon` on Apple * `unistd::pipe2` on Apple * `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple * `sys::event::FilterFlag::NOTE_REAP` on Apple * `sys::ptrace::ptrace` on Android and Linux All have been deprecated for more than two releases and one year. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-06-12Merge #1257bors[bot]
1257: Add fchown(2) wrapper r=asomers a=nateavers Mentioned [in #1029](https://github.com/nix-rust/nix/issues/1029#issuecomment-622972782). Co-authored-by: Nate Avers <nathan.avers@alumni.case.edu>
2020-06-12Add fchown(2) wrapper.Nate Avers
2020-06-05Respond to review commentsAlan Somers
2020-06-04Merge pull request #1235 from nix-rust/termios_constructorBryant Mairs
Limit internal termios API to pub(crate)
2020-06-04Remove several deprecated constants and functionsAlan Somers
* `unistd::daemon` on Apple * `unistd::pipe2` on Apple * `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple * `sys::event::FilterFlag::NOTE_REAP` on Apple * `sys::ptrace::ptrace` on Android and Linux All have been deprecated for more than two releases and one year.
2020-06-04Limit internal termios API to pub(crate)Bryant Mairs