summaryrefslogtreecommitdiff
path: root/src/sys
AgeCommit message (Collapse)Author
2021-05-13Use https instead of httpRyan Zoeller
2021-04-19Fix timestamp docLu, Wangshan
2021-04-08Merge #1402bors[bot]
1402: Support TIMESTAMPNS r=asomers a=WiSaGaN This adds support of linux TIMESTAMPNS. The code is mostly copied paste from https://github.com/nix-rust/nix/pull/663 Co-authored-by: Lu, Wangshan <wisagan@gmail.com>
2021-04-08Merge #1414bors[bot]
1414: Fix corrupted sendmmsg() call r=asomers a=eaufavor Before this fix, the buffer that holds cmsgs may move due to the resize() call. That causes msg_hdr pointing to invalid memory, which ends up breaking the sendmmsg() call, resulting in EINVAL. This change fixes it by avoiding re-allocating the buffers. Co-authored-by: Yuchen Wu <yuchen@cloudflare.com>
2021-04-08Support TIMESTAMPNS for linuxLu, Wangshan
2021-04-07Fix spurious errors using `sendmmsg` with multiple cmsgsYuchen Wu
Before this fix, the buffer that holds cmsgs may move due to the resize() call. That causes msg_hdr pointing to invalid memory, which ends up breaking the sendmmsg() call, resulting in EINVAL. This change fixes it by avoiding re-allocating the buffers.
2021-04-04Use memoffset::offset_of instead of homegrown macroAlan Somers
The homegrown macro was fine in 2016, but at some point it technically became UB. The memoffset crate does the same thing, but avoids UB when using rustc 1.51.0 or later. Fixes #1415
2021-03-23Allow cmsg_space! to be used in unit testsLu, Wangshan
2021-03-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2021-03-05Allow sockaddr_ll size mismatchJustin Ossevoort
Apparently the Linux kernel can return smaller sizes when the value in the last element of sockaddr_ll (`sll_addr`) is smaller than the declared size of that field.
2021-03-04Remove accept4 on Android armAlan Somers
libc removed it in version 0.2.87. https://github.com/rust-lang/libc/pull/2079
2021-02-20Merge branch 'master' into timerfd-file-leakAlan Somers
2021-02-16Close file descriptor on drop in TimerFdChristopher Dumoulin
2021-02-15Port statfs to x32наб
2021-02-15Port timespec to x32наб
2021-02-15Port sysinfo to x32наб
2021-02-15Merge #1387bors[bot]
1387: fix(unsafe): remove unnecessary unsafe r=asomers a=matu3ba libc 0.2.82 exposes status signals with macros generating safe functions Co-authored-by: Jan Philipp Hafer <jan.hafer@rwth-aachen.de>
2021-02-14fix(unsafe): remove unnecessary unsafeJan Philipp Hafer
closes #1380 libc 0.2.82 exposes status signals with macros generating safe functions
2021-02-14cargo formatJan Philipp Hafer
2021-02-13Merge #1382bors[bot]
1382: Don't implement Clone on Dir, SignalFd, and PtyMaster r=asomers a=asomers Since they close their file descriptors on Drop, it's almost impossible to use Clone without creating a double-close situation. Also, check for EBADF in SignalFd::drop and Dir::drop. Co-authored-by: Alan Somers <asomers@gmail.com>
2021-02-07Don't implement Clone on Dir, SignalFd, and PtyMasterAlan Somers
Since they close their file descriptors on Drop, it's almost impossible to use Clone without creating a double-close situation. Also, check for EBADF in SignalFd::drop and Dir::drop.
2021-02-02Define *_MAGIC filesystem constants on Linux s390xJakob Naucke
Since rust-lang/libc is now using the correct data type on s390x (c_uint) for statfs constants, the s390x exemptions in the statfs MAGIC definitions like EXT4_SUPER_MAGIC can be removed. Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-01-04Add support for when receiving packetsJustin Ossevoort
2020-12-19Add fuchsia supportAmanda Tait
Allow nix to compile on Fuchsia by conditionally avoiding libc functionality that does not exist for Fuchsia.
2020-12-15feat(sys): High-level personality(2) wrappersWilliam Woodruff
Adds a high level `Persona` bitflags enum, as well as `personality::get()` and `personality::set()` for interacting with `libc::personality()`.
2020-12-14Remove SockLevelAlan Somers
It's been unused since PR #133
2020-11-27Fix recvmmsg(2) implementationToby DiPasquale
There were two problems discovered with the `recvmmsg(2)` implementation that this changeset attempts to fix: 1. As mentioned in nix-rust/issues/1325, `recvmmsg(2)` can return fewer messages than requested, and 2. Passing the return value of `recvmmsg(2)` as the number of bytes in the messages received is incorrect. This changeset incorporates the proposed fix from nix-rust/issues/1325, as well as passing the correct value (`mmsghdr.msg_len`) for the number of bytes in a given message.
2020-11-15Suppress time_t musl "deprecation"Tamir Duberstein
See https://github.com/rust-lang/libc/issues/1848 in which this type is changing from i32 to i64; the change is being announced via this deprecation.
2020-11-15Suppress af_alg_iv "deprecation"Tamir Duberstein
See https://github.com/rust-lang/libc/issues/1501 in which this type's trait implementations are being removed; the change is being announced via this deprecation.
2020-10-18KEEPCNT/KEEPINTVL aren't available on OpenBSD.Laurence Tratt
Without this commit, nix doesn't currently compile on OpenBSD. Some keepalive settings can be set globally, but not per-socket (see e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=970550 for some digging into this). Since it seems that NetBSD and DragonflyBSD have these settings, it makes more sense to only exclude them on OpenBSD rather than include them on (pretty much every) other operating systems.
2020-10-13Add wrapper for mremapJim Newsome
2020-10-10Add support for TCP_KEEPCNT and TCP_KEEPINTVL TCP keepalive options.Yoav Steinberg
2020-10-10Merge #1303bors[bot]
1303: Renable the ScmTimestamp test on FreeBSD i386 r=posborne a=asomers The relevant bug was fixed in 11.3-RELEASE https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222039 Co-authored-by: Alan Somers <asomers@gmail.com>
2020-10-04Support vsock on Android as well as Linux.Andrew Walbran
Fix deprecation warning from libc update.
2020-10-03Renable the ScmTimestamp test on FreeBSD i386Alan Somers
The relevant bug was fixed in 11.3-RELEASE https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222039
2020-10-03Add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP supportDominik Stolz
2020-09-28Added clock_gettime, clock_getres, clock_settime, clock_getcpuclockidDaniil Bondarev
2020-09-13Adapt for safe-isation of some libc functions.Vitaly _Vi Shukela
(https://github.com/rust-lang/libc/pull/1870) Denied lint being overridden instead of unsafe block removed to preserve compatibility with old `libc` versions.
2020-08-22Merge #1282bors[bot]
1282: `ioctl-number.rst` moved. Update the link. r=asomers a=SolraBizna <!-- This space deliberately left blank --> Co-authored-by: Solra Bizna <solra@bizna.name>
2020-08-18Add Netlink Protocol Families to SockProtocol enumsinkingpoint
Currently the SockProtocol enum is rather scarce. This commit adds the Netlink protocols defined in netlink(7) to the SockProtocol enum allowing us to use the Nix socket library for more indepth Netlink work
2020-08-13doc typo in fchmodated neville
fchmod should be fchmodat Signed-off-by: ed neville <ed@s5h.net>
2020-08-02`ioctl-number.rst` moved. Update the link.Solra Bizna
2020-07-25Merge #1224bors[bot]
1224: Update the Linux CI environment to Ubuntu Bionic r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com> Co-authored-by: Alan Somers <asomers@axcient.com>
2020-07-07Adding an implementation and some basic tests for timerfd.Vincent Dagonneau
Removed support for timerfd on Android as it seems to have been deprecated? See https://android.googlesource.com/platform/development/+/73a5a3b/ndk/platforms/android-20/include/sys/timerfd.h or https://github.com/rust-lang/libc/issues/1589 Removed the public status of `TimerSpec`, as it should not be exposed to the user. Implemented `FromRawFd` for `TimerFd` as it already implements `AsRawFd`. Addressed comments from the latest code review: - Removed upper bound assertions on timer expirations in tests. - Made the main example runnable and added code to show how to wait for the timer. - Refactored `ClockId` to use `libc_enum`. - Added comments for all public parts of the module. - Wrapped to 80 cols. - Changed the size of the buffer in the tests to the minimum required. * Ran rustfmt. * Added a `From` implementation for `libc::timespec` -> `TimeSpec`. * Reworked the example with the new changes and changed the timer from 5 to 1 second. * Added a constructor for a 0-initialized `TimerSpec`. * Added a new method to get the timer configured expiration (based on timerfd_gettime). * Added an helper method to unset the expiration of the timer. * Added a `wait` method to actually read from the timer. * Renamed `settime` into just `set`. * Refactored the tests and added a new one that tests both the `unset` and the `get` method. Modified CHANGELOG.
2020-07-04Expose IP_PKTINFO Control Message on AndroidBruno Tavares
The commit https://github.com/nix-rust/nix/pull/1222 added the very useful Ipv4PktInfo to allow `sendmsg` to define the origin of the ip. Unfortunattely, it didn't add the struct to Android target devices as well. This commit adds the `target_os = "android"` checks on the same place to allow the compilation to work for the following archs tested: - `cross build --target aarch64-linux-android` - `cross build --target x86_64-linux-android` - `cross build --target armv7-linux-androideabi` Also introduces iOS to allow using on libs for those platforms
2020-07-04Add FsType for cgroupfsKenta Tada
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-07-03Skip the OFD locks tests on OverlayFS and muslAlan Somers
OFD lock functions don't work as expected on overlayfs, which is a type of union file system. And OVERLAYFS_SUPER_MAGIC isn't defined on musl, at least not yet.
2020-06-27misc clippy cleanupAlan Somers
2020-06-27Make SockAddr::as_ffi_pair safeAlan Somers
It was only marked unsafe because it did a pointer cast, but that particular pointer cast is always allowed by C.
2020-06-27Prefer to pass Inotify by value instead of by referenceAlan Somers
It's small and `Copy`, so pass by value is more efficient. This is technically a breaking change, but most code should compile without changes.