Source code

Revision control

Copy as Markdown

Other Tools

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).
# Change Log
## [0.29.0] - 2024-05-24
### Added
- Add `getregset()/setregset()` for Linux/glibc/x86/x86_64/aarch64/riscv64 and
`getregs()/setregs()` for Linux/glibc/aarch64/riscv64
- Add socket option Ipv6Ttl for apple targets.
- Add socket option UtunIfname.
- make SigAction repr(transparent) & can be converted to the libc raw type
- Add `From` trait implementation for conversions between `sockaddr_in` and
`SockaddrIn`, `sockaddr_in6` and `SockaddrIn6`
- Add socket option ReusePortLb for FreeBSD.
- Added support for openat2 on linux.
- Add if_indextoname function.
- Add `mount` and `unmount` API for apple targets.
- Added `_PC_MIN_HOLE_SIZE` for `pathconf` and `fpathconf`.
- Added `impl AsFd for pty::PtyMaster`
- Add `open` flag `O_SEARCH` to AIX, Empscripten, FreeBSD, Fuchsia, solarish,
- Add prctl function `prctl_set_vma_anon_name` for Linux/Android.
- Add `sync(2)` for `apple_targets/solarish/haiku/aix/hurd`, `syncfs(2)` for
`hurd` and `fdatasync(2)` for `aix/hurd`
- Add fdatasync support for Apple targets.
- Add `fcntl::OFlag::O_PATH` for FreeBSD and Fuchsia
- Added `PathconfVar::MIN_HOLE_SIZE` for apple_targets.
- Add `open` flag `O_SEARCH` to apple_targets
- `O_DSYNC` may now be used with `aio_fsync` and `fcntl` on FreeBSD.
- Added `Flock::relock` for upgrading and downgrading locks.
### Changed
- Change the `ForkptyResult` type to the following repr so that the
uninitialized
`master` field won't be accessed in the child process:
```rs
pub enum ForkptyResult {
Parent {
child: Pid,
master: OwnedFd,
},
Child,
}
- Updated `cfg_aliases` dependency from version 0.1 to 0.2
- Change the signature of `ptrace::write` and `ptrace::write_user` to make them
- Allow use of `SignalFd` through shared reference
Like with many other file descriptors, concurrent use of signalfds is safe.
Changing the signal mask of and reading signals from a signalfd can now be
done
with the `SignalFd` API even if other references to it exist.
- Changed tee, splice and vmsplice RawFd arguments to AsFd.
- Added I/O safety to the sys/aio module. Most functions that previously
accepted a `AsRawFd` argument now accept an `AsFd` instead.
- `RecvMsg::cmsgs()` now returns a `Result`, and checks that cmsgs were not
### Fixed
- No longer panics when the `fanotify` queue overflows.
- Fixed ControlMessageOwned::UdpGroSegments wrapped type from u16 to i32 to
reflect the used kernel's one.
## [0.28.0] - 2024-02-24
### Added
- Added `mkdtemp` wrapper ([#1297](https://github.com/nix-rust/nix/pull/1297))
- Add associated constants `UTIME_OMIT` `UTIME_NOW` for `TimeSpec`
- Added `EventFd` type. ([#1945](https://github.com/nix-rust/nix/pull/1945))
- - Added `impl From<Signal> for SigSet`.
- Added `impl std::ops::BitOr for SigSet`.
- Added `impl std::ops::BitOr for Signal`.
- Added `impl std::ops::BitOr<Signal> for SigSet`
- Added `TlsGetRecordType` control message type and corresponding enum for
- Added `Ipv6HopLimit` to `::nix::sys::socket::ControlMessage` for Linux,
MacOS, FreeBSD, DragonflyBSD, Android, iOS and Haiku.
- Added `Icmp` and `IcmpV6` to `SockProtocol`
- Added rfork support for FreeBSD in `unistd`
- Added `MapFlags::map_hugetlb_with_size_log2` method for Linux targets
- Added `mmap_anonymous` function
- Added `mips32r6` and `mips64r6` support for signal, ioctl and ptrace
- Added `F_GETPATH` FcntlFlags entry on Apple/NetBSD/DragonflyBSD for
`::nix::fcntl`. ([#2142](https://github.com/nix-rust/nix/pull/2142))
- Added `F_KINFO` FcntlFlags entry on FreeBSD for `::nix::fcntl`.
- Added `F_GETPATH_NOFIRMLINK` and `F_BARRIERFSYNC` FcntlFlags entry
on Apple for `::nix::fcntl`.
- Added newtype `Flock` to automatically unlock a held flock upon drop.
Added `Flockable` trait to represent valid types for `Flock`.
- Added `SetSockOpt` impls to enable Linux Kernel TLS on a TCP socket and to
import TLS parameters. ([#2175](https://github.com/nix-rust/nix/pull/2175))
- - Added the `::nix::sys::socket::SocketTimestamp` enum for configuring the
`TsClock` (a.k.a `SO_TS_CLOCK`) sockopt
- Added FreeBSD's `ScmRealtime` and `ScmMonotonic` as new options in
`::nix::sys::socket::ControlMessageOwned`
- Added new fanotify API: wrappers for `fanotify_init` and `fanotify_mark`
- Added `SpecialCharacterindices` support for haiku.
- Added `sys::sendfile` support for solaris/illumos.
- impl Display for InterfaceFlags
- Added `sendfilev` in sys::sendfile for solarish
- Added `fctrl::SealFlag::F_SEAL_FUTURE_WRITE`
- Added `Ipv6MulticastHops` as socket option to set and read.
- Enable `ControlMessageOwned::Ipv4RecvIf` and
`ControlMessageOwned::Ipv4RecvDstAddr` for DragonFlyBSD
- `ClockId::set_time()` and `time::clock_settime()` are now enabled on macOS
- Added `IpBindAddressNoPort` sockopt to support `IP_BIND_ADDRESS_NO_PORT`
available on linux. ([#2244](https://github.com/nix-rust/nix/pull/2244))
- Enable `MapFlags::map_hugetlb_with_size_log2` method for Android/Fuchsia
- Added `TcpFastOpenConnect` sockopt to support `TCP_FASTOPEN_CONNECT`
available on linux. ([#2247](https://github.com/nix-rust/nix/pull/2247))
- Add `reboot(2)` for OpenBSD/NetBSD
- Added new `MemFdCreateFlag` constants to `sys::memfd` on Linux and Android
related to hugetlbfs support.
- Expose the inner fd of `Kqueue` through:
* impl AsFd for Kqueue
* impl From\<Kqueue\> for OwnedFd
- Added `sys::eventfd` support on FreeBSD
- Added `MmapFlags::MAP_FIXED` constant in `sys::mman` for netbsd and openbsd
- Added the `SO_LISTENQLIMIT` sockopt.
- Enable the `AT_EMPTY_PATH` flag for the `fchownat()` function
- Add `AtFlags::AT_EMPTY_PATH` for FreeBSD and Hurd
- Enable `OFlag::O_DIRECTORY for Solarish
- Added the `Backlog` wrapper type for the `listen` call.
- Add `clock_nanosleep()` ([#2277](https://github.com/nix-rust/nix/pull/2277))
- Enabled `O_DIRECT` in `fcntl::OFlags` for solarish
- Added a new API sigsuspend.
- - Added `errno::Errno::set` function
- Added `errno::Errno::set_raw` function
- Added `errno::Errno::last_raw` function
- Added `errno::Errno::from_raw` function
- Enable the `AT_EMPTY_PATH` flag for the `linkat()` function
- Enable unistd::{sync, syncfs} for Android
### Changed
- `poll` now takes `PollTimeout` replacing `libc::c_int`.
- Deprecated `sys::eventfd::eventfd`.
- `mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync`, `mprotect`,
`munlock` and `mlock` updated to use `NonNull`.
- `mmap` function now accepts `F` instead of `Option<F>`
- `PollFd::new` now takes a `BorrowedFd` argument, with relaxed lifetime
requirements relative to the previous version.
- `FdSet::{insert, remove, contains}` now take `BorrowedFd` arguments, and have
relaxed lifetime requirements relative to 0.27.1.
- The following APIs now take an implementation of `AsFd` rather than a
`RawFd`:
- `unistd::tcgetpgrp`
- `unistd::tcsetpgrp`
- `unistd::fpathconf`
- `unistd::ttyname`
- `unistd::getpeereid` ([#2137](https://github.com/nix-rust/nix/pull/2137))
- Changed `openat()` and `Dir::openat()`, now take optional `dirfd`s
- The MSRV is now 1.69 ([#2144](https://github.com/nix-rust/nix/pull/2144))
- Changed function `SockaddrIn::ip()` to return `net::Ipv4Addr` and refactored
`SocketAddrV6::ip()` to be `const`
- The following APIs now take optional `dirfd`s:
- `readlinkat()`
- `fstatat()`
- `mknodat()`
- `mkdirat()`
- `execveat()`
- `Epoll::wait` now takes `EpollTimeout` replacing `isize`.
- - Deprecated `errno::errno()` function (use `Errno::last_raw()`)
- Deprecated `errno::from_i32()` function (use `Errno::from_raw()`)
- Deprecated `errno::Errno::from_i32()` function (use `Errno::from_raw()`)
### Fixed
- Fix `SigSet` incorrect implementation of `Eq`, `PartialEq` and `Hash`
- Fixed `::sys::socket::sockopt::IpMulticastTtl` by fixing the value of optlen
passed to `libc::setsockopt` and added tests.
- Fixed the function signature of `recvmmsg`, potentially causing UB
- Fix `SignalFd::set_mask`. In 0.27.0 it would actually close the file
- Fixed UnixAddr::new for haiku, it did not record the `sun_len` value as
needed.
Fixed `sys::socket::addr::from_raw_parts` and
`sys::socket::Sockaddrlike::len` build for solaris.
- Fixed solaris build globally.
- Changed the `dup3` wrapper to perform a real call to `dup3` instead of
emulating it via `dup2` and `fcntl` to get rid of race condition
- Fixed `::unistd::Group::members` using read_unaligned to avoid crash on
misaligned pointers ([#2311](https://github.com/nix-rust/nix/pull/2311))
### Removed
- The `FchownatFlags` type has been deprecated, please use `AtFlags` instead.
- Removed the `dup3` wrapper on macOS, which was emulated via `dup2` and
`fcntl` and could cause a race condition. The `dup3` system call is not
supported on macOS. ([#2268](https://github.com/nix-rust/nix/pull/2268))
- The `LinkatFlags` type has been deprecated, please use `AtFlags` instead.
## [0.27.1] - 2023-08-28
### Fixed
- Fixed generating the documentation on docs.rs.
## [0.27.0] - 2023-08-28
### Added
- Added `AT_EACCESS` to `AtFlags` on all platforms but android
- Add `PF_ROUTE` to `SockType` on macOS, iOS, all of the BSDs, Fuchsia, Haiku, Illumos.
- Added `nix::ucontext` module on `aarch64-unknown-linux-gnu`.
- Added `CanRaw` to `SockProtocol` and `CanBcm` as a separate `SocProtocol` constant.
- Added `Generic` and `NFLOG` to `SockProtocol`.
- Added `mq_timedreceive` to `::nix::mqueue`.
- Added `LocalPeerPid` to `nix::sys::socket::sockopt` for macOS. ([#1967](https://github.com/nix-rust/nix/pull/1967))
- Added `TFD_TIMER_CANCEL_ON_SET` to `::nix::sys::time::TimerSetTimeFlags` on Linux and Android.
- Added `SOF_TIMESTAMPING_OPT_ID` and `SOF_TIMESTAMPING_OPT_TSONLY` to `nix::sys::socket::TimestampingFlag`.
- Enabled socket timestamping options on Android. ([#2077](https://github.com/nix-rust/nix/pull/2077))
- Added vsock support for macOS ([#2056](https://github.com/nix-rust/nix/pull/2056))
- Added `SO_SETFIB` and `SO_USER_COOKIE` to `nix::sys::socket::sockopt` for FreeBSD.
- Added `SO_RTABLE` for OpenBSD and `SO_ACCEPTFILTER` for FreeBSD/NetBSD to `nix::sys::socket::sockopt`.
- Added `MSG_WAITFORONE` to `MsgFlags` on Android, Fuchsia, Linux, NetBSD,
FreeBSD, OpenBSD, and Solaris.
- Added `SO_TS_CLOCK` for FreeBSD to `nix::sys::socket::sockopt`.
- Added support for prctl in Linux.
- `nix::socket` and `nix::select` are now available on Redox.
- Implemented AsFd, AsRawFd, FromRawFd, and IntoRawFd for `mqueue::MqdT`.
- Add the ability to set `kevent_flags` on `SigEvent`.
### Changed
- All Cargo features have been removed from the default set. Users will need to
specify which features they depend on in their Cargo.toml.
- Implemented I/O safety for many, but not all, of Nix's APIs. Many public
functions argument and return types have changed:
| Original Type | New Type |
| ------------- | --------------------- |
| AsRawFd | AsFd |
| RawFd | BorrowedFd or OwnedFd |
- Use I/O safety with `copy_file_range`, and expose it on FreeBSD.
- The MSRV is now 1.65
- The epoll interface now uses a type.
- With I/O-safe type applied in `pty::OpenptyResult` and `pty::ForkptyResult`,
users no longer need to manually close the file descriptors in these types.
- Refactored `name` parameter of `mq_open` and `mq_unlink` to be generic over
`NixPath`.
- Made `clone` unsafe, like `fork`.
### Removed
- `sys::event::{kevent, kevent_ts}` are deprecated in favor of
`sys::kevent::Kqueue::kevent`, and `sys::event::kqueue` is deprecated in
favor of `sys::kevent::Kqueue::new`.
- Removed deprecated IoVec API.
- Removed deprecated net APIs.
- `nix::sys::signalfd::signalfd` is deprecated. Use
`nix::sys::signalfd::SignalFd` instead.
- Removed `SigEvent` support on Fuchsia, where it was unsound.
- Removed `flock` from `::nix::fcntl` on Solaris.
## [0.26.3] - 2023-08-27
### Fixed
- Fix: send `ETH_P_ALL` in htons format
- Fix: `recvmsg` now sets the length of the received `sockaddr_un` field
correctly on Linux platforms. ([#2041](https://github.com/nix-rust/nix/pull/2041))
- Fix potentially invalid conversions in
`SockaddrIn::from<std::net::SocketAddrV4>`,
`SockaddrIn6::from<std::net::SockaddrV6>`, `IpMembershipRequest::new`, and
`Ipv6MembershipRequest::new` with future Rust versions.
- Fixed an incorrect lifetime returned from `recvmsg`.
## [0.26.2] - 2023-01-18
### Fixed
- Fix `SockaddrIn6` bug that was swapping `flowinfo` and `scope_id` byte
ordering.
## [0.26.1] - 2022-11-29
### Fixed
- Fix UB with `sys::socket::sockopt::SockType` using `SOCK_PACKET`.
## [0.26.0] - 2022-11-29
### Added
- Added `SockaddrStorage::{as_unix_addr, as_unix_addr_mut}`
- Added `MntFlags` and `unmount` on all of the BSDs.
- Added `any()` and `all()` to `poll::PollFd`.
- Add `MntFlags` and `unmount` on all of the BSDs.
- Added a `Statfs::flags` method.
- Added `NSFS_MAGIC` FsType on Linux and Android.
- Added `sched_getcpu` on platforms that support it.
- Added `sched_getaffinity` and `sched_setaffinity` on FreeBSD.
- Added `line_discipline` field to `Termios` on Linux, Android and Haiku
- Expose the memfd module on FreeBSD (memfd was added in FreeBSD 13)
- Added `domainname` field of `UtsName` on Android and Linux
- Re-export `RLIM_INFINITY` from `libc`
- Added `syncfs(2)` on Linux
- Added `faccessat(2)` on illumos
- Added `eaccess()` on FreeBSD, DragonFly and Linux (glibc and musl).
- Added `IP_TOS` `SO_PRIORITY` and `IPV6_TCLASS` sockopts for Linux
- Added `new_unnamed` and `is_unnamed` for `UnixAddr` on Linux and Android.
- Added `SockProtocol::Raw` for raw sockets
- added `IP_MTU` (`IpMtu`) `IPPROTO_IP` sockopt on Linux and Android.
### Changed
- The MSRV is now 1.56.1
- The `addr` argument of `sys::mman::mmap` is now of type `Option<NonZeroUsize>`.
- The `length` argument of `sys::mman::mmap` is now of type `NonZeroUsize`.
### Fixed
- Fixed using `SockaddrStorage` to store a Unix-domain socket address on Linux.
- Fix microsecond calculation for `TimeSpec`.
- Fix `User::from_name` and `Group::from_name` panicking
when given a name containing a nul.
- Fix `User::from_uid` and `User::from_name` crash on Android platform.
- Workaround XNU bug causing netmasks returned by `getifaddrs` to misbehave.
### Removed
- Removed deprecated error constants and conversions.
## [0.25.0] - 2022-08-13
### Added
- Added `faccessat`
- Added `memfd` on Android.
- Added `ETH_P_ALL` to `SockProtocol` enum
- Added four non-standard Linux `SysconfVar` variants
- Added const constructors for `TimeSpec` and `TimeVal`
- Added `chflags`.
- Added `aio_writev` and `aio_readv`.
- impl `From<uid_t>` for `Uid` and `From<gid_t>` for `Gid`
- impl `From<SockaddrIn>` for `std::net::SocketAddrV4` and
impl `From<SockaddrIn6>` for `std::net::SocketAddrV6`.
- Added support for the `x86_64-unknown-haiku` target.
- Added `ptrace::read_user` and `ptrace::write_user` for Linux.
- Added `getrusage` and helper types `UsageWho` and `Usage`
- Added the `DontRoute` SockOpt
- Added `signal::SigSet::from_sigset_t_unchecked()`.
- Added the `Ipv4OrigDstAddr` sockopt and control message.
- Added the `Ipv6OrigDstAddr` sockopt and control message.
- Added the `Ipv4SendSrcAddr` control message.
### Changed
- Reimplemented sendmmsg/recvmmsg to avoid allocations and with better API
- Rewrote the aio module. The new module:
* Does more type checking at compile time rather than runtime.
* Gives the caller control over whether and when to `Box` an aio operation.
* Changes the type of the `priority` arguments to `i32`.
* Changes the return type of `aio_return` to `usize`.
- `nix::poll::ppoll`: `sigmask` parameter is now optional.
- Changed `gethostname` to return an owned `OsString`.
- `signal:SigSet` is now marked as `repr(transparent)`.
### Removed
- Removed support for resubmitting partially complete `lio_listio` operations.
It was too complicated, and didn't fit Nix's theme of zero-cost abstractions.
Instead, it can be reimplemented downstream.
## [0.24.2] - 2022-07-17
### Fixed
- Fixed buffer overflow in `nix::sys::socket::recvfrom`.
- Enabled `SockaddrStorage::{as_link_addr, as_link_addr_mut}` for Linux-like
operating systems.
- Fixed `SockaddrLike::from_raw` implementations for `VsockAddr` and
`SysControlAddr`.
## [0.24.1] - 2022-04-22
### Fixed
- Fixed `UnixAddr::size` on Linux-based OSes.
## [0.24.0] - 2022-04-21
### Added
- Added fine-grained features flags. Most Nix functionality can now be
conditionally enabled. By default, all features are enabled.
- Added statfs FS type magic constants for `target_os = "android"`
and synced constants with libc v0.2.121.
- Added `fexecve` on DragonFly.
- `sys::uio::IoVec` is now `Send` and `Sync`
- Added `EPOLLEXCLUSIVE` on Android.
- Added `fdatasync` for FreeBSD, Fuchsia, NetBSD, and OpenBSD.
- Added `sched_setaffinity` and `sched_getaffinity` on DragonFly.
- Added `posix_fallocate` on DragonFly.
- Added `SO_TIMESTAMPING` support
- Added getter methods to `MqAttr` struct
- Added the `TxTime` sockopt and control message.
- Added POSIX per-process timer support
- Added `sendfile` on DragonFly.
- Added `UMOUNT_NOFOLLOW`, `FUSE_SUPER_MAGIC` on Linux.
- Added `getresuid`, `setresuid`, `getresgid`, and `setresgid` on DragonFly, FreeBSD, and OpenBSD.
- Added `MAP_FIXED_NOREPLACE` on Linux.
- Added `fspacectl` on FreeBSD
- Added `accept4` on DragonFly, Emscripten, Fuchsia, Illumos, and NetBSD.
- Added `AsRawFd` implementation on `OwningIter`.
- Added `process_vm_readv` and `process_vm_writev` on Android.
- Added `nix::ucontext` module on s390x.
- Implemented `Extend`, `FromIterator`, and `IntoIterator` for `SigSet` and
added `SigSet::iter` and `SigSetIter`.
- Added `ENOTRECOVERABLE` and `EOWNERDEAD` error codes on DragonFly.
- Implemented `Read` and `Write` for `&PtyMaster`
- Added `MSG_NOSIGNAL` for Android, Dragonfly, FreeBSD, Fuchsia, Haiku, Illumos, Linux, NetBSD, OpenBSD and Solaris.
- Added `waitid`.
- Added `Ipv6DontFrag` for android, iOS, linux and macOS.
- Added `IpDontFrag` for iOS, macOS.
### Changed
- `mqueue` functions now operate on a distinct type, `nix::mqueue::MqdT`.
Accessors take this type by reference, not by value.
- Removed `SigSet::extend` in favor of `<SigSet as Extend<Signal>>::extend`.
Because of this change, you now need `use std::iter::Extend` to call `extend`
on a `SigSet`.
- Removed the the `PATH_MAX` restriction from APIs accepting paths. Paths
will now be allocated on the heap if they are too long. In addition, large
instruction count improvements (~30x) were made to path handling.
- Changed `getrlimit` and `setrlimit` to use `rlim_t` directly
instead of `Option<rlim_t>`.
- Deprecated `InetAddr` and `SockAddr` in favor of `SockaddrIn`, `SockaddrIn6`,
and `SockaddrStorage`.
- Deprecated `IpAddr`, `Ipv4Addr`, and `Ipv6Addr` in favor of their equivalents
from the standard library.
- `uname` now returns a `Result<UtsName>` instead of just a `UtsName` and
ignoring failures from libc. And getters on the `UtsName` struct now return
an `&OsStr` instead of `&str`.
- Replaced `IoVec` with `IoSlice` and `IoSliceMut`, and replaced `IoVec::from_slice` with
`IoSlice::new`. (#[1643](https://github.com/nix-rust/nix/pull/1643))
### Fixed
- `InetAddr::from_std` now sets the `sin_len`/`sin6_len` fields on the BSDs.
- Fixed a panic in `LinkAddr::addr`. That function now returns an `Option`.
### Removed
- Removed public access to the inner fields of `NetlinkAddr`, `AlgAddr`,
`SysControlAddr`, `LinkAddr`, and `VsockAddr`.
- Removed `EventFlag::EV_SYSFLAG`.
## [0.23.1] - 2021-12-16
### Changed
- Relaxed the bitflags requirement from 1.3.1 to 1.1. This partially reverts
#1492. From now on, the MSRV is not guaranteed to work with all versions of
all dependencies, just with some version of all dependencies.
### Fixed
- Fixed soundness issues in `FdSet::insert`, `FdSet::remove`, and
`FdSet::contains` involving file descriptors outside of the range
`0..FD_SETSIZE`.
## [0.23.0] - 2021-09-28
### Added
- Added the `LocalPeerCred` sockopt.
- Added `TimeSpec::from_duration` and `TimeSpec::from_timespec`
- Added `IPV6_V6ONLY` sockopt.
- Added `impl From<User> for libc::passwd` trait implementation to convert a `User`
into a `libc::passwd`. Consumes the `User` struct to give ownership over
the member pointers.
- Added `pthread_kill`.
- Added `mknodat`.
- Added `setrlimit` and `getrlimit`.
- Added `ptrace::interrupt` method for platforms that support `PTRACE_INTERRUPT`
- Added `IP6T_SO_ORIGINAL_DST` sockopt.
- Added the `PTRACE_EVENT_STOP` variant to the `sys::ptrace::Event` enum
- Exposed `SockAddr::from_raw_sockaddr`
- Added `TcpRepair`
- Enabled `pwritev` and `preadv` for more operating systems.
- Added support for `TCP_MAXSEG` TCP Maximum Segment Size socket options
- Added `Ipv4RecvErr` and `Ipv6RecvErr` sockopts and associated control messages.
- Added `AsRawFd` implementation on `PollFd`.
- Added `Ipv4Ttl` and `Ipv6Ttl` sockopts.
- Added `MAP_EXCL`, `MAP_ALIGNED_SUPER`, and `MAP_CONCEAL` mmap flags, and
exposed `MAP_ANONYMOUS` for all operating systems.
- Added read/write accessors for 'events' on `PollFd`.
### Changed
- `FdSet::{contains, highest, fds}` no longer require a mutable reference.
- `User::gecos` and corresponding `libc::passwd::pw_gecos` are supported on
64-bit Android, change conditional compilation to include the field in
64-bit Android builds
- `eventfd`s are supported on Android, change conditional compilation to
include `sys::eventfd::eventfd` and `sys::eventfd::EfdFlags`for Android
builds.
- Most enums that come from C, for example `Errno`, are now marked as
`#[non_exhaustive]`.
- Many more functions, mostly contructors, are now `const`.
- `sys::event::KEvent::filter` now returns a `Result` instead of being
infalliable. The only cases where it will now return an error are cases
where it previously would've had undefined behavior.
- Minimum supported Rust version is now 1.46.0.
- Rework `UnixAddr` to encapsulate internals better in order to fix soundness
issues. No longer allows creating a `UnixAddr` from a raw `sockaddr_un`.
- Raised bitflags to 1.3.0 and the MSRV to 1.46.0.
### Fixed
- `posix_fadvise` now returns errors in the conventional way, rather than as a
non-zero value in `Ok()`.
- Added more errno definitions for better backwards compatibility with
Nix 0.21.0.
- Fixed potential undefined behavior in `Signal::try_from` on some platforms.
- Fixed buffer overflow in `unistd::getgrouplist`.
### Removed
- Removed a couple of termios constants on redox that were never actually
supported.
- Removed `nix::sys::signal::NSIG`. It was of dubious utility, and not correct
for all platforms.
- Removed support for 32-bit Apple targets, since they've been dropped by both
Rustc and Xcode.
- Deprecated `SockAddr/InetAddr::to_str` in favor of `ToString::to_string`
- Removed `SigevNotify` on OpenBSD and Redox.
## [0.22.3] - 22 January 2022
### Changed
- Relaxed the bitflags requirement from 1.3.1 to 1.1. This partially reverts
#1492. From now on, the MSRV is not guaranteed to work with all versions of
all dependencies, just with some version of all dependencies.
## [0.22.2] - 28 September 2021
### Fixed
- Fixed buffer overflow in `unistd::getgrouplist`.
- Added more errno definitions for better backwards compatibility with
Nix 0.21.0.
## [0.22.1] - 13 August 2021
### Fixed
- Locked bitflags to < 1.3.0 to fix the build with rust < 1.46.0.
### Removed
- Removed a couple of termios constants on redox that were never actually
supported.
## [0.22.0] - 9 July 2021
### Added
- Added `if_nameindex` (#[1445](https://github.com/nix-rust/nix/pull/1445))
- Added `nmount` for FreeBSD.
- Added `IpFreebind` socket option (sockopt) on Linux, Fuchsia and Android.
- Added `TcpUserTimeout` socket option (sockopt) on Linux and Fuchsia.
- Added `renameat2` for Linux
- Added `RxqOvfl` support on Linux, Fuchsia and Android.
### Changed
- `ptsname_r` now returns a lossily-converted string in the event of bad UTF,
just like `ptsname`.
- Nix's error type is now a simple wrapper around the platform's Errno. This
means it is now `Into<std::io::Error>`. It's also `Clone`, `Copy`, `Eq`, and
has a small fixed size. It also requires less typing. For example, the old
enum variant `nix::Error::Sys(nix::errno::Errno::EINVAL)` is now simply
`nix::Error::EINVAL`.
## [0.21.2] - 29 September 2021
### Fixed
- Fixed buffer overflow in `unistd::getgrouplist`.
## [0.21.1] - 13 August 2021
### Fixed
- Locked bitflags to < 1.3.0 to fix the build with rust < 1.46.0.
### Removed
- Removed a couple of termios constants on redox that were never actually
supported.
## [0.21.0] - 31 May 2021
### Added
- Added `getresuid` and `getresgid`
- Added TIMESTAMPNS support for linux
- Added `sendfile64` (#[1439](https://github.com/nix-rust/nix/pull/1439))
- Added `MS_LAZYTIME` to `MsFlags`
### Changed
- Made `forkpty` unsafe, like `fork`
- Made `Uid`, `Gid` and `Pid` methods `from_raw` and `as_raw` a `const fn`
- Made `Uid::is_root` a `const fn`
- `AioCb` is now always pinned. Once a `libc::aiocb` gets sent to the kernel,
its address in memory must not change. Nix now enforces that by using
`std::pin`. Most users won't need to change anything, except when using
`aio_suspend`. See that method's documentation for the new usage.
- `LioCb` is now constructed using a distinct `LioCbBuilder` struct. This
avoids a soundness issue with the old `LioCb`. Usage is similar but
construction now uses the builder pattern. See the documentation for
details.
- Minimum supported Rust version is now 1.41.0.
- Errno aliases are now associated consts on `Errno`, instead of consts in the
`errno` module.
### Fixed
- Allow `sockaddr_ll` size, as reported by the Linux kernel, to be smaller then it's definition
- Fix spurious errors using `sendmmsg` with multiple cmsgs
- Added `Errno::EOPNOTSUPP` to FreeBSD, where it was missing.
### Removed
- Removed `sys::socket::accept4` from Android arm because libc removed it in
version 0.2.87.
- `AioCb::from_boxed_slice` and `AioCb::from_boxed_mut_slice` have been
removed. They were useful with earlier versions of Rust, but should no
longer be needed now that async/await are available. `AioCb`s now work
exclusively with borrowed buffers, not owned ones.
- Removed some Errno values from platforms where they aren't actually defined.
## [0.20.2] - 28 September 2021
### Fixed
- Fixed buffer overflow in `unistd::getgrouplist`.
## [0.20.1] - 13 August 2021
### Fixed
- Locked bitflags to < 1.3.0 to fix the build with rust < 1.46.0.
### Removed
- Removed a couple of termios constants on redox that were never actually
supported.
## [0.20.0] - 20 February 2021
### Added
- Added a `passwd` field to `Group` (#[1338](https://github.com/nix-rust/nix/pull/1338))
- Added `mremap` (#[1306](https://github.com/nix-rust/nix/pull/1306))
- Added `personality` (#[1331](https://github.com/nix-rust/nix/pull/1331))
- Added limited Fuchsia support (#[1285](https://github.com/nix-rust/nix/pull/1285))
- Added `getpeereid` (#[1342](https://github.com/nix-rust/nix/pull/1342))
- Implemented `IntoIterator` for `Dir`
### Changed
- Minimum supported Rust version is now 1.40.0.
- i686-apple-darwin has been demoted to Tier 2 support, because it's deprecated
by Xcode.
- Fixed calling `recvfrom` on an `AddrFamily::Packet` socket
### Fixed
- `TimerFd` now closes the underlying fd on drop.
- Define `*_MAGIC` filesystem constants on Linux s390x
- mqueue, sysinfo, timespec, statfs, test_ptrace_syscall() on x32
### Removed
- `Dir`, `SignalFd`, and `PtyMaster` are no longer `Clone`.
- Removed `SockLevel`, which hasn't been used for a few years
- Removed both `Copy` and `Clone` from `TimerFd`.
## [0.19.1] - 28 November 2020
### Fixed
- Fixed bugs in `recvmmsg`.
## [0.19.0] - 6 October 2020
### Added
- Added Netlink protocol families to the `SockProtocol` enum
- Added `clock_gettime`, `clock_settime`, `clock_getres`,
`clock_getcpuclockid` functions and `ClockId` struct.
- Added wrapper functions for `PTRACE_SYSEMU` and `PTRACE_SYSEMU_SINGLESTEP`.
- Add support for Vsock on Android rather than just Linux.
- Added `TCP_KEEPCNT` and `TCP_KEEPINTVL` TCP keepalive options.
### Changed
- Expose `SeekData` and `SeekHole` on all Linux targets
- Changed unistd::{execv,execve,execvp,execvpe,fexecve,execveat} to take both `&[&CStr]` and `&[CString]` as its list argument(s).
- Made `unistd::fork` an unsafe funtion, bringing it in line with [libstd's decision](https://github.com/rust-lang/rust/pull/58059).
## [0.18.0] - 26 July 2020
### Added
- Added `fchown(2)` wrapper.
- Added support on linux systems for `MAP_HUGE_`_`SIZE`_ family of flags.
- Added support for `F_OFD_*` `fcntl` commands on Linux and Android.
- Added `env::clearenv()`: calls `libc::clearenv` on platforms
where it's available, and clears the environment of all variables
via `std::env::vars` and `std::env::remove_var` on others.
- `FsType` inner value made public.
- Added `unistd::setfsuid` and `unistd::setfsgid` to set the user or group
identity for filesystem checks per-thread.
- Derived `Ord`, `PartialOrd` for `unistd::Pid` (#[1189](https://github.com/nix-rust/nix/pull/1189))
- Added `select::FdSet::fds` method to iterate over file descriptors in a set.
- Added support for UDP generic segmentation offload (GSO) and generic
receive offload (GRO) ([#1209](https://github.com/nix-rust/nix/pull/1209))
- Added support for `sendmmsg` and `recvmmsg` calls
- Added support for `SCM_CREDS` messages (`UnixCredentials`) on FreeBSD/DragonFly
- Added `BindToDevice` socket option (sockopt) on Linux
- Added `EventFilter` bitflags for `EV_DISPATCH` and `EV_RECEIPT` on OpenBSD.
- Added support for `Ipv4PacketInfo` and `Ipv6PacketInfo` to `ControlMessage`.
- `CpuSet` and `UnixCredentials` now implement `Default`.
- Added `unistd::ttyname`
- Added support for `Ipv4PacketInfo` and `Ipv6PacketInfo` to `ControlMessage` for iOS and Android.
- Added support for `TimerFd`.
### Changed
- Changed `fallocate` return type from `c_int` to `()` (#[1201](https://github.com/nix-rust/nix/pull/1201))
- Enabled `sys::ptrace::setregs` and `sys::ptrace::getregs` on x86_64-unknown-linux-musl target
- On Linux, `ptrace::write` is now an `unsafe` function. Caveat programmer.
- `execv`, `execve`, `execvp` and `execveat` in `::nix::unistd` and `reboot` in
`::nix::sys::reboot` now return `Result<Infallible>` instead of `Result<Void>` (#[1239](https://github.com/nix-rust/nix/pull/1239))
- `sys::socket::sockaddr_storage_to_addr` is no longer `unsafe`. So is
`offset_of!`.
- `sys::socket::sockaddr_storage_to_addr`, `offset_of!`, and `Errno::clear` are
no longer `unsafe`.
- `SockAddr::as_ffi_pair`,`sys::socket::sockaddr_storage_to_addr`, `offset_of!`,
and `Errno::clear` are no longer `unsafe`.
- Several `Inotify` methods now take `self` by value instead of by reference
- `nix::poll::ppoll`: `timeout` parameter is now optional, None is equivalent for infinite timeout.
### Fixed
- Fixed `getsockopt`. The old code produced UB which triggers a panic with
Rust 1.44.0.
- Fixed a bug in nix::unistd that would result in an infinite loop
when a group or user lookup required a buffer larger than
- Fixed unaligned casting of `cmsg_data` to `af_alg_iv` (#[1206](https://github.com/nix-rust/nix/pull/1206))
- Fixed `readlink`/`readlinkat` when reading symlinks longer than `PATH_MAX` (#[1231](https://github.com/nix-rust/nix/pull/1231))
- `PollFd`, `EpollEvent`, `IpMembershipRequest`, `Ipv6MembershipRequest`,
`TimeVal`, and `IoVec` are now `repr(transparent)`. This is required for
correctness's sake across all architectures and compilers, though now bugs
have been reported so far.
- Fixed unaligned pointer read in `Inotify::read_events`.
### Removed
- Removed `sys::socket::addr::from_libc_sockaddr` from the public API.
- Removed `sys::termios::{get_libc_termios, get_libc_termios_mut, update_wrapper`
from the public API. These were previously hidden in the docs but still usable
by downstream.
- Nix no longer implements `NixPath` for `Option<P> where P: NixPath`. 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.
- Removed `unistd::daemon` and `unistd::pipe2` on OSX and ios
- Removed `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` and
`sys::event::FilterFlag::NOTE_REAP` on OSX and ios.
- Removed `sys::ptrace::ptrace` on Android and Linux.
- Dropped support for powerpc64-unknown-linux-gnu
## [0.17.0] - 3 February 2020
### Added
- Add `CLK_TCK` to `SysconfVar`
### Removed
- Removed deprecated Error::description from error types
## [0.16.1] - 23 December 2019
### Fixed
- Fixed the build for OpenBSD
## [0.16.0] - 1 December 2019
### Added
- Added `ptrace::seize()`: similar to `attach()` on Linux
but with better-defined semantics.
- Added `Signal::as_str()`: returns signal name as `&'static str`
- Added `posix_fallocate`.
- Implemented `Default` for `FdSet`
- Added `NixPath::is_empty`.
- Added `mkfifoat`
- Added `User::from_uid`, `User::from_name`, `User::from_gid` and
`Group::from_name`,
- Added `linkat`
- Added `sched_getaffinity`.
- Added optional `Signal` argument to `ptrace::{detach, syscall}` for signal
### Changed
- `sys::termios::BaudRate` now implements `TryFrom<speed_t>` instead of
`From<speed_t>`. The old `From` implementation would panic on failure.
- `sys::socket::ControlMessage::ScmCredentials` and
`sys::socket::ControlMessageOwned::ScmCredentials` now wrap `UnixCredentials`
rather than `libc::ucred`.
- `sys::socket::recvmsg` now takes a plain `Vec` instead of a `CmsgBuffer`
implementor. If you were already using `cmsg_space!`, then you needn't worry.
- `sys::socket::recvfrom` now returns
`Result<(usize, Option<SockAddr>)>` instead of `Result<(usize, SockAddr)>`.
- `Signal::from_c_int` has been replaced by `Signal::try_from`
- Changed `readlink` and `readlinkat` to return `OsString`
```rust
# use nix::fcntl::{readlink, readlinkat};
// the buffer argument of `readlink` and `readlinkat` has been removed,
// and the return value is now an owned type (`OsString`).
// Existing code can be updated by removing the buffer argument
// and removing any clone or similar operation on the output
// old code `readlink(&path, &mut buf)` can be replaced with the following
let _: OsString = readlink(&path);
// old code `readlinkat(dirfd, &path, &mut buf)` can be replaced with the following
let _: OsString = readlinkat(dirfd, &path);
```
- Minimum supported Rust version is now 1.36.0.
- `Ipv4Addr::octets`, `Ipv4Addr::to_std`, `Error::as_errno`,
`ForkResult::is_child`, `ForkResult::is_parent`, `Gid::as_raw`,
`Uid::is_root`, `Uid::as_raw`, `Pid::as_raw`, and `PollFd::revents` now take
`self` by value.
- Type `&CString` for parameters of `exec(v|ve|vp|vpe|veat)` are changed to `&CStr`.
### Fixed
- Fix length of abstract socket addresses
- Fix initialization of msghdr in recvmsg/sendmsg when built with musl
### Removed
- Remove the deprecated `CmsgSpace`.
## [0.15.0] - 10 August 2019
### Added
- Added `MSG_WAITALL` to `MsgFlags` in `sys::socket`.
- Implemented `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, and `PartialEq` for most
types that support them. ([#1035](https://github.com/nix-rust/nix/pull/1035))
- Added `copy_file_range` wrapper
- Add `mkdirat`.
- Add `posix_fadvise`.
- Added `AF_VSOCK` to `AddressFamily`.
- Add `unlinkat`
- Add `renameat`.
### Changed
- Support for `ifaddrs` now present when building for Android.
- Minimum supported Rust version is now 1.31.0
- Now functions `statfs()` and `fstatfs()` return result with `Statfs` wrapper
### Fixed
- Enabled `sched_yield` for all nix hosts.
## [0.14.1] - 2019-06-06
### Added
- Macros exported by `nix` may now be imported via `use` on the Rust 2018
edition without importing helper macros on Linux targets.
For example, in Rust 2018, the `ioctl_read_bad!` macro can now be imported
without importing the `convert_ioctl_res!` macro.
```rust
use nix::ioctl_read_bad;
ioctl_read_bad!(tcgets, libc::TCGETS, libc::termios);
```
### Changed
- Changed some public types from reexports of libc types like `uint32_t` to the
native equivalents like `u32.`
### Fixed
- Fix the build on Android and Linux/mips with recent versions of libc.
## [0.14.0] - 2019-05-21
### Added
- Add IP_RECVIF & IP_RECVDSTADDR. Enable IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
- Added `inotify_init1`, `inotify_add_watch` and `inotify_rm_watch` wrappers for
Android and Linux. ([#1016](https://github.com/nix-rust/nix/pull/1016))
- Add `ALG_SET_IV`, `ALG_SET_OP` and `ALG_SET_AEAD_ASSOCLEN` control messages and `AF_ALG`
socket types on Linux and Android ([#1031](https://github.com/nix-rust/nix/pull/1031))
- Add killpg
- Added ENOTSUP errno support for Linux and Android.
- Add several errno constants from OpenBSD 6.2
- Added `from_std` and `to_std` methods for `sys::socket::IpAddr`
- Added `nix::unistd:seteuid` and `nix::unistd::setegid` for those platforms that do
not support `setresuid` nor `setresgid` respectively.
- Added a `access` wrapper
- Add `forkpty`
- Add `sched_yield`
### Changed
- `PollFd` event flags renamed to `PollFlags` ([#1024](https://github.com/nix-rust/nix/pull/1024/))
- `recvmsg` now returns an Iterator over `ControlMessageOwned` objects rather
than `ControlMessage` objects. This is sadly not backwards-compatible. Fix
code like this:
```rust
if let ControlMessage::ScmRights(&fds) = cmsg {
```
By replacing it with code like this:
```rust
if let ControlMessageOwned::ScmRights(fds) = cmsg {
```
- Replaced `CmsgSpace` with the `cmsg_space` macro.
### Fixed
- Fixed multiple bugs when using `sendmsg` and `recvmsg` with ancillary control messages
- Macros exported by `nix` may now be imported via `use` on the Rust 2018
edition without importing helper macros for BSD targets.
For example, in Rust 2018, the `ioctl_read_bad!` macro can now be imported
without importing the `convert_ioctl_res!` macro.
```rust
use nix::ioctl_read_bad;
ioctl_read_bad!(tcgets, libc::TCGETS, libc::termios);
```
### Removed
- `Daemon`, `NOTE_REAP`, and `NOTE_EXIT_REPARENTED` are now deprecated on OSX
and iOS.
- `PTRACE_GETREGS`, `PTRACE_SETREGS`, `PTRACE_GETFPREGS`, and
`PTRACE_SETFPREGS` have been removed from some platforms where they never
should've been defined in the first place.
## [0.13.1] - 2019-06-10
### Changed
- Changed some public types from reexports of libc types like `uint32_t` to the
native equivalents like `u32.`
### Fixed
- Fix the build on Android and Linux/mips with recent versions of libc.
- Fixed build on Linux/arm and Linux/s390x with the latest Rust libc
### Removed
- `Daemon`, `NOTE_REAP`, and `NOTE_EXIT_REPARENTED` are now deprecated on OSX
and iOS.
## [0.13.0] - 2019-01-15
### Added
- Added PKTINFO(V4) & V6PKTINFO cmsg support - Android/FreeBSD/iOS/Linux/MacOS.
- Added support of CString type in `setsockopt`.
- Added option `TCP_CONGESTION` in `setsockopt`.
- Added `symlinkat` wrapper.
- Added `ptrace::{getregs, setregs}`.
- Added `nix::sys::signal::signal`.
- Added an `mprotect` wrapper.
### Fixed
- `lutimes` never worked on OpenBSD as it is not implemented on OpenBSD. It has
- `fexecve` never worked on NetBSD or on OpenBSD as it is not implemented on
either OS. It has been removed. ([#1000](https://github.com/nix-rust/nix/pull/1000))
## [0.12.1] 2019-06-08
### Changed
- Changed some public types from reexports of libc types like `uint32_t` to the
native equivalents like `u32.`
### Fixed
- Fix the build on Android and Linux/mips with recent versions of libc.
- Fixed build on Linux/arm and Linux/s390x with the latest Rust libc
### Removed
- `fexecve` never worked on NetBSD or on OpenBSD as it is not implemented on
either OS. It has been removed. ([#1000](https://github.com/nix-rust/nix/pull/1000))
- `Daemon`, `NOTE_REAP`, and `NOTE_EXIT_REPARENTED` are now deprecated on OSX
and iOS.
## [0.12.0] 2018-11-28
### Added
- Added `FromStr` and `Display` impls for `nix::sys::Signal`
- Added a `sync` wrapper.
- Added a `sysinfo` wrapper.
- Support the `SO_PEERCRED` socket option and the `UnixCredentials` type on all Linux and Android targets.
- Added support for `SCM_CREDENTIALS`, allowing to send process credentials over Unix sockets.
- Added a `dir` module for reading directories (wraps `fdopendir`, `readdir`, and `rewinddir`).
- Added `kmod` module that allows loading and unloading kernel modules on Linux.
- Added `futimens` and `utimesat` wrappers ([#944](https://github.com/nix-rust/nix/pull/944)),
an `lutimes` wrapper ([#967](https://github.com/nix-rust/nix/pull/967)),
and a `utimes` wrapper ([#946](https://github.com/nix-rust/nix/pull/946)).
- Added `AF_UNSPEC` wrapper to `AddressFamily` ([#948](https://github.com/nix-rust/nix/pull/948))
- Added the `mode_t` public alias within `sys::stat`.
- Added a `truncate` wrapper.
- Added a `fchownat` wrapper.
- Added support for `ptrace` on BSD operating systems ([#949](https://github.com/nix-rust/nix/pull/949))
- Added `ptrace` functions for reads and writes to tracee memory and ptrace kill
- Added a `acct` wrapper module for enabling and disabling process accounting
- Added the `time_t` and `suseconds_t` public aliases within `sys::time`.
- Added `unistd::execvpe` for Haiku, Linux and OpenBSD
- Added `Error::as_errno`.
### Changed
- Increased required Rust version to 1.24.1
### Fixed
- Made `preadv` take immutable slice of IoVec.
- Fixed passing multiple file descriptors over Unix Sockets.
## [0.11.1] 2019-06-06
### Changed
- Changed some public types from reexports of libc types like `uint32_t` to the
native equivalents like `u32.`
### Fixed
- Fix the build on Android and Linux/mips with recent versions of libc.
- Fixed build on Linux/arm and Linux/s390x with the latest Rust libc
### Removed
- `fexecve` never worked on NetBSD or on OpenBSD as it is not implemented on
either OS. It has been removed. ([#1000](https://github.com/nix-rust/nix/pull/1000))
- `Daemon`, `NOTE_REAP`, and `NOTE_EXIT_REPARENTED` are now deprecated on OSX
and iOS.
## [0.11.0] 2018-06-01
### Added
- Added `sendfile` on FreeBSD and Darwin.
- Added `pselect`
- Exposed `preadv` and `pwritev` on the BSDs.
- Added `mlockall` and `munlockall`
- Added `SO_MARK` on Linux.
- Added safe support for nearly any buffer type in the `sys::aio` module.
- Added `sys::aio::LioCb` as a wrapper for `libc::lio_listio`.
- Added `unistd::getsid`
- Added `alarm`. ([#830](https://github.com/nix-rust/nix/pull/830))
- Added interface flags `IFF_NO_PI, IFF_TUN, IFF_TAP` on linux-like systems.
- Added `statvfs` module to all MacOS and Linux architectures.
- Added `EVFILT_EMPTY`, `EVFILT_PROCDESC`, and `EVFILT_SENDFILE` on FreeBSD.
- Exposed `termios::cfmakesane` on FreeBSD.
- Exposed `MSG_CMSG_CLOEXEC` on *BSD.
- Added `fchmod`, `fchmodat`.
- Added `request_code_write_int!` on FreeBSD/DragonFlyBSD
### Changed
- `Display` and `Debug` for `SysControlAddr` now includes all fields.
- `ioctl!` has been replaced with a family of `ioctl_*!` macros.
- `io!`, `ior!`, `iow!`, and `iorw!` has been renamed to `request_code_none!`, `request_code_read!`,
`request_code_write!`, and `request_code_readwrite!` respectively. These have also now been exposed
in the documentation.
- Enabled more `ptrace::Request` definitions for uncommon Linux platforms
- Emulation of `FD_CLOEXEC` and `O_NONBLOCK` was removed from `socket()`, `accept4()`, and
`socketpair()`.
### Fixed
- Fixed possible panics when using `SigAction::flags` on Linux
- Properly exposed 460800 and 921600 baud rates on NetBSD
- Fixed `ioctl_write_int!` on FreeBSD/DragonFlyBSD
- `ioctl_write_int!` now properly supports passing a `c_ulong` as the parameter on Linux non-musl targets
### Removed
- Removed explicit support for the `bytes` crate from the `sys::aio` module.
See `sys::aio::AioCb::from_boxed_slice` examples for alternatives.
- Removed `sys::aio::lio_listio`. Use `sys::aio::LioCb::listio` instead.
- Removed emulated `accept4()` from macos, ios, and netbsd targets
- Removed `IFF_NOTRAILERS` on OpenBSD, as it has been removed in OpenBSD 6.3
## [0.10.0] 2018-01-26
### Added
- Added specialized wrapper: `sys::ptrace::step`
- Added `AioCb::from_ptr` and `AioCb::from_mut_ptr`
- Added specialized wrappers: `sys::ptrace::{traceme, syscall, cont, attach}`. Using the matching routines
with `sys::ptrace::ptrace` is now deprecated.
- Added `nix::poll` module for all platforms
- Added `nix::ppoll` function for FreeBSD and DragonFly
- Added protocol families in `AddressFamily` enum.
- Added the `pid()` method to `WaitStatus` for extracting the PID.
- Added `nix::unistd:fexecve`.
- Expose `uname()` on all platforms.
- Expose `signalfd` module on Android as well.
- Added `nix::sys::ptrace::detach`.
- Added timestamp socket control message variant:
`nix::sys::socket::ControlMessage::ScmTimestamp`
- Added socket option variant that enables the timestamp socket
control message: `nix::sys::socket::sockopt::ReceiveTimestamp`
- Added more accessor methods for `AioCb`
- Add `nix::sys::fallocate`
([#768](https:://github.com/nix-rust/nix/pull/768))
- Added `nix::unistd::mkfifo`.
- Added `ptrace::Options::PTRACE_O_EXITKILL` on Linux and Android.
- Added `nix::sys::uio::{process_vm_readv, process_vm_writev}` on Linux
- Added `nix::unistd::{getgroups, setgroups, getgrouplist, initgroups}`. ([#733](https://github.com/nix-rust/nix/pull/733))
- Added `nix::sys::socket::UnixAddr::as_abstract` on Linux and Android.
- Added `nix::unistd::execveat` on Linux and Android.
- Added the `from_raw()` method to `WaitStatus` for converting raw status values
to `WaitStatus` independent of syscalls.
- Added more standard trait implementations for various types.
- Added `sigprocmask` to the signal module.
- Added `nix::sys::socket::LinkAddr` on Linux and all bsdlike system.
- Add socket options for `IP_TRANSPARENT` / `BIND_ANY`.
### Changed
- Exposed the `mqueue` module for all supported operating systems.
- Use native `pipe2` on all BSD targets. Users should notice no difference.
- Renamed existing `ptrace` wrappers to encourage namespacing ([#692](https://github.com/nix-rust/nix/pull/692))
- Marked `sys::ptrace::ptrace` as `unsafe`.
- Changed function signature of `socket()` and `socketpair()`. The `protocol` argument
has changed type from `c_int` to `SockProtocol`.
It accepts a `None` value for default protocol that was specified with zero using `c_int`.
- Made `select` easier to use, adding the ability to automatically calculate the `nfds` parameter using the new
`FdSet::highest` ([#701](https://github.com/nix-rust/nix/pull/701))
- Exposed `unistd::setresuid` and `unistd::setresgid` on FreeBSD and OpenBSD
- Refactored the `statvfs` module removing extraneous API functions and the
`statvfs::vfs` module. Additionally `(f)statvfs()` now return the struct
directly. And the returned `Statvfs` struct now exposes its data through
accessor methods. ([#729](https://github.com/nix-rust/nix/pull/729))
- The `addr` argument to `madvise` and `msync` is now `*mut` to better match the
- `shm_open` and `shm_unlink` are no longer exposed on Android targets, where
they are not officially supported. ([#731](https://github.com/nix-rust/nix/pull/731))
- `MapFlags`, `MmapAdvise`, and `MsFlags` expose some more variants and only
officially-supported variants are provided for each target.
- Marked `pty::ptsname` function as `unsafe`
- Moved constants ptrace request, event and options to enums and updated ptrace functions and argument types accordingly.
- `AioCb::Drop` will now panic if the `AioCb` is still in-progress ([#715](https://github.com/nix-rust/nix/pull/715))
- Restricted `nix::sys::socket::UnixAddr::new_abstract` to Linux and Android only.
- The `ucred` struct has been removed in favor of a `UserCredentials` struct that
contains only getters for its fields.
- Both `ip_mreq` and `ipv6_mreq` have been replaced with `IpMembershipRequest` and
`Ipv6MembershipRequest`.
- Removed return type from `pause`.
- Changed the termios APIs to allow for using a `u32` instead of the `BaudRate`
enum on BSD platforms to support arbitrary baud rates. See the module docs for
`nix::sys::termios` for more details.
### Fixed
- Fix compilation and tests for OpenBSD targets
- Fixed error handling in `AioCb::fsync`, `AioCb::read`, and `AioCb::write`.
It is no longer an error to drop an `AioCb` that failed to enqueue in the OS.
- Fix potential memory corruption on non-Linux platforms when using
`sendmsg`/`recvmsg`, caused by mismatched `msghdr` definition.
### Removed
- `AioCb::from_boxed_slice` has been removed. It was never actually safe. Use
`from_bytes` or `from_bytes_mut` instead.
- The syscall module has been removed. This only exposed enough functionality for
`memfd_create()` and `pivot_root()`, which are still exposed as separate functions.
- The `Errno` variants are no longer reexported from the `errno` module. `Errno` itself is no longer reexported from the
crate root and instead must be accessed using the `errno` module. ([#696](https://github.com/nix-rust/nix/pull/696))
- Removed `MS_VERBOSE`, `MS_NOSEC`, and `MS_BORN` from `MsFlags`. These
are internal kernel flags and should never have been exposed.
## [0.9.0] 2017-07-23
### Added
- Added `sysconf`, `pathconf`, and `fpathconf`
- Added `sys::signal::SigAction::{ flags, mask, handler}`
- Added `nix::sys::pthread::pthread_self`
- Added `AioCb::from_boxed_slice`
- Added `nix::unistd::{openat, fstatat, readlink, readlinkat}`
- Added `nix::pty::{grantpt, posix_openpt, ptsname/ptsname_r, unlockpt}`
- Added `nix::ptr::openpty`
- Added `nix::ptrace::{ptrace_get_data, ptrace_getsiginfo, ptrace_setsiginfo
and nix::Error::UnsupportedOperation}`
- Added `cfmakeraw`, `cfsetspeed`, and `tcgetsid`. ([#527](https://github.com/nix-rust/nix/pull/527))
- Added "bad none", "bad write_ptr", "bad write_int", and "bad readwrite" variants to the `ioctl!`
- On Linux and Android, added support for receiving `PTRACE_O_TRACESYSGOOD`
events from `wait` and `waitpid` using `WaitStatus::PtraceSyscall`
### Changed
- The `ioctl!` macro and its variants now allow the generated functions to have
- Changed `ioctl!(write ...)` into `ioctl!(write_ptr ...)` and `ioctl!(write_int ..)` variants
to more clearly separate those use cases. ([#670](https://github.com/nix-rust/nix/pull/670))
- Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe.
- Minimum supported Rust version is now 1.13.
- Removed `revents` argument from `PollFd::new()` as it's an output argument and
will be overwritten regardless of value.
- Changed type signature of `sys::select::FdSet::contains` to make `self`
- Introduced wrapper types for `gid_t`, `pid_t`, and `uid_t` as `Gid`, `Pid`, and `Uid`
respectively. Various functions have been changed to use these new types as
- Fixed compilation on all Android and iOS targets ([#527](https://github.com/nix-rust/nix/pull/527))
and promoted them to Tier 2 support.
- `nix::sys::statfs::{statfs,fstatfs}` uses statfs definition from `libc::statfs` instead of own linux specific type `nix::sys::Statfs`.
Also file system type constants like `nix::sys::statfs::ADFS_SUPER_MAGIC` were removed in favor of the libc equivalent.
- Revised the termios API including additional tests and documentation and exposed it on iOS. ([#527](https://github.com/nix-rust/nix/pull/527))
- `eventfd`, `signalfd`, and `pwritev`/`preadv` functionality is now included by default for all
supported platforms. ([#681](https://github.com/nix-rust/nix/pull/561))
- The `ioctl!` macro's plain variants has been replaced with "bad read" to be consistent with
other variants. The generated functions also have more strict types for their arguments. The
"*_buf" variants also now calculate total array size and take slice references for improved type
safety. The documentation has also been dramatically improved.
### Removed
- Removed `io::Error` from `nix::Error` and the conversion from `nix::Error` to `Errno`
- All feature flags have been removed in favor of conditional compilation on supported platforms.
`execvpe` is no longer supported, but this was already broken and will be added back in the next
- Removed `ioc_*` functions and many helper constants and macros within the `ioctl` module. These
should always have been private and only the `ioctl!` should be used in public code.
### Fixed
- Fixed multiple issues compiling under different archetectures and OSes.
Now compiles on Linux/MIPS ([#538](https://github.com/nix-rust/nix/pull/538)),
`MacOS/x86_64,i686` ([#553](https://github.com/nix-rust/nix/pull/553)),
`NetBSD/x64_64` ([#538](https://github.com/nix-rust/nix/pull/538)),
`FreeBSD/x86_64,i686` ([#536](https://github.com/nix-rust/nix/pull/536)), and
- `bind` and `errno_location` now work correctly on `Android`
- Added `nix::ptrace` on all Linux-kernel-based platforms
[#624](https://github.com/nix-rust/nix/pull/624). Previously it was
only available on x86, x86-64, and ARM, and also not on Android.
- Fixed `sys::socket::sendmsg` with zero entry `cmsgs` parameter.
- Multiple constants related to the termios API have now been properly defined for
all supported platforms. ([#527](https://github.com/nix-rust/nix/pull/527))
- `ioctl!` macro now supports working with non-int datatypes and properly supports all platforms.
## [0.8.1] 2017-04-16
### Fixed
- Fixed build on FreeBSD. (Cherry-picked
## [0.8.0] 2017-03-02
### Added
- Added `::nix::sys::termios::BaudRate` enum to provide portable baudrate
- Added a new `WaitStatus::PtraceEvent` to support ptrace events on Linux
- Added support for POSIX AIO
- Added support for XNU system control sockets
- Added support for `ioctl` calls on BSD platforms
- Added struct `TimeSpec`
- Added complete definitions for all kqueue-related constants on all supported
OSes
- Added function `epoll_create1` and bitflags `EpollCreateFlags` in
`::nix::sys::epoll` in order to support `::libc::epoll_create1`.
- Added `setresuid` and `setresgid` for Linux in `::nix::unistd`
- Added `getpgid` in `::nix::unistd`
- Added `tcgetpgrp` and `tcsetpgrp` in `::nix::unistd`
- Added `CLONE_NEWCGROUP` in `::nix::sched`
- Added `getpgrp` in `::nix::unistd`
- Added `fchdir` in `::nix::unistd`
- Added `major` and `minor` in `::nix::sys::stat` for decomposing `dev_t`
- Fixed the style of many bitflags and use `libc` in more places.
- Added `ppoll` in `::nix::poll`
- Added support for getting and setting pipe size with fcntl(2) on Linux
### Changed
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`
switched to use `BaudRate` enum from `speed_t`.
- `epoll_ctl` now could accept None as argument `event`
when op is `EpollOp::EpollCtlDel`.
- Removed the `bad` keyword from the `ioctl!` macro
- Changed `TimeVal` into an opaque Newtype
- `kill`'s signature, defined in `::nix::sys::signal`, changed, so that the
signal parameter has type `T: Into<Option<Signal>>`. `None` as an argument
for that parameter will result in a 0 passed to libc's `kill`, while a
`Some`-argument will result in the previous behavior for the contained
`Signal`.
- The minimum supported version of rustc is now 1.7.0.
- Changed `KEvent` to an opaque structure that may only be modified by its
constructor and the `ev_set` method.
- `pipe2` now calls `libc::pipe2` where available. Previously it was emulated
using `pipe`, which meant that setting `O_CLOEXEC` was not atomic.
- Renamed `EpollEventKind` to `EpollFlags` in `::nix::sys::epoll` in order for
it to conform with our conventions.
- `EpollEvent` in `::nix::sys::epoll` is now an opaque proxy for
`::libc::epoll_event`. The formerly public field `events` is now be read-only
accessible with the new method `events()` of `EpollEvent`. Instances of
`EpollEvent` can be constructed using the new method `new()` of EpollEvent.
- `SigFlags` in `::nix::sys::signal` has be renamed to `SigmaskHow` and its type
has changed from `bitflags` to `enum` in order to conform to our conventions.
- `sethostname` now takes a `&str` instead of a `&[u8]` as this provides an API
that makes more sense in normal, correct usage of the API.
- `gethostname` previously did not expose the actual length of the hostname
written from the underlying system call at all. This has been updated to
return a `&CStr` within the provided buffer that is always properly
NUL-terminated (this is not guaranteed by the call with all platforms/libc
implementations).
- Exposed all fcntl(2) operations at the module level, so they can be
imported direclty instead of via `FcntlArg` enum.
### Fixed
- Fixed multiple issues with Unix domain sockets on non-Linux OSes
- Fixed using kqueue with `EVFILT_USER` on FreeBSD
- Fixed the build on FreeBSD, and fixed the getsockopt, sendmsg, and recvmsg
functions on that same OS.
- Fixed an off-by-one bug in `UnixAddr::new_abstract` in `::nix::sys::socket`.
- Fixed clone passing a potentially unaligned stack.
- Fixed mkdev not creating a `dev_t` the same way as libc.
## [0.7.0] 2016-09-09
### Added
- Added `lseek` and `lseek64` in `::nix::unistd`
- Added `mkdir` and `getcwd` in `::nix::unistd`
- Added accessors `sigmask_mut` and `sigmask` to `UContext` in
`::nix::ucontext`.
- Added `WUNTRACED` to `WaitPidFlag` in `::nix::sys::wait` for non-_linux_
targets.
- Added new module `::nix::sys::reboot` with enumeration `RebootMode` and
functions `reboot` and `set_cad_enabled`. Currently for _linux_ only.
- `FdSet` in `::nix::sys::select` now also implements `Clone`.
- Added `F_FULLFSYNC` to `FcntlArg` in `::nix::fcntl` for _apple_ targets.
- Added `CpuSet::unset` in `::nix::sched`.
- Added constructor method `new()` to `PollFd` in `::nix::poll`, in order to
allow creation of objects, after removing public access to members.
- Added method `revents()` to `PollFd` in `::nix::poll`, in order to provide
read access to formerly public member `revents`.
- Added `MSG_CMSG_CLOEXEC` to `MsgFlags` in `::nix::sys::socket` for _linux_ only.
### Changed
- Replaced the reexported integer constants for signals by the enumeration
`Signal` in `::nix::sys::signal`.
- Renamed `EventFdFlag` to `EfdFlags` in `::nix::sys::eventfd`.
- Changed the result types of `CpuSet::is_set` and `CpuSet::set` in
`::nix::sched` to `Result<bool>` and `Result<()>`, respectively. They now
return `EINVAL`, if an invalid argument for the `field` parameter is passed.
- `MqAttr` in `::nix::mqueue` is now an opaque proxy for `::libc::mq_attr`,
which has the same structure as the old `MqAttr`. The field `mq_flags` of
`::libc::mq_attr` is readable using the new method `flags()` of `MqAttr`.
`MqAttr` also no longer implements `Debug`.
- The parameter `msq_prio` of `mq_receive` with type `u32` in `::nix::mqueue`
was replaced by a parameter named `msg_prio` with type `&mut u32`, so that
the message priority can be obtained by the caller.
- The type alias `MQd` in `::nix::queue` was replaced by the type alias
`libc::mqd_t`, both of which are aliases for the same type.
### Removed
- Type alias `SigNum` from `::nix::sys::signal`.
- Type alias `CpuMask` from `::nix::shed`.
- Removed public fields from `PollFd` in `::nix::poll`. (See also added method
`revents()`.
### Fixed
- Fixed the build problem for NetBSD (Note, that we currently do not support
it, so it might already be broken again).
- Fixed the build on FreeBSD, and fixed the getsockopt, sendmsg, and recvmsg
functions on that same OS.
## [0.6.0] 2016-06-10
### Added
- Added `gettid` in `::nix::unistd` for _linux_ and _android_.
- Some _mips_ support in `::nix::sched` and `::nix::sys::syscall`.
- Added `SIGNALFD_SIGINFO_SIZE` in `::nix::sys::signalfd`.
- Added new module `::nix::ucontext` with struct `UContext`. Currently for
_linux_ only.
- Added `EPOLLEXCLUSIVE` to `EpollEventKind` in `::nix::sys::epoll`.
- Added `pause` to `::nix::unistd`.
- Added `sleep` to `::nix::unistd`.
- Added `S_IFDIR`, `S_IFLNK`, `S_IFMT` to `SFlag` in `::nix::sys::stat`.
- Added `clear` and `extend` functions to `SigSet`'s implementation in
`::nix::sys::signal`.
- `sockaddr_storage_to_addr` in `::nix::sys::socket` now supports `sockaddr_nl`
on _linux_ and _android_.
- Added support for `SO_ORIGINAL_DST` in `::nix::sys::socket` on _linux_.
- Added `SIGINFO` in `::nix::sys::signal` for the _macos_ target as well as
`SIGPWR` and `SIGSTKFLT` in `::nix::sys::signal` for non-_macos_ targets.
### Changed
- Changed the structure `IoVec` in `::nix::sys::uio`.
- Replaced `CREATE_NEW_FD` by `SIGNALFD_NEW` in `::nix::sys::signalfd`.
- Renamed `SaFlag` to `SaFlags` and `SigFlag` to `SigFlags` in
`::nix::sys::signal`.
- Renamed `Fork` to `ForkResult` and changed its fields in `::nix::unistd`.
- Added the `signal` parameter to `clone`'s signature in `::nix::sched`.
- `execv`, `execve`, and `execvp` now return `Result<Void>` instead of
`Result<()>` in `::nix::unistd`.
### Fixed
- Improved the conversion from `std::net::SocketAddr` to `InetAddr` in
`::nix::sys::socket::addr`.
## [0.5.0] 2016-03-01