summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-04-14Add space to doc comment of fdsRoss Light
2020-04-13Operate on &mutRoss Light
2020-04-11Remove unnecessary fn main wrapper in exampleRoss Light
2020-04-07Add select::FdSet::fds() methodRoss Light
2020-04-06unistd: avoid infinite loop caused by reserve_double_buffer_sizeSteven Danna
Functions such as Group::from_anything use reserve_double_buffer_size in a loop, expecting it to return ERANGE if the passed limit is reached. However, the returned vector is passed as pointer to a libc function that writes data into memory and doesn't update the length of the Vec. Because of this, the previous code would never return ERANGE and the calling loops would never exit if they hit a case where the required buffer was larger than the maximum buffer. This fixes the problem by checking the capacity rather than the length. Signed-off-by: Steven Danna <steve@chef.io>
2020-04-02Enable getregs/setregs on muslcoord.e
Update CHANGELOG for #1198
2020-03-28Fix fallocate return typeDiana
Untested, done on github. Fixes #1200
2020-03-08Fix a lint on Rust nightly 1.43.0Alan Somers
2020-03-03Derive `Ord`, `PartialOrd` for `Pid`Joe Ranweiler
2020-02-29add setfsuid and setfsgid implementation for filesystem checksMarco Conte
2020-02-13Make FsType's raw type publicMikail Bagishov
2020-02-11Provide clearenv()John Gallagher
2020-02-02Merge #1176bors[bot]
1176: Add RISC-V support on GNU/Linux r=asomers a=msizanoen1 Co-authored-by: msizanoen1 <qtmlabs@protonmail.com>
2020-01-23ioctl: Fix broken link to the kernel documentationSimon Chopin
The file documenting ioctl number assignment in the Linux kernel has been converted to ReStructuredText (see https://lwn.net/Articles/705224/ for some background), the file extension has naturally changed.
2020-01-12Add CLK_TCK to SysconfVarCaleb Bassi
http://man7.org/linux/man-pages/man3/sysconf.3.html says that the corresponding variable is obsolete, but I think that just means the constant defined in limits.h is obsolete. Checking the value using sysconf is still valid.
2020-01-12Add RISC-V support on GNU/Linuxmsizanoen1
2019-12-29remove deprecated Error::descriptionRadyk Andrii
2019-12-22Fix the build on OpenBSD.Alan Somers
We were assuming the wrong types for f_iosize and f_ffree in struct statfs on OpenBSD. Fixes #1125
2019-12-01ScmCredentials now wraps UnixCredentials instead of libc::ucredAlan Somers
2019-12-01Reenable a test that had been disabled due to old CI infrastructureAlan Somers
2019-12-01Remove some obsolete comments.Alan Somers
ignore really is the correct things to do for these doc tests. compile_fail should only be used for examples that demonstrate a compile failure by design, not for stuff that only works on one platform.
2019-12-01impl TryFrom<libc::speed_t> for BaudRateAlan Somers
The old From implementation was actually falliable, and would panic on failure.
2019-12-01Remove the last use of mem::uninitializedAlan Somers
Replace it with mem::zeroed. It isn't perfect, but it's better than it was. Issue #1115
2019-12-01Merge #1156bors[bot]
1156: Remove the deprecated CmsgSpace r=asomers a=asomers This eliminates one of the last remaining uninitialized memory accesses in Nix. Fixes #1142 Co-authored-by: Alan Somers <asomers@gmail.com>
2019-11-30Remove the deprecated CmsgSpaceAlan Somers
This eliminates one of the last remaining uninitialized memory accesses in Nix. Fixes #1142
2019-12-01Allow signal injection in ptrace::{syscall, detach}Francisco Giordano
2019-11-21Implement sched::sched_getaffinity()Thibaut Ackermann
sched_getaffinity(2) get a process's CPU affinity mask
2019-11-17ptrace: add ptrace::seize for LinuxJeremy Fitzhardinge
2019-11-03Implment linkatJohnnie Birch
This adds the linkat function which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/linkat.html and widely implmented on Unix-Family platforms. Add back trailing whitespace removed on previous force push
2019-11-02Merge #1151bors[bot]
1151: sys: termios: Fix inverted logic for [cfg()] conditional for sparc64 r=asomers a=glaubitz The fix for #1149 has the logic for the [cfg()] conditional inverted so that the aliases for VMIN and VTIME are defined on targets that are not linux-sparc64. Co-authored-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
2019-11-02sys: termios: Use associated constants for VMIN and VTIME on sparc64John Paul Adrian Glaubitz
2019-11-02Fix a warning with the latest nightly compilerAlan Somers
The latest compiler warns about unnecessary parentheses in a position that previous compilers ignored.
2019-11-01sys: termios: Fix inverted logic for [cfg()] conditional for sparc64John Paul Adrian Glaubitz
The fix for #1149 has the logic for the [cfg()] conditional inverted so that the aliases for VMIN and VTIME are defined on targets that are not linux-sparc64.
2019-11-01Merge #1139bors[bot]
1139: Add `Users` and `Group` related functions r=asomers a=otavio This was a collaborative work between Johannes Schilling <dario@deaktualisierung.org>, Fredrick Brennan <copypaste@kittens.ph> and myself. This PR is a split-off from #864 so we merge ready parts first. Next, we work on the iterators. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
2019-11-01sys: termios: Define VMIN and VTIME as VEOF and VEOL on sparc64John Paul Adrian Glaubitz
On sparc64, glibc defines VMIN as VEOF and VTIME as VEOL for termios, so we need to inherit these alias definitions for nix-rust as well. Fixes #1149
2019-10-30Add `Users` and `Group` related functionsOtavio Salvador
This was a collaborative work between Johannes Schilling <dario@deaktualisierung.org>, Fredrick Brennan <copypaste@kittens.ph> and myself. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-10-29Merge #1138bors[bot]
1138: Add Signal::as_str() to get representation as static string r=asomers a=MikailBag # Motivation Currently string representation of signal can be obtained with AsRef<str> impl. But it has downside: returned string's lifetime is bound to lifetime of signal, so &str must be converted to String. This allocation is avoidable, because as_ref() only returns static strings. To fix this problem, my PR adds Signal::as_str() method, which returns static string. Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru>
2019-10-29Implement Signal::as_str()Mikail Bagishov
2019-10-28Fix sys::socket::recvfrom for TCP socketsAlan Somers
recvfrom(2) only returns the sender's address for protocols that provide it. Usually, that means it returns the sender's address for datagram sockets but not for stream sockets. Fixes #1144
2019-10-21fix documentation typo for effective gidScott Schroeder
2019-10-15Properly initialize msghdr when using muslYuxuan Shui
Because of the use of MaybeUninit::uninit, the padding fields in msghdr, which only present on musl builds, are not initialized. Causing garbage data to be sent to the kernel. This change ensures the paddings are always zeroed.
2019-09-30refactored test casesZhang Miaolei
ignore mkfifoat in OSX and andriod
2019-09-30add mkfifoatZhang Miaolei
2019-09-28Merge #1121 #1130bors[bot]
1121: Fix #1093 r=asomers a=tathanhdinh Hello, This PR fixes the problem discovered in #1093. Thanks for any comment. 1130: unistd: getgrouplist: Rework code to use `reserve_double_buffer_size` r=asomers a=otavio The buffer resize logic can be simplified reusing the `reserve_double_buffer_size` method. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Co-authored-by: Ta Thanh Dinh <tathanhdinh@gmail.com> Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
2019-09-28Merge #1105bors[bot]
1105: posix_fallocate support r=asomers a=dingxiangfei2009 This PR add [`posix_fallocate`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html), which is available on - Linux - FreeBSD - Android - Emscripten - Fuchsia - WASI Here is a question: for some reason, `posix_fallocate` returns `EBADF` instead of `EPIPE` if a FIFO file descriptor is passed in on Linux 4.19.64. In the test `EBADF` is used for now, but I would like to know if such behaviour is expected. Co-authored-by: Ding Xiang Fei <dingxiangfei2009@gmail.com>
2019-09-25unistd: getgrouplist: Rework code to use `reserve_double_buffer_size`Otavio Salvador
The buffer resize logic can be simplified reusing the `reserve_double_buffer_size` method. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-09-25unistd: getgroups: Resize buffer up to NGROUPS_MAXOtavio Salvador
Use `reserve_double_buffer_size` up to NGROUPS_MAX as limit. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-09-25unistd: getgroups: Rework variable namesOtavio Salvador
We are preparing the use of `reserve_double_buffer_size` but for this, some logic need to be reworked so we are doing some rename preparing for the next patch which adds its use. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-09-23fix #1093Ta Thanh Dinh
2019-09-21unistd: getcwd: Double the buffer when need, up to PATH_MAX as limitOtavio Salvador
We now have a `reserve_double_buffer_size` method which reserves the double of buffer, up to a limit, allowing it to be reused on other methods in future. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>