summaryrefslogtreecommitdiff
path: root/src/lib.rs
AgeCommit message (Collapse)Author
2020-12-19Add fuchsia supportAmanda Tait
Allow nix to compile on Fuchsia by conditionally avoiding libc functionality that does not exist for Fuchsia.
2020-09-28Added clock_gettime, clock_getres, clock_settime, clock_getcpuclockidDaniil Bondarev
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-17Simply disable the dir module, since only the entry struct is availableXavier L'Heureux
2020-05-17Add pollXavier L'Heureux
2020-05-17Add Redox support for most of the modulesXavier L'Heureux
Some things are not implemented yet in redox, so a lot of annotations were added to remove functions when compiling for redox. Those functions will hopefully be added in time, but for now it's better to have partial support than none. Blocked by https://github.com/rust-lang/libc/pull/1438
2020-05-17Replace void crate with Rust standard lib Infallible typeOssi Herrala
std::convert::Infallible has been available since Rust 1.34 and nix currently targets Rust 1.36 or later so this should not cause problems. Fixes #1238
2020-05-16Don't implement `NixPath` for `Option<&P> where P: NixPath`Alan Somers
Most Nix functions that accept `NixPath` arguments can't do anything useful with `None`. The exceptions (`mount` and `quotactl_sync`) already take explicitly optional arguments. Also, this changes the behavior of `mount` with `None` arguments. Previously, it would call mount(2) with empty strings for those arguments. Now, it will use null pointers.
2020-02-11Provide clearenv()John Gallagher
2019-12-29remove deprecated Error::descriptionRadyk Andrii
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-08-29Clippy cleanupAlan Somers
2019-07-13Temporarily allow deprecated itemsAlan Somers
This fixes the tests on Rust 1.38.0. We'll fix them for real after release 0.15.0. Issue #1096
2019-07-01Move cross compilation cfg for sched into sched modJakub Konka
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2019-06-07ifaddrs: add ifaddrs support for androidPaul Osborne
Support under bionic/android is the same as under Linux for what is exposed by this code. Signed-off-by: Paul Osborne <osbpau@gmail.com>
2018-11-23Add Error::as_errnoAlan Somers
This method is useful when it can be statically determined that a nix::Error be an errno, which I find to be very common.
2018-09-05Add wrapper for linux kernel module loadingPascal Bach
- init_module and finit_module to load kernel modules - delete_module to unload kernel modules Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
2018-09-03new dir moduleScott Lamb
This is a lower-level interface than `std::fs::ReadDir`. Notable differences: * can be opened from a file descriptor (as returned by `openat`, perhaps before knowing if the path represents a file or directory). Uses `fdopendir` for this, available on all Unix platforms as of rust-lang/libc#1018. * implements `AsRawFd`, so it can be passed to `fstat`, `openat`, etc. * can be iterated through multiple times without closing and reopening the file descriptor. Each iteration rewinds when finished. * returns entries for `.` (current directory) and `..` (parent directory). * returns entries' names as a `CStr` (no allocation or conversion beyond whatever libc does).
2018-03-22Replace AioCb::from_bytes with more generic from_boxed_sliceAlan Somers
Supporting the bytes crate was unnecessarily specific. This change replaces from_bytes and from_bytes_mut with from_boxed_slice and from_boxed_mut_slice, which can work with anything that implements Borrow<[u8]> and BorrowMut<[u8]>, respectively.
2018-02-02Re-add ifaddrs moduleBryant Mairs
Mistakingly removed in d1be45d8405
2018-01-28Fail to compile for any unused codeBryant Mairs
2018-01-28Clean up imports and uses in lib.rsBryant Mairs
2018-01-28Require docs for features and ifaddrs moduleBryant Mairs
2018-01-28Require docs for the net/if_ moduleBryant Mairs
2018-01-28Require docs for the poll moduleBryant Mairs
2018-01-28Deny missing docs for pty moduleBryant Mairs
2018-01-28Require Debug impls for all typesBryant Mairs
2018-01-28Implement Copy/Clone for all types missing itBryant Mairs
2018-01-28Disallow unnecessary import bracesBryant Mairs
2018-01-28Prevent the use of unstable compiler featuresBryant Mairs
2018-01-28Deny unused qualificationsBryant Mairs
2018-01-21Merge #820bors[bot]
820: Change AioCb to primarily use Bytes instead of Rc<[u8]> r=Susurrus a=asomers `Rc<[u8]>` isn't a very good buffer type to use for aio. For one thing, it lacks interior mutability. For another, a single `Rc<[u8]>` can't be carved up into smaller buffers of the same type. `Bytes` and `BytesMut` fix both problems. This PR removes the ability to construct an `AioCb` from `Rc<[u8]>` and adds the ability to construct one from `Bytes`, `BytesMut`, or raw pointers (for consumers who need even more flexibility). At this stage, the PR has the following warts: 1. A hack is necessary to force small `Bytes` buffers to allocate on the heap. I plan to fix this with an enhancement to the bytes crate. 2. The `AioCb::buffer` method is necessary due to a deficiency in the tokio-core crate. Once I fix that, then only `AioCb::into_buffer`will need to be public.
2018-01-15aio: use `Bytes` instead of `Rc<[u8]>`Alan Somers
It's not actually safe to read into an `Rc<[u8]>`. It only worked because of a coincidental `unsafe` block. Replace that type with `BytesMut` from the bytes crate. For consistency's sake, use `Bytes` for writing too, and completely remove methods relating to `Rc<[u8]>`. Note that the `AioCb` will actually own the `BytesMut` object. The caller must call `into_buffer` to get it back once the I/O is complete. Fixes #788
2018-01-10Expose mqueue functions for all supported OSesAlan Somers
2017-12-20Dereference in match head insteadBryant Mairs
2017-12-05Remove nix-test subcrateBryant Mairs
This was doing testing for errno constants and a few other types that is no longer necessary now that these types are all tested within the libc project itself.
2017-12-05Merge #696bors[bot]
696: Stop reexporting `Errno` variants r=Susurrus a=jonas-schievink Closes #664 (unsure if this is everything needed)
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-12-03Add support for getifaddrs. Closes: #650.Markus Wanner
2017-07-26add poll module for all platformsNicolas Dusart
2017-07-25Merge #694bors[bot]
694: Remove workaround for `pub extern crate` r=asomers On semi-recent Rust versions (I think 1.8+) this now works properly. Closes #655
2017-07-20Remove workaround for `pub extern crate`Jonas Schievink
On semi-recent Rust versions (I think 1.8+) this now works properly.
2017-07-19Remove c_int and c_void from rootBryant Mairs
These were exported for some weird reason and then left in for documentation. Also some parts of certain modules used them and others used the libc:: prefix. This was removed to improve the docs and also code consistency
2017-06-13Added ptrace utilities.Daniel McKenna
Some ptrace functions return structures through the data argument. This commit adds utilities to return data through this mechanism and function specialisations for a few of these functions (getting event messages or the siginfo_t struct). Once the next version of libc is released these utilities will be expanded to include the fpregs and user_regs structs. Ptrace requests that are now satisfied by a more specific public function will return an unsupported operation error. This has involved adding an UnsupportedOperation to the nix::Error enum and removed the mapping from Error to Errno and from Error to std::io::Error.
2017-05-16Add various pty functionsBryant Mairs
* grantpt * ptsname/ptsname_r * posix_openpt * unlockpt
2017-02-19Fix the style for bitflags!Mathias Svensson
Prefer libc_bitflags! over bitflags!. Prefer libc::CONSTANTS over writing the constant manually.
2016-10-27error: add documentation for nix::ErrorPaul Osborne
Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
2016-08-31Replace ffi module by libc functions in mqueue.rsPhilipp Matthias Schaefer
2016-06-06Only deny warnings in testKamal Marhubi
This prevents us breaking builds under newer Rust versions with additional warnings.