All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
Added mkdtemp
wrapper (#1297)
Add associated constants UTIME_OMIT
UTIME_NOW
for TimeSpec
(#1879)
Added EventFd
type. (#1945)
impl From<Signal> for SigSet
.impl std::ops::BitOr for SigSet
.impl std::ops::BitOr for Signal
.impl std::ops::BitOr<Signal> for SigSet
(#1959)
Added TlsGetRecordType
control message type and corresponding enum for linux (#2065)
Added Ipv6HopLimit
to ::nix::sys::socket::ControlMessage
for Linux, MacOS, FreeBSD, DragonflyBSD, Android, iOS and Haiku. (#2074)
Added Icmp
and IcmpV6
to SockProtocol
(#2103)
Added rfork support for FreeBSD in unistd
(#2121)
Added MapFlags::map_hugetlb_with_size_log2
method for Linux targets (#2125)
Added mmap_anonymous
function (#2127)
Added mips32r6
and mips64r6
support for signal, ioctl and ptrace (#2138)
Added F_GETPATH
FcntlFlags entry on Apple/NetBSD/DragonflyBSD for ::nix::fcntl
. (#2142)
Added F_KINFO
FcntlFlags entry on FreeBSD for ::nix::fcntl
. (#2152)
Added F_GETPATH_NOFIRMLINK
and F_BARRIERFSYNC
FcntlFlags entry on Apple for ::nix::fcntl
. (#2155)
Added newtype Flock
to automatically unlock a held flock upon drop. Added Flockable
trait to represent valid types for Flock
. (#2170)
Added SetSockOpt
impls to enable Linux Kernel TLS on a TCP socket and to import TLS parameters. (#2175)
::nix::sys::socket::SocketTimestamp
enum for configuring the TsClock
(a.k.a SO_TS_CLOCK
) sockoptScmRealtime
and ScmMonotonic
as new options in ::nix::sys::socket::ControlMessageOwned
(#2187)
Added new fanotify API: wrappers for fanotify_init
and fanotify_mark
(#2194)
Added SpecialCharacterindices
support for haiku. (#2195)
Added sys::sendfile
support for solaris/illumos. (#2198)
impl Display for InterfaceFlags (#2206)
Added sendfilev
in sys::sendfile for solarish (#2207)
Added fctrl::SealFlag::F_SEAL_FUTURE_WRITE
(#2213)
Added Ipv6MulticastHops
as socket option to set and read. (#2234)
Enable ControlMessageOwned::Ipv4RecvIf
and ControlMessageOwned::Ipv4RecvDstAddr
for DragonFlyBSD (#2240)
ClockId::set_time()
and time::clock_settime()
are now enabled on macOS (#2241)
Added IpBindAddressNoPort
sockopt to support IP_BIND_ADDRESS_NO_PORT
available on linux. (#2244)
Enable MapFlags::map_hugetlb_with_size_log2
method for Android/Fuchsia (#2245)
Added TcpFastOpenConnect
sockopt to support TCP_FASTOPEN_CONNECT
available on linux. (#2247)
Add reboot(2)
for OpenBSD/NetBSD (#2251)
Added new MemFdCreateFlag
constants to sys::memfd
on Linux and Android related to hugetlbfs support. (#2252)
Expose the inner fd of Kqueue
through:
(#2258)
Added sys::eventfd
support on FreeBSD (#2259)
Added MmapFlags::MAP_FIXED
constant in sys::mman
for netbsd and openbsd (#2260)
Added the SO_LISTENQLIMIT
sockopt. (#2263)
Enable the AT_EMPTY_PATH
flag for the fchownat()
function (#2267)
Add AtFlags::AT_EMPTY_PATH
for FreeBSD and Hurd (#2270)
Enable `OFlag::O_DIRECTORY for Solarish (#2275)
Added the Backlog
wrapper type for the listen
call. (#2276)
Add clock_nanosleep()
(#2277)
Enabled O_DIRECT
in fcntl::OFlags
for solarish (#2278)
Added a new API sigsuspend. (#2279)
errno::Errno::set
functionerrno::Errno::set_raw
functionerrno::Errno::last_raw
functionerrno::Errno::from_raw
function(#2283)
Enable the AT_EMPTY_PATH
flag for the linkat()
function (#2284)
Enable unistd::{sync, syncfs} for Android (#2296)
poll
now takes PollTimeout
replacing libc::c_int
. (#1876)
Deprecated sys::eventfd::eventfd
. (#1945)
mmap
, mmap_anonymous
, munmap
, mremap
, madvise
, msync
, mprotect
, munlock
and mlock
updated to use NonNull
. (#2000)
mmap
function now accepts F
instead of Option<F>
(#2127)
PollFd::new
now takes a BorrowedFd
argument, with relaxed lifetime requirements relative to the previous version. (#2134)
FdSet::{insert, remove, contains}
now take BorrowedFd
arguments, and have relaxed lifetime requirements relative to 0.27.1. (#2136)
The following APIs now take an implementation of AsFd
rather than a RawFd
:
unistd::tcgetpgrp
unistd::tcsetpgrp
unistd::fpathconf
unistd::ttyname
unistd::getpeereid
(#2137)Changed openat()
and Dir::openat()
, now take optional dirfd
s (#2139)
The MSRV is now 1.69 (#2144)
Changed function SockaddrIn::ip()
to return net::Ipv4Addr
and refactored SocketAddrV6::ip()
to be const
(#2151)
The following APIs now take optional dirfd
s:
readlinkat()
fstatat()
mknodat()
mkdirat()
execveat()
(#2157)
Epoll::wait
now takes EpollTimeout
replacing isize
. (#2202)
errno::errno()
function (use Errno::last_raw()
)errno::from_i32()
function (use Errno::from_raw()
)errno::Errno::from_i32()
function (use Errno::from_raw()
)(#2283)
SigSet
incorrect implementation of Eq
, PartialEq
and Hash
(#1946)::sys::socket::sockopt::IpMulticastTtl
by fixing the value of optlen passed to libc::setsockopt
and added tests. (#2072)recvmmsg
, potentially causing UB (#2119)SignalFd::set_mask
. In 0.27.0 it would actually close the file descriptor. (#2141)sun_len
value as needed. Fixed sys::socket::addr::from_raw_parts
and sys::socket::Sockaddrlike::len
build for solaris. (#2242)dup3
wrapper to perform a real call to dup3
instead of emulating it via dup2
and fcntl
to get rid of race condition (#2268)::unistd::Group::members
using read_unaligned to avoid crash on misaligned pointers (#2311)FchownatFlags
type has been deprecated, please use AtFlags
instead. (#2267)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)LinkatFlags
type has been deprecated, please use AtFlags
instead. (#2284)AT_EACCESS
to AtFlags
on all platforms but android (#1995)PF_ROUTE
to SockType
on macOS, iOS, all of the BSDs, Fuchsia, Haiku, Illumos. (#1867)nix::ucontext
module on aarch64-unknown-linux-gnu
. (#1662)CanRaw
to SockProtocol
and CanBcm
as a separate SocProtocol
constant. (#1912)Generic
and NFLOG
to SockProtocol
. (#2092)mq_timedreceive
to ::nix::mqueue
. ([#1966])(https://github.com/nix-rust/nix/pull/1966)LocalPeerPid
to nix::sys::socket::sockopt
for macOS. (#1967)TFD_TIMER_CANCEL_ON_SET
to ::nix::sys::time::TimerSetTimeFlags
on Linux and Android. (#2040)SOF_TIMESTAMPING_OPT_ID
and SOF_TIMESTAMPING_OPT_TSONLY
to nix::sys::socket::TimestampingFlag
. (#2048)SO_SETFIB
and SO_USER_COOKIE
to nix::sys::socket::sockopt
for FreeBSD. (#2085)SO_RTABLE
for OpenBSD and SO_ACCEPTFILTER
for FreeBSD/NetBSD to nix::sys::socket::sockopt
. (#2085)MSG_WAITFORONE
to MsgFlags
on Android, Fuchsia, Linux, NetBSD, FreeBSD, OpenBSD, and Solaris. (#2014)SO_TS_CLOCK
for FreeBSD to nix::sys::socket::sockopt
. (#2093)nix::socket
and nix::select
are now available on Redox. (#2012)mqueue::MqdT
. (#2097)kevent_flags
on SigEvent
. (#1731)All Cargo features have been removed from the default set. Users will need to specify which features they depend on in their Cargo.toml. (#2091)
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 |
(#1906)
Use I/O safety with copy_file_range
, and expose it on FreeBSD. (#1906)
The epoll interface now uses a type. (#1882)
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. (#1921)
Refactored name
parameter of mq_open
and mq_unlink
to be generic over NixPath
. (#2102).
Made clone
unsafe, like fork
. (#1993)
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
. (#1943)nix::sys::signalfd::signalfd
is deprecated. Use nix::sys::signalfd::SignalFd
instead. (#1938)SigEvent
support on Fuchsia, where it was unsound. (#2079)flock
from ::nix::fcntl
on Solaris. (#2082)ETH_P_ALL
in htons format (#1925)recvmsg
now sets the length of the received sockaddr_un
field correctly on Linux platforms. (#2041)SockaddrIn::from<std::net::SocketAddrV4>
, SockaddrIn6::from<std::net::SockaddrV6>
, IpMembershipRequest::new
, and Ipv6MembershipRequest::new
with future Rust versions. (#2061)recvmsg
. (#2095)SockaddrIn6
bug that was swapping flowinfo
and scope_id
byte ordering. (#1964)sys::socket::sockopt::SockType
using SOCK_PACKET
. (#1821)SockaddrStorage::{as_unix_addr, as_unix_addr_mut}
(#1871)MntFlags
and unmount
on all of the BSDs.any()
and all()
to poll::PollFd
. (#1877)MntFlags
and unmount
on all of the BSDs. (#1849)Statfs::flags
method. (#1849)NSFS_MAGIC
FsType on Linux and Android. (#1829)sched_getcpu
on platforms that support it. (#1825)sched_getaffinity
and sched_setaffinity
on FreeBSD. (#1804)line_discipline
field to Termios
on Linux, Android and Haiku (#1805)domainname
field of UtsName
on Android and Linux (#1817)RLIM_INFINITY
from libc
(#1831)syncfs(2)
on Linux (#1833)faccessat(2)
on illumos (#1841)eaccess()
on FreeBSD, DragonFly and Linux (glibc and musl). (#1842)IP_TOS
SO_PRIORITY
and IPV6_TCLASS
sockopts for Linux (#1853)new_unnamed
and is_unnamed
for UnixAddr
on Linux and Android. (#1857)SockProtocol::Raw
for raw sockets (#1848)IP_MTU
(IpMtu
) IPPROTO_IP
sockopt on Linux and Android. (#1865)addr
argument of sys::mman::mmap
is now of type Option<NonZeroUsize>
. (#1870)length
argument of sys::mman::mmap
is now of type NonZeroUsize
. (#1873)SockaddrStorage
to store a Unix-domain socket address on Linux. (#1871)TimeSpec
. (#1801)User::from_name
and Group::from_name
panicking when given a name containing a nul. (#1815)User::from_uid
and User::from_name
crash on Android platform. (#1824)getifaddrs
to misbehave. (#1788)faccessat
(#1780)memfd
on Android. (#1773)ETH_P_ALL
to SockProtocol
enum (#1768)SysconfVar
variants (#1761)TimeSpec
and TimeVal
(#1760)chflags
. (#1758)aio_writev
and aio_readv
. (#1713)From<uid_t>
for Uid
and From<gid_t>
for Gid
(#1727)From<SockaddrIn>
for std::net::SocketAddrV4
and impl From<SockaddrIn6>
for std::net::SocketAddrV6
. (#1711)x86_64-unknown-haiku
target. (#1703)ptrace::read_user
and ptrace::write_user
for Linux. (#1697)getrusage
and helper types UsageWho
and Usage
(#1747)DontRoute
SockOpt (#1752)signal::SigSet::from_sigset_t_unchecked()
. (#1741)Ipv4OrigDstAddr
sockopt and control message. (#1772)Ipv6OrigDstAddr
sockopt and control message. (#1772)Ipv4SendSrcAddr
control message. (#1776)Reimplemented sendmmsg/recvmmsg to avoid allocations and with better API (#1744)
Rewrote the aio module. The new module:
Box
an aio operation.priority
arguments to i32
.aio_return
to usize
. (#1713)nix::poll::ppoll
: sigmask
parameter is now optional. (#1739)
Changed gethostname
to return an owned OsString
. (#1745)
signal:SigSet
is now marked as repr(transparent)
. (#1741)
lio_listio
operations. It was too complicated, and didn‘t fit Nix’s theme of zero-cost abstractions. Instead, it can be reimplemented downstream. (#1713)nix::sys::socket::recvfrom
. (#1763)SockaddrStorage::{as_link_addr, as_link_addr_mut}
for Linux-like operating systems. (#1729)SockaddrLike::from_raw
implementations for VsockAddr
and SysControlAddr
. (#1736)UnixAddr::size
on Linux-based OSes. (#1702)target_os = "android"
and synced constants with libc v0.2.121. (#1690)fexecve
on DragonFly. (#1577)sys::uio::IoVec
is now Send
and Sync
(#1582)EPOLLEXCLUSIVE
on Android. (#1567)fdatasync
for FreeBSD, Fuchsia, NetBSD, and OpenBSD. (#1581)sched_setaffinity
and sched_getaffinity
on DragonFly. (#1537)posix_fallocate
on DragonFly. (#1621)SO_TIMESTAMPING
support (#1547)MqAttr
struct (#1619)TxTime
sockopt and control message. (#1564)sendfile
on DragonFly. (#1615)UMOUNT_NOFOLLOW
, FUSE_SUPER_MAGIC
on Linux. (#1634)getresuid
, setresuid
, getresgid
, and setresgid
on DragonFly, FreeBSD, and OpenBSD. (#1628)MAP_FIXED_NOREPLACE
on Linux. (#1636)fspacectl
on FreeBSD (#1640)accept4
on DragonFly, Emscripten, Fuchsia, Illumos, and NetBSD. (#1654)AsRawFd
implementation on OwningIter
. (#1563)process_vm_readv
and process_vm_writev
on Android. (#1557)nix::ucontext
module on s390x. (#1662)Extend
, FromIterator
, and IntoIterator
for SigSet
and added SigSet::iter
and SigSetIter
. (#1553)ENOTRECOVERABLE
and EOWNERDEAD
error codes on DragonFly. (#1665)Read
and Write
for &PtyMaster
(#1664)MSG_NOSIGNAL
for Android, Dragonfly, FreeBSD, Fuchsia, Haiku, Illumos, Linux, NetBSD, OpenBSD and Solaris. (#1670)waitid
. (#1584)Ipv6DontFrag
for android, iOS, linux and macOS.IpDontFrag
for iOS, macOS. (#1692)mqueue
functions now operate on a distinct type, nix::mqueue::MqdT
. Accessors take this type by reference, not by value. (#1639)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
. (#1553)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. (#1656)getrlimit
and setrlimit
to use rlim_t
directly instead of Option<rlim_t>
. (#1668)InetAddr
and SockAddr
in favor of SockaddrIn
, SockaddrIn6
, and SockaddrStorage
. (#1684)IpAddr
, Ipv4Addr
, and Ipv6Addr
in favor of their equivalents from the standard library. (#1685)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
. (#1672)IoVec
with IoSlice
and IoSliceMut
, and replaced IoVec::from_slice
with IoSlice::new
. (#1643)InetAddr::from_std
now sets the sin_len
/sin6_len
fields on the BSDs. (#1642)LinkAddr::addr
. That function now returns an Option
. (#1675) (#1677)NetlinkAddr
, AlgAddr
, SysControlAddr
, LinkAddr
, and VsockAddr
. (#1614)EventFlag::EV_SYSFLAG
. (#1635)FdSet::insert
, FdSet::remove
, and FdSet::contains
involving file descriptors outside of the range 0..FD_SETSIZE
. (#1575)LocalPeerCred
sockopt. (#1482)TimeSpec::from_duration
and TimeSpec::from_timespec
(#1465)IPV6_V6ONLY
sockopt. (#1470)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. (#1471)pthread_kill
. (#1472)mknodat
. (#1473)setrlimit
and getrlimit
. (#1302)ptrace::interrupt
method for platforms that support PTRACE_INTERRUPT
(#1422)IP6T_SO_ORIGINAL_DST
sockopt. (#1490)PTRACE_EVENT_STOP
variant to the sys::ptrace::Event
enum (#1335)SockAddr::from_raw_sockaddr
(#1447)TcpRepair
(#1503)pwritev
and preadv
for more operating systems. (#1511)TCP_MAXSEG
TCP Maximum Segment Size socket options (#1292)Ipv4RecvErr
and Ipv6RecvErr
sockopts and associated control messages. (#1514)AsRawFd
implementation on PollFd
. (#1516)Ipv4Ttl
and Ipv6Ttl
sockopts. (#1515)MAP_EXCL
, MAP_ALIGNED_SUPER
, and MAP_CONCEAL
mmap flags, and exposed MAP_ANONYMOUS
for all operating systems. (#1522) (#1525) (#1531) (#1534)PollFd
. (#1517)FdSet::{contains, highest, fds}
no longer require a mutable reference. (#1464)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 (#1471)eventfd
s are supported on Android, change conditional compilation to include sys::eventfd::eventfd
and sys::eventfd::EfdFlags
for Android builds. (#1481)Errno
, are now marked as #[non_exhaustive]
. (#1474)const
. (#1476) (#1492)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. (#1484)UnixAddr
to encapsulate internals better in order to fix soundness issues. No longer allows creating a UnixAddr
from a raw sockaddr_un
. (#1496)posix_fadvise
now returns errors in the conventional way, rather than as a non-zero value in Ok()
. (#1538)Signal::try_from
on some platforms. (#1484)unistd::getgrouplist
. (#1545)nix::sys::signal::NSIG
. It was of dubious utility, and not correct for all platforms. (#1484)SockAddr/InetAddr::to_str
in favor of ToString::to_string
(#1495)SigevNotify
on OpenBSD and Redox. (#1511)unistd::getgrouplist
. (#1545)if_nameindex
(#1445)nmount
for FreeBSD. (#1453)IpFreebind
socket option (sockopt) on Linux, Fuchsia and Android. (#1456)TcpUserTimeout
socket option (sockopt) on Linux and Fuchsia. (#1457)renameat2
for Linux (#1458)RxqOvfl
support on Linux, Fuchsia and Android. (#1455)ptsname_r
now returns a lossily-converted string in the event of bad UTF, just like ptsname
. (#1446)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
. (#1446)unistd::getgrouplist
. (#1545)getresuid
and getresgid
(#1430)sendfile64
(#1439)MS_LAZYTIME
to MsFlags
(#1437)forkpty
unsafe, like fork
(#1390)Uid
, Gid
and Pid
methods from_raw
and as_raw
a const fn
(#1429)Uid::is_root
a const fn
(#1429)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. (#1440)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. (#1440)Errno
, instead of consts in the errno
module. (#1452)sockaddr_ll
size, as reported by the Linux kernel, to be smaller then it's definition (#1395)sendmmsg
with multiple cmsgs (#1414)Errno::EOPNOTSUPP
to FreeBSD, where it was missing. (#1452)sys::socket::accept4
from Android arm because libc removed it in version 0.2.87. (#1399)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. (#1440)unistd::getgrouplist
. (#1545)passwd
field to Group
(#1338)mremap
(#1306)personality
(#1331)getpeereid
(#1342)IntoIterator
for Dir
(#1333).recvfrom
on an AddrFamily::Packet
socket (#1344)TimerFd
now closes the underlying fd on drop. (#1381)*_MAGIC
filesystem constants on Linux s390x (#1372)Dir
, SignalFd
, and PtyMaster
are no longer Clone
. (#1382)SockLevel
, which hasn't been used for a few years (#1362)Copy
and Clone
from TimerFd
. (#1381)recvmmsg
. (#1341)SockProtocol
enum (#1289)clock_gettime
, clock_settime
, clock_getres
, clock_getcpuclockid
functions and ClockId
struct. (#1281)PTRACE_SYSEMU
and PTRACE_SYSEMU_SINGLESTEP
. (#1300)TCP_KEEPCNT
and TCP_KEEPINTVL
TCP keepalive options. (#1283)SeekData
and SeekHole
on all Linux targets (#1284)&[&CStr]
and &[CString]
as its list argument(s). (#1278)unistd::fork
an unsafe funtion, bringing it in line with libstd's decision. (#1293)fchown(2)
wrapper. (#1257)MAP_HUGE_
SIZE
family of flags. (#1211)F_OFD_*
fcntl
commands on Linux and Android. (#1195)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. (#1185)FsType
inner value made public. (#1187)unistd::setfsuid
and unistd::setfsgid
to set the user or group identity for filesystem checks per-thread. (#1163)Ord
, PartialOrd
for unistd::Pid
(#1189)select::FdSet::fds
method to iterate over file descriptors in a set. (#1207)sendmmsg
and recvmmsg
calls (#1208)SCM_CREDS
messages (UnixCredentials
) on FreeBSD/DragonFly (#1216)BindToDevice
socket option (sockopt) on Linux (#1233)EventFilter
bitflags for EV_DISPATCH
and EV_RECEIPT
on OpenBSD. (#1252)Ipv4PacketInfo
and Ipv6PacketInfo
to ControlMessage
. (#1222)CpuSet
and UnixCredentials
now implement Default
. (#1244)unistd::ttyname
(#1259)Ipv4PacketInfo
and Ipv6PacketInfo
to ControlMessage
for iOS and Android. (#1265)TimerFd
. (#1261)fallocate
return type from c_int
to ()
(#1201)sys::ptrace::setregs
and sys::ptrace::getregs
on x86_64-unknown-linux-musl target (#1198)ptrace::write
is now an unsafe
function. Caveat programmer. (#1245)execv
, execve
, execvp
and execveat
in ::nix::unistd
and reboot
in ::nix::sys::reboot
now return Result<Infallible>
instead of Result<Void>
(#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
. (#1244)Inotify
methods now take self
by value instead of by reference (#1244)nix::poll::ppoll
: timeout
parameter is now optional, None is equivalent for infinite timeout.Fixed getsockopt
. The old code produced UB which triggers a panic with Rust 1.44.0. (#1214)
Fixed a bug in nix::unistd that would result in an infinite loop when a group or user lookup required a buffer larger than 16KB. (#1198)
Fixed unaligned casting of cmsg_data
to af_alg_iv
(#1206)
Fixed readlink
/readlinkat
when reading symlinks longer than PATH_MAX
(#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. (#1243)
Fixed unaligned pointer read in Inotify::read_events
. (#1244)
Removed sys::socket::addr::from_libc_sockaddr
from the public API. (#1215)
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. (#1235)
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. (#1242)
Removed unistd::daemon
and unistd::pipe2
on OSX and ios (#1255)
Removed sys::event::FilterFlag::NOTE_EXIT_REPARENTED
and sys::event::FilterFlag::NOTE_REAP
on OSX and ios. (#1255)
Removed sys::ptrace::ptrace
on Android and Linux. (#1255)
Dropped support for powerpc64-unknown-linux-gnu (#1266)
CLK_TCK
to SysconfVar
(#1177)Added ptrace::seize()
: similar to attach()
on Linux but with better-defined semantics. (#1154)
Added Signal::as_str()
: returns signal name as &'static str
(#1138)
Added posix_fallocate
. (#1105)
Implemented Default
for FdSet
(#1107)
Added NixPath::is_empty
. (#1107)
Added mkfifoat
(#1133)
Added User::from_uid
, User::from_name
, User::from_gid
and Group::from_name
, (#1139)
Added linkat
(#1101)
Added sched_getaffinity
. (#1148)
Added optional Signal
argument to ptrace::{detach, syscall}
for signal injection. (#1083)
sys::termios::BaudRate
now implements TryFrom<speed_t>
instead of From<speed_t>
. The old From
implementation would panic on failure. (#1159)
sys::socket::ControlMessage::ScmCredentials
and sys::socket::ControlMessageOwned::ScmCredentials
now wrap UnixCredentials
rather than libc::ucred
. (#1160)
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. (#1156)
sys::socket::recvfrom
now returns Result<(usize, Option<SockAddr>)>
instead of Result<(usize, SockAddr)>
. (#1145)
Signal::from_c_int
has been replaced by Signal::try_from
(#1113)
Changed readlink
and readlinkat
to return OsString
(#1109)
# 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. (#1108)
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. (#1107)
Type &CString
for parameters of exec(v|ve|vp|vpe|veat)
are changed to &CStr
. (#1121)
Fix length of abstract socket addresses (#1120)
Fix initialization of msghdr in recvmsg/sendmsg when built with musl (#1136)
CmsgSpace
. (#1156)MSG_WAITALL
to MsgFlags
in sys::socket
. (#1079)Clone
, Copy
, Debug
, Eq
, Hash
, and PartialEq
for most types that support them. (#1035)copy_file_range
wrapper (#1069)mkdirat
. (#1084)posix_fadvise
. (#1089)AF_VSOCK
to AddressFamily
. (#1091)unlinkat
(#1058)renameat
. (#1097)ifaddrs
now present when building for Android. (#1077)statfs()
and fstatfs()
return result with Statfs
wrapper (#928)sched_yield
for all nix hosts. (#1090)Macros exported by nix
may now be imported via use
on the Rust 2018 edition without importing helper macros on Linux targets. (#1066)
For example, in Rust 2018, the ioctl_read_bad!
macro can now be imported without importing the convert_ioctl_res!
macro.
use nix::ioctl_read_bad; ioctl_read_bad!(tcgets, libc::TCGETS, libc::termios);
uint32_t
to the native equivalents like u32.
(#1072)inotify_init1
, inotify_add_watch
and inotify_rm_watch
wrappers for Android and Linux. (#1016)ALG_SET_IV
, ALG_SET_OP
and ALG_SET_AEAD_ASSOCLEN
control messages and AF_ALG
socket types on Linux and Android (#1031)from_std
and to_std
methods for sys::socket::IpAddr
(#1043)nix::unistd:seteuid
and nix::unistd::setegid
for those platforms that do not support setresuid
nor setresgid
respectively. (#1044)access
wrapper (#1045)forkpty
(#1042)sched_yield
(#1050)PollFd
event flags renamed to PollFlags
(#1024)
recvmsg
now returns an Iterator over ControlMessageOwned
objects rather than ControlMessage
objects. This is sadly not backwards-compatible. Fix code like this:
if let ControlMessage::ScmRights(&fds) = cmsg {
By replacing it with code like this:
if let ControlMessageOwned::ScmRights(fds) = cmsg {
(#1020)
Replaced CmsgSpace
with the cmsg_space
macro. (#1020)
Fixed multiple bugs when using sendmsg
and recvmsg
with ancillary control messages (#1020)
Macros exported by nix
may now be imported via use
on the Rust 2018 edition without importing helper macros for BSD targets. (#1041)
For example, in Rust 2018, the ioctl_read_bad!
macro can now be imported without importing the convert_ioctl_res!
macro.
use nix::ioctl_read_bad; ioctl_read_bad!(tcgets, libc::TCGETS, libc::termios);
Daemon
, NOTE_REAP
, and NOTE_EXIT_REPARENTED
are now deprecated on OSX and iOS. (#1033)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. (#1055)uint32_t
to the native equivalents like u32.
(#1072)Daemon
, NOTE_REAP
, and NOTE_EXIT_REPARENTED
are now deprecated on OSX and iOS. (#1033)setsockopt
. (#972)TCP_CONGESTION
in setsockopt
. (#972)symlinkat
wrapper. (#997)ptrace::{getregs, setregs}
. (#1010)nix::sys::signal::signal
. (#817)mprotect
wrapper. (#991)lutimes
never worked on OpenBSD as it is not implemented on OpenBSD. It has been removed. (#1000)fexecve
never worked on NetBSD or on OpenBSD as it is not implemented on either OS. It has been removed. (#1000)uint32_t
to the native equivalents like u32.
(#1072)fexecve
never worked on NetBSD or on OpenBSD as it is not implemented on either OS. It has been removed. (#1000)Daemon
, NOTE_REAP
, and NOTE_EXIT_REPARENTED
are now deprecated on OSX and iOS. (#1033)FromStr
and Display
impls for nix::sys::Signal
(#884)sync
wrapper. (#961)sysinfo
wrapper. (#922)SO_PEERCRED
socket option and the UnixCredentials
type on all Linux and Android targets. (#921)SCM_CREDENTIALS
, allowing to send process credentials over Unix sockets. (#923)dir
module for reading directories (wraps fdopendir
, readdir
, and rewinddir
). (#916)kmod
module that allows loading and unloading kernel modules on Linux. (#930)futimens
and utimesat
wrappers (#944), an lutimes
wrapper (#967), and a utimes
wrapper (#946).AF_UNSPEC
wrapper to AddressFamily
(#948)mode_t
public alias within sys::stat
. (#954)truncate
wrapper. (#956)fchownat
wrapper. (#955)ptrace
on BSD operating systems (#949)ptrace
functions for reads and writes to tracee memory and ptrace kill (#949) (#958)acct
wrapper module for enabling and disabling process accounting (#952)time_t
and suseconds_t
public aliases within sys::time
. (#968)unistd::execvpe
for Haiku, Linux and OpenBSD (#975)Error::as_errno
. (#977)preadv
take immutable slice of IoVec. (#914)uint32_t
to the native equivalents like u32.
(#1072)fexecve
never worked on NetBSD or on OpenBSD as it is not implemented on either OS. It has been removed. (#1000)Daemon
, NOTE_REAP
, and NOTE_EXIT_REPARENTED
are now deprecated on OSX and iOS. (#1033)sendfile
on FreeBSD and Darwin. (#901)pselect
(#894)preadv
and pwritev
on the BSDs. (#883)mlockall
and munlockall
(#876)SO_MARK
on Linux. (#873)sys::aio
module. (#872)sys::aio::LioCb
as a wrapper for libc::lio_listio
. (#872)unistd::getsid
(#850)alarm
. (#830)IFF_NO_PI, IFF_TUN, IFF_TAP
on linux-like systems. (#853)statvfs
module to all MacOS and Linux architectures. (#832)EVFILT_EMPTY
, EVFILT_PROCDESC
, and EVFILT_SENDFILE
on FreeBSD. (#825)termios::cfmakesane
on FreeBSD. (#825)MSG_CMSG_CLOEXEC
on *BSD. (#825)fchmod
, fchmodat
. (#857)request_code_write_int!
on FreeBSD/DragonFlyBSD (#833)Display
and Debug
for SysControlAddr
now includes all fields. (#837)ioctl!
has been replaced with a family of ioctl_*!
macros. (#833)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. (#833)ptrace::Request
definitions for uncommon Linux platforms (#892)FD_CLOEXEC
and O_NONBLOCK
was removed from socket()
, accept4()
, and socketpair()
. (#907)SigAction::flags
on Linux (#869)ioctl_write_int!
on FreeBSD/DragonFlyBSD (#833)ioctl_write_int!
now properly supports passing a c_ulong
as the parameter on Linux non-musl targets (#833)bytes
crate from the sys::aio
module. See sys::aio::AioCb::from_boxed_slice
examples for alternatives. (#872)sys::aio::lio_listio
. Use sys::aio::LioCb::listio
instead. (#872)accept4()
from macos, ios, and netbsd targets (#907)IFF_NOTRAILERS
on OpenBSD, as it has been removed in OpenBSD 6.3 (#893)sys::ptrace::step
(#852)AioCb::from_ptr
and AioCb::from_mut_ptr
(#820)sys::ptrace::{traceme, syscall, cont, attach}
. Using the matching routines with sys::ptrace::ptrace
is now deprecated.nix::poll
module for all platforms (#672)nix::ppoll
function for FreeBSD and DragonFly (#672)AddressFamily
enum. (#647)pid()
method to WaitStatus
for extracting the PID. (#722)nix::unistd:fexecve
. (#727)uname()
on all platforms. (#739)signalfd
module on Android as well. (#739)nix::sys::ptrace::detach
. (#749)nix::sys::socket::ControlMessage::ScmTimestamp
(#663)nix::sys::socket::sockopt::ReceiveTimestamp
(#663)AioCb
(#773)nix::sys::fallocate
(#768)nix::unistd::mkfifo
. (#602)ptrace::Options::PTRACE_O_EXITKILL
on Linux and Android. (#771)nix::sys::uio::{process_vm_readv, process_vm_writev}
on Linux (#568)nix::unistd::{getgroups, setgroups, getgrouplist, initgroups}
. (#733)nix::sys::socket::UnixAddr::as_abstract
on Linux and Android. (#785)nix::unistd::execveat
on Linux and Android. (#800)from_raw()
method to WaitStatus
for converting raw status values to WaitStatus
independent of syscalls. (#741)sigprocmask
to the signal module. (#826)nix::sys::socket::LinkAddr
on Linux and all bsdlike system. (#813)IP_TRANSPARENT
/ BIND_ANY
. (#835)mqueue
module for all supported operating systems. (#834)pipe2
on all BSD targets. Users should notice no difference. (#777)ptrace
wrappers to encourage namespacing (#692)sys::ptrace::ptrace
as unsafe
.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
. (#647)select
easier to use, adding the ability to automatically calculate the nfds
parameter using the new FdSet::highest
(#701)unistd::setresuid
and unistd::setresgid
on FreeBSD and OpenBSD (#721)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)addr
argument to madvise
and msync
is now *mut
to better match the libc API. (#731)shm_open
and shm_unlink
are no longer exposed on Android targets, where they are not officially supported. (#731)MapFlags
, MmapAdvise
, and MsFlags
expose some more variants and only officially-supported variants are provided for each target. (#731)pty::ptsname
function as unsafe
(#744)AioCb::Drop
will now panic if the AioCb
is still in-progress (#715)nix::sys::socket::UnixAddr::new_abstract
to Linux and Android only. (#785)ucred
struct has been removed in favor of a UserCredentials
struct that contains only getters for its fields. (#814)ip_mreq
and ipv6_mreq
have been replaced with IpMembershipRequest
and Ipv6MembershipRequest
. (#814)pause
. (#829)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. (#843)AioCb::fsync
, AioCb::read
, and AioCb::write
. It is no longer an error to drop an AioCb
that failed to enqueue in the OS. (#715)sendmsg
/recvmsg
, caused by mismatched msghdr
definition. (#648)AioCb::from_boxed_slice
has been removed. It was never actually safe. Use from_bytes
or from_bytes_mut
instead. (#820)memfd_create()
and pivot_root()
, which are still exposed as separate functions. (#747)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)MS_VERBOSE
, MS_NOSEC
, and MS_BORN
from MsFlags
. These are internal kernel flags and should never have been exposed. (#814)sysconf
, pathconf
, and fpathconf
(#630sys::signal::SigAction::{ flags, mask, handler}
(#611nix::sys::pthread::pthread_self
(#591AioCb::from_boxed_slice
(#582nix::unistd::{openat, fstatat, readlink, readlinkat}
(#551)nix::pty::{grantpt, posix_openpt, ptsname/ptsname_r, unlockpt}
(#556nix::ptr::openpty
(#456)nix::ptrace::{ptrace_get_data, ptrace_getsiginfo, ptrace_setsiginfo and nix::Error::UnsupportedOperation}
(#614)cfmakeraw
, cfsetspeed
, and tcgetsid
. (#527)ioctl!
macro. (#670)PTRACE_O_TRACESYSGOOD
events from wait
and waitpid
using WaitStatus::PtraceSyscall
(#566).ioctl!
macro and its variants now allow the generated functions to have doccomments. (#661)ioctl!(write ...)
into ioctl!(write_ptr ...)
and ioctl!(write_int ..)
variants to more clearly separate those use cases. (#670)sys::mman::{ mmap, munmap, madvise, munlock, msync }
as unsafe. (#559)revents
argument from PollFd::new()
as it's an output argument and will be overwritten regardless of value. (#542)sys::select::FdSet::contains
to make self
immutable (#564)gid_t
, pid_t
, and uid_t
as Gid
, Pid
, and Uid
respectively. Various functions have been changed to use these new types as arguments. (#629)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. (#561)eventfd
, signalfd
, and pwritev
/preadv
functionality is now included by default for all supported platforms. (#681)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. (#670)io::Error
from nix::Error
and the conversion from nix::Error
to Errno
(#614)execvpe
is no longer supported, but this was already broken and will be added back in the next release. (#681)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. (#670)Linux/PPC
(#553), MacOS/x86_64,i686
(#553), NetBSD/x64_64
(#538), FreeBSD/x86_64,i686
(#536), and Android
(#631).bind
and errno_location
now work correctly on Android
(#631)nix::ptrace
on all Linux-kernel-based platforms #624. Previously it was only available on x86, x86-64, and ARM, and also not on Android.sys::socket::sendmsg
with zero entry cmsgs
parameter. (#623)ioctl!
macro now supports working with non-int datatypes and properly supports all platforms. (#670)::nix::sys::termios::BaudRate
enum to provide portable baudrate values. (#518)WaitStatus::PtraceEvent
to support ptrace events on Linux and Android (#438)ioctl
calls on BSD platforms (#478)TimeSpec
(#475) (#483)epoll_create1
and bitflags EpollCreateFlags
in ::nix::sys::epoll
in order to support ::libc::epoll_create1
. (#410)setresuid
and setresgid
for Linux in ::nix::unistd
(#448)getpgid
in ::nix::unistd
(#433)tcgetpgrp
and tcsetpgrp
in ::nix::unistd
(#451)CLONE_NEWCGROUP
in ::nix::sched
(#457)getpgrp
in ::nix::unistd
(#491)fchdir
in ::nix::unistd
(#497)major
and minor
in ::nix::sys::stat
for decomposing dev_t
(#508)libc
in more places. (#503)ppoll
in ::nix::poll
(#520)::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}
switched to use BaudRate
enum from speed_t
. (#518)epoll_ctl
now could accept None as argument event
when op is EpollOp::EpollCtlDel
. (#480)bad
keyword from the ioctl!
macro (#478)TimeVal
into an opaque Newtype (#475)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
. (#445)KEvent
to an opaque structure that may only be modified by its constructor and the ev_set
method. (#415) (#442) (#463)pipe2
now calls libc::pipe2
where available. Previously it was emulated using pipe
, which meant that setting O_CLOEXEC
was not atomic. (#427)EpollEventKind
to EpollFlags
in ::nix::sys::epoll
in order for it to conform with our conventions. (#410)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. (#410)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. (#460)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).FcntlArg
enum. (#541)EVFILT_USER
on FreeBSD (#415)UnixAddr::new_abstract
in ::nix::sys::socket
. (#429)dev_t
the same way as libc. (#508)lseek
and lseek64
in ::nix::unistd
(#377)mkdir
and getcwd
in ::nix::unistd
(#416)sigmask_mut
and sigmask
to UContext
in ::nix::ucontext
. (#370)WUNTRACED
to WaitPidFlag
in ::nix::sys::wait
for non-linux targets. (#379)::nix::sys::reboot
with enumeration RebootMode
and functions reboot
and set_cad_enabled
. Currently for linux only. (#386)FdSet
in ::nix::sys::select
now also implements Clone
. (#405)F_FULLFSYNC
to FcntlArg
in ::nix::fcntl
for apple targets. (#407)CpuSet::unset
in ::nix::sched
. (#402)new()
to PollFd
in ::nix::poll
, in order to allow creation of objects, after removing public access to members. (#399)revents()
to PollFd
in ::nix::poll
, in order to provide read access to formerly public member revents
. (#399)MSG_CMSG_CLOEXEC
to MsgFlags
in ::nix::sys::socket
for linux only. (#422)Signal
in ::nix::sys::signal
. (#362)EventFdFlag
to EfdFlags
in ::nix::sys::eventfd
. (#383)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. (#402)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
. (#392)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. (#392)MQd
in ::nix::queue
was replaced by the type alias libc::mqd_t
, both of which are aliases for the same type. (#392)SigNum
from ::nix::sys::signal
. (#362)CpuMask
from ::nix::shed
. (#402)PollFd
in ::nix::poll
. (See also added method revents()
. (#399)gettid
in ::nix::unistd
for linux and android. (#293)::nix::sched
and ::nix::sys::syscall
. (#301)SIGNALFD_SIGINFO_SIZE
in ::nix::sys::signalfd
. (#309)::nix::ucontext
with struct UContext
. Currently for linux only. (#311)EPOLLEXCLUSIVE
to EpollEventKind
in ::nix::sys::epoll
. (#330)pause
to ::nix::unistd
. (#336)sleep
to ::nix::unistd
. (#351)S_IFDIR
, S_IFLNK
, S_IFMT
to SFlag
in ::nix::sys::stat
. (#359)clear
and extend
functions to SigSet
's implementation in ::nix::sys::signal
. (#347)sockaddr_storage_to_addr
in ::nix::sys::socket
now supports sockaddr_nl
on linux and android. (#366)SO_ORIGINAL_DST
in ::nix::sys::socket
on linux. (#367)SIGINFO
in ::nix::sys::signal
for the macos target as well as SIGPWR
and SIGSTKFLT
in ::nix::sys::signal
for non-macos targets. (#361)IoVec
in ::nix::sys::uio
. (#304)CREATE_NEW_FD
by SIGNALFD_NEW
in ::nix::sys::signalfd
. (#309)SaFlag
to SaFlags
and SigFlag
to SigFlags
in ::nix::sys::signal
. (#314)Fork
to ForkResult
and changed its fields in ::nix::unistd
. (#332)signal
parameter to clone
's signature in ::nix::sched
. (#344)execv
, execve
, and execvp
now return Result<Void>
instead of Result<()>
in ::nix::unistd
. (#357)std::net::SocketAddr
to InetAddr
in ::nix::sys::socket::addr
. (#335)