Age | Commit message (Collapse) | Author |
|
|
|
|
|
Replace it with mem::zeroed. It isn't perfect, but it's better than it
was.
Issue #1115
|
|
|
|
This fixes the tests on Rust 1.38.0. We'll fix them for real after
release 0.15.0.
Issue #1096
|
|
|
|
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.
|
|
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>
|
|
This method is useful when it can be statically determined that a
nix::Error be an errno, which I find to be very common.
|
|
- init_module and finit_module to load kernel modules
- delete_module to unload kernel modules
Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
|
|
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).
|
|
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.
|
|
Mistakingly removed in d1be45d8405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
|
|
|
|
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.
|
|
696: Stop reexporting `Errno` variants r=Susurrus a=jonas-schievink
Closes #664 (unsure if this is everything needed)
|
|
cc #664 (unsure if this is everything needed)
|
|
|
|
|
|
694: Remove workaround for `pub extern crate` r=asomers
On semi-recent Rust versions (I think 1.8+) this now works properly.
Closes #655
|
|
On semi-recent Rust versions (I think 1.8+) this now works properly.
|
|
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
|
|
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.
|
|
* grantpt
* ptsname/ptsname_r
* posix_openpt
* unlockpt
|
|
Prefer libc_bitflags! over bitflags!. Prefer libc::CONSTANTS over
writing the constant manually.
|
|
Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
|
|
|
|
This prevents us breaking builds under newer Rust versions with
additional warnings.
|
|
|
|
Add context module.
The module wraps context handling related functions and structs.
|
|
We define many bitflags types with values from the libc crate. Currently
these look like this:
bitflags!{
flags ProtFlags: libc::c_int {
const PROT_NONE = libc::PROT_NONE,
const PROT_READ = libc::PROT_READ,
const PROT_WRITE = libc::PROT_WRITE,
const PROT_EXEC = libc::PROT_EXEC,
#[cfg(any(target_os = "linux", target_os = "android"))]
const PROT_GROWSDOWN = libc::PROT_GROWSDOWN,
#[cfg(any(target_os = "linux", target_os = "android"))]
const PROT_GROWSUP = libc::PROT_GROWSUP,
}
}
There's some repetition which is tedious. With the new macro, the above
can instead be written
libc_bitflags!{
flags ProtFlags: libc::c_int {
PROT_NONE,
PROT_READ,
PROT_WRITE,
PROT_EXEC,
#[cfg(any(target_os = "linux", target_os = "android"))]
PROT_GROWSDOWN,
#[cfg(any(target_os = "linux", target_os = "android"))]
PROT_GROWSUP,
}
}
Thanks to Daniel Keep for the Little Book of Rust Macros, and for
helping with this macro.
Refs https://github.com/nix-rust/nix/issues/264
|
|
The module wraps context handling related functions and structs.
|
|
With rust 1.7, the following warning was being emitted by the compiler:
warning: `pub extern crate` does not work as expected and should
not be used. Likely to become an error. Prefer `extern crate` and
`pub use`.
Based on https://github.com/rust-lang/rust/issues/26775 it appears that
the warning in 1.7 which was to be escalated to an error is going away
but in older versions of rust it is still the case that `pub extern crate`
will not work as expected. Instead, we use a somewhat creative hack to
export the libc root as a module in nix. Down the line, it may make
sense to either eliminate the need to export libc (by chaning the ioctl
macros) or to move toward deprecated older versions of rustc.
Signed-off-by: Paul Osborne <osbpau@gmail.com>
|
|
Refs https://github.com/nix-rust/nix/issues/264
|
|
|
|
|