Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
revents is an output field so regardless of what value it is set to it
will be overwritten by many of the function calls that take a PollFd.
The only value that makes sense for the caller to pass in in
`EventFlags::empty()` so we just hardcode that instead of making the
caller do it.
|
|
Also, fix style bug in AIO tests
|
|
If an AioCb has any in-kernel state, AioCb.drop will print a warning and
wait for it to complete.
|
|
Prevent immutable buffers from being used with aio_read or lio_listio
with LIO_READ. AioCb.from_slice no longer needs to be unsafe.
|
|
|
|
Add POSIX AIO support
POSIX AIO is a standard for asynchronous file I/O. Read, write, and
fsync operations can all take place in the background, with completion
notification delivered by a signal, by a new thread, by kqueue, or not
at all.
The SigEvent class, used for AIO notifications among other things, is
also added.
|
|
|
|
This introduces a wrapper for fchdir(2), allowing a process to change
directory based on an open file descriptor.
The underlying function is available in libc crate since 0.2.20.
|
|
|
|
|
|
POSIX AIO is a standard for asynchronous file I/O. Read, write, and
fsync operations can all take place in the background, with completion
notification delivered by a signal, by a new thread, by kqueue, or not
at all. This commit supports all standard AIO functions. However,
lio_listio is disabled on macos because it doesn't seem to work, even
though the syscall is present.
The SigEvent class, used for AIO notifications among other things, is
also added.
Also, impl AsRef for TimeVal and TimeSpec
|
|
|
|
|
|
r? @fiveop
|
|
|
|
|
|
Also, add trait TimeValLike, so some code can be shared between TimeSpec
and TimeVal.
|
|
test_getsockname used an IPv4 socket and assumed that localhost was
"127.0.0.1". But that assumption doesn't hold on IPv6-only hosts or on
shared-IP FreeBSD jails. Unfortunately, the Rust standard library
doesn't provide a good way to resolve localhost. So change the test to
use a unix-domain socket instead.
|
|
There were multiple errors regarding Unix domain sockets:
* UnixAddr::path assumed that gethostbyname and similar functions would
include the terminating null as part of len. That is not universally
true. In fact, POSIX only guarantees that len will be at least large
enough to store the non-null-terminated path. So it could be larger or
smaller than nix was assuming. Since abstract sockets' paths are not
strings, we can't modify gethostbyname. Instead, I implemented the fix in
UnixAddr::path and UnixAddr::new. I clarified the documentation too.
* SockAddr::as_ffi_pair contained a Linuxism.
* sockaddr_storage_to_addr forgot to adjust sun_len when creating a UnixAddr
|
|
Sometimes, on a heavily laden system, select would timeout and the test would
fail. Fix it by lengthening the timeout to 10s.
|
|
Get rid of a few test compilation warnings
Cleans up after 0fa7250b9575a2746519a854d0138c4c8255f109 and 40351db00da6ee8c904f47599ee692a85e3d96ef.
|
|
|
|
|
|
|
|
Looks like Travis allows bind mounts in their container infra now.
|
|
|
|
its documentation\!), checking the failure of a directory now
|
|
|
|
|
|
add unistd::getcwd and unistd::mkdir
As a (late) followup of [this withdrawn PR](https://github.com/rust-lang/libc/pull/326) I have added getcwd (wrapper around `libc::getcwd`) and mkdir (wrapper around `libc::mkdir`) and added testing.
A few notes:
- I'm new to rust so I would appreciate some pair of eyes testing the code, plus I'm open for revision of code or general remarks about my coding style
- I have run the tests both on OSX as on Linux (Ubuntu)
- I've run `clippy` to see if my code is well formatted, however clippy issues many warnings about the project. I think I didn't add any more warnings
- the methods in unistd are not documented so I also left out the documentation of `getcwd` and `mkdir`, although I think it'd probably be good to add some documentation, especially some example code how to use the methods
- the base idea of `getcwd` is [taken from std](https://github.com/rust-lang/rust/blob/1.9.0/src/libstd/sys/unix/os.rs#L95-L119), should I mention that somewhere?
|
|
|
|
against std::env::current_dir
|
|
the implementation in std
|
|
|
|
directory names, need to be created with mkdir first which doesn't exist yet)
|
|
expect into proper try handling), needs testing still
|
|
Replace ffi module by libc functions in mqueue.rs
This is almost finished. I still need to check if I introduced any breaking changes by changing signatures. I would want to record this in the change log, however, for that we still need to merge #391.
- [x] update change log
- [x] run rustfmt on `src/mqueue.rs`
|
|
|
|
|
|
|
|
llseek and lseek64
impl Whence
fixed formatting
awful typo when refactoring
no llseek
wrong test name
using off64_t
got rid of offset
Added SeekHole/Data; formatted test; SeekCur/Set/End use libc constants
|
|
|
|
|
|
|
|
unistd: Redesign the enum returned by fork()
This changes the name of the enum returned by `fork()` to `ForkResult`,
and changes the `Parent` variant to be struct-like.
The result can be matched like
use nix::unistd::ForkResult::*;
match fork().unwrap() {
Parent { child } => { ... }
Child => { ... }
}
using the shorthand matching syntax for struct-like enum variants.
This is a breaking change.
|
|
This commit changes the name of the enum returned by `fork()` to
`ForkResult`, and changes the `Parent` variant to be struct-like.
The result can be matched like
use nix::unistd::ForkResult::*;
match fork().unwrap() {
Parent { child } => { ... }
Child => { ... }
}
using the shorthand matching syntax for struct-like enum variants.
This is a breaking change.
|
|
Fixes #329
|