summaryrefslogtreecommitdiff
path: root/CHANGELOG.md
AgeCommit message (Collapse)Author
2020-10-03Merge #1300bors[bot]
1300: Add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP support r=asomers a=voidc Closes #1249. I think @jabedude was working on this, but as there was no progress since May I went ahead and implemented it myself. I'm not completely sure about the cfg gates. Could we enable the functions for more targets? I'm also open for suggestions of better names for the new functions. Co-authored-by: Dominik Stolz <d.stolz@tum.de>
2020-10-03Merge #1293bors[bot]
1293: Mark nix::unistd::fork as unsafe. r=asomers a=vi Fix tests. No change in documentation. Resolves #1030. Don't forget to bump major version number to `0.19`. Co-authored-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
2020-10-03Add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP supportDominik Stolz
2020-09-28Added clock_gettime, clock_getres, clock_settime, clock_getcpuclockidDaniil Bondarev
2020-09-20Add CHANGELOG.md entry about unsafe fork.Vitaly _Vi Shukela
2020-08-22Merge branch 'master' into musl_seekAlan Somers
2020-08-22Add changelog entryAmanieu d'Antras
2020-08-22Merge #1278bors[bot]
1278: Allow both &[CString] and &[&CStr] for sequence args in unistd r=asomers a=youknowone I am new to this project, so I wonder this kind of change is acceptable for the project or not. I agree taking `&[&CStr]` is the ideal way for the functions. But unfortunately, when users generate `CString`s from `&str`, they may get `&[CString]` rather than `&[&CStr]` Unlike single `CString` to `&CStr` argument, there is no easy way to convert `&[CString]` to `&[&CStr]` without creating new vector. By changing the type from `&[&CStr]` to `&[AsRef<CStr>]`, the args now can take both `&[CString]` and `&[&CStr]` without changing that much from nix. Co-authored-by: Jeong YunWon <jeong@youknowone.org>
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-07-28Allow both &[CString] and &[&CStr] for sequence argsJeong YunWon
2020-07-26Release version 0.18.0Alan Somers
2020-07-26Support nullable timeout in ppollMikail Bagishov
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-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-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-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-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-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-12Add fchown(2) wrapper.Nate Avers
2020-06-05Respond to review commentsAlan Somers
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
2020-05-26Update CHANGELOG.md now that I have a PR numberNick Pelone
2020-05-17Replace void crate with Rust standard lib Infallible typeOssi Herrala
std::convert::Infallible has been available since Rust 1.34 and nix currently targets Rust 1.36 or later so this should not cause problems. Fixes #1238
2020-05-17Merge #1242bors[bot]
1242: Don't implement `NixPath` for `Option<&P> where P: NixPath` r=asomers a=asomers Most Nix functions that accept `NixPath` arguments can't do anything useful with `None`. The exceptions (`mount` and `quotactl_sync`) already take explicitly optional arguments. Also, this changes the behavior of `mount` with `None` arguments. Previously, it would call mount(2) with empty strings for those arguments. Now, it will use null pointers. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-17Merge #1245bors[bot]
1245: Make ptrace::write unsafe on Linux r=asomers a=asomers It always should've been unsafe, because it dereferences a user-provided pointer. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-16Make ptrace::write unsafe on LinuxAlan Somers
It always should've been unsafe, because it dereferences a user-provided pointer.
2020-05-16Apply `repr(transparent)` to several FFI typesAlan Somers
repr(transparent) is required in order to safely cast between an FFI type and its NewType. This commit applies that attribute to PollFd, EpollEvent, IpMembershipRequest, Ipv6MembershipRequest, TimeVal, and IoVec. Fixes #1241
2020-05-16Don't implement `NixPath` for `Option<&P> where P: NixPath`Alan Somers
Most Nix functions that accept `NixPath` arguments can't do anything useful with `None`. The exceptions (`mount` and `quotactl_sync`) already take explicitly optional arguments. Also, this changes the behavior of `mount` with `None` arguments. Previously, it would call mount(2) with empty strings for those arguments. Now, it will use null pointers.
2020-05-12Merge #1231bors[bot]
1231: Add support for reading symlinks longer than `PATH_MAX` to `readlink` and `readlinkat` r=asomers a=SolraBizna This is in response to issue #1178. The new logic uses the following approach. - At any time, if `readlink` returns an error, or a value ≥ 0 and < (not ≤!) the buffer size, we're done. - Attempt to `readlink` into a `PATH_MAX` sized buffer. (This will almost always succeed, and saves a system call over calling `lstat` first.) - Try to `lstat` the link. If it succeeds and returns a sane value, allocate the buffer to be that large plus one byte. Otherwise, allocate the buffer to be `PATH_MAX.max(128) << 1` bytes. - Repeatedly attempt to `readlink`. Any time its result is ≥ (not >!) the buffer size, double the buffer size and try again. While testing this, I discovered that ext4 doesn't allow creation of a symlink > 4095 (Linux's `PATH_MAX` minus one) bytes long. This is in spite of Linux happily allowing paths in other contexts to be longer than this—including on ext4! This was probably instated to avoid breaking programs that assume `PATH_MAX` will always be enough, but ironically hindered my attempt to test support for *not* assuming. I tested the code using an artificially small `PATH_MAX` and (separately) a wired-to-fail `lstat`. `strace` showed the code behaving precisely as expected. Unfortunately, I can't add an automatic test for this. Other changes made by this PR: - `wrap_readlink_result` now calls `shrink_to_fit` on the buffer before returning, potentially reclaiming kilobytes of memory per call. This could be very important if the returned buffer is long-lived. - `readlink` and `readlink_at` now both call an `inner_readlink` function that contains the bulk of the logic, avoiding copy-pasting of code. (This is much more important now that the logic is more than a few lines long.) Notably, this PR does *not* add support for systems that don't define `PATH_MAX` at all. As far as I know, I don't have access to any POSIX-ish OS that doesn't have `PATH_MAX`, and I suspect it would have other compatibility issues with `nix` anyway. Co-authored-by: Solra Bizna <solra@bizna.name>
2020-05-10Add support for reading symlinks longer than `PATH_MAX` to `readlink` and ↵Solra Bizna
`readlinkat`
2020-05-08Add SO_BINDTODEVICE sockoptJean Pierre Dudey
This is available only on Linux as far I know, [socket(7)](https://linux.die.net/man/7/socket) has some information about the `SO_BINDTODEVICE` sockopt. In simple words it binds a socket to an specific network device (specified as an string like "wlo1", "eth0", etc.), to only process packets from that device. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2020-05-02Add UnixCredentials support on FreeBSD/DragonFly (cmsgcred/SCM_CREDS)Greg V
2020-05-01Merge #1215bors[bot]
1215: Remove sys::socket::addr::from_libc_sockaddr from the public API r=posborne a=asomers This function never should've been public, since it's basically impossible to use directly. It's only public due to an oversight from PR #667 . Co-authored-by: Alan Somers <asomers@gmail.com>
2020-04-26Support sendmmsg/recvmmsgGleb Pomykalov
2020-04-25Support UDP GSO and GRO on linuxGleb Pomykalov
2020-04-22Merge #1211bors[bot]
1211: Feature/hugepage size r=asomers a=GuillaumeDIDIER Should solve #1194 . Co-authored-by: GuillaumeDIDIER <guillaume.didier95@hotmail.fr>
2020-04-21Add the MAP_HUGE_<SIZE> flags for linux.GuillaumeDIDIER
Closes #1194 Use git libc for development (Remember to reset this to released version for the next nix release, once libc has released >=0.2.69)
2020-04-19Merge #1207bors[bot]
1207: Add select::FdSet::fds() method r=asomers a=zombiezen To be more consistent with most Rust APIs and enable cloning of the iterator, I made `FdSet::contains` operate on an immutable borrow instead of a mutable one by copying the set. If this is not desirable, I can roll that back from this PR and focus purely on the `fds()` method. Co-authored-by: Ross Light <ross@zombiezen.com>
2020-04-19Merge #1206bors[bot]
1206: Fix unaligned casting of cmsg data to af_alg_iv r=asomers a=glebpom Casting a pointer to `cmsg_data` to `af_alg_iv` is incorrect since it's not properly aligned. As of the [`cmsg` man page](http://man7.org/linux/man-pages/man3/cmsg.3.html) "Applications should not cast it to a pointer type matching the payload, but should instead use memcpy(3) to copy data to or from a suitably declared object." Co-authored-by: Gleb Pomykalov <gleb@lancastr.com>
2020-04-14Remove stray # in CHANGELOGRoss Light
2020-04-14Add PR reference to CHANGELOGRoss Light