summaryrefslogtreecommitdiff
path: root/test/sys
AgeCommit message (Collapse)Author
2017-01-26Auto merge of #483 - asomers:aio2, r=posborneHomu
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.
2017-01-25Add PhantomData to AioCb to track buffer's lifetimeAlan Somers
2016-12-19fix all and update CHANGELOG.mdqupeng
2016-12-19Merge branch 'nix-rust'qupeng
2016-12-16Add POSIX AIO supportAlan Somers
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
2016-12-12epoll: improve EpollEvent::empty() by using mem::uninitialized.qupeng
2016-12-11test/mod.rs: only test epoll on linux.qupeng
2016-12-11fix #480 and add simple test cases for that.qupeng
r? @fiveop
2016-12-10Add support for system control sockets for XNUConrad Kramer
2016-12-10Add ioctl support for BSDConrad Kramer
2016-11-19Add TimeSpec, a Newtype around libc::timespecAlan Somers
Also, add trait TimeValLike, so some code can be shared between TimeSpec and TimeVal.
2016-11-18Improve portability of test_getsocknameAlan Somers
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.
2016-11-18Fix Unix domain sockets.Alan Somers
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
2016-11-16Fix intermittency in test_selectAlan Somers
Sometimes, on a heavily laden system, select would timeout and the test would fail. Fix it by lengthening the timeout to 10s.
2016-11-15Auto merge of #466 - fiveop:warnings, r=posborneHomu
Get rid of a few test compilation warnings Cleans up after 0fa7250b9575a2746519a854d0138c4c8255f109 and 40351db00da6ee8c904f47599ee692a85e3d96ef.
2016-11-14Get rid of a few test compilation warningsPhilipp Matthias Schaefer
2016-11-14Make signal argument to kill optionalPhilipp Matthias Schaefer
2016-10-23use tempfile in test_pwrite.Alan Somers
2016-03-31Auto merge of #332 - kamalmarhubi:fork-enum, r=fiveopHomu
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.
2016-03-30unistd: Redesign the enum returned by fork()Kamal Marhubi
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.
2016-03-30socket: Respect IPv6 flowinfo and scope_id in InetAddr::from_stdKamal Marhubi
Fixes #329
2016-03-30Use pause(2) in test_wait_signalKamal Marhubi
Replace a busy loop with a call to `pause(2)`.
2016-02-20select: allow infinite timeoutNikolay Amiantov
2016-01-29Convert MSG_ flags to bitflags! type.Philipp Matthias Schaefer
2016-01-29Add tests for sockopt (SndBuf, RcvBuf, SndBufForce, RcvBufForce)Frank Denis
2016-01-18update libc to 0.2.2Mattis Marjak
2016-01-13Use tempdir for temporary files in testsKamal Marhubi
2016-01-13Fix compiler warnings in testsKamal Marhubi
2015-10-28Fix handling of sockaddr_un lengthsGeoffrey Thomas
The returned length of AF_UNIX sockaddrs is significant, and generally does not match the length of the entire structure. For filesystem sockets, this is ignorable because the path is also NUL-terminated, but for unbound sockets (e.g., a socketpair) or abstract-namespace sockets (a Linux extension where the address is an arbitrary bytestring), we need to keep track of the length. Fixes #177. Also add a UnixAddr::new_abstract function and some better handling of abstract-namespace socket addresses to fix #169.
2015-10-20Only run signalfd tests when feature is setCarl Lerche
2015-10-07Add sys::select::FdSet::clear.Utkarsh Kukreti
2015-10-06Add support for sendmsg(2), recvmsg(2), and cmsg(3)Geoffrey Thomas
The best specification for control message layout appears to be [RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4), despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64. The API differs a bit from the cmsg(3) API for type-safety reasons (and also because the cmsg(3) API is terrible). See test/sys/test_socket.rs for an example. Only supports SCM_RIGHTS at the moment. Fixes #88.
2015-09-28Revert "Add support for sendmsg(2), recvmsg(2), and cmsg(4)"Carl Lerche
This reverts commit 046af7d1ba82506f9bc48e62ac0584361025fc02.
2015-09-28Add sys::select::FdSet and sys::select::select.Utkarsh Kukreti
2015-09-24Add support for sendmsg(2), recvmsg(2), and cmsg(4)Geoffrey Thomas
The best specification for control message layout appears to be [RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4), despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64. The API differs a bit from the cmsg(4) API for type-safety reasons (and also because the cmsg(4) API is terrible). See test/sys/test_socket.rs for an example. Only supports SCM_RIGHTS at the moment. Fixes #88.
2015-08-12ioctl: return result type rather than raw integerPaul Osborne
This change also adds macro usages in the tests. Nothing is asserted but the use of the macros provides a basic compile-time check that is otherwise missing. Signed-off-by: Paul Osborne <osbpau@gmail.com>
2015-08-12conditionally enable ioctl test for linuxCorey Richardson
2015-08-12Fix testsCorey Richardson
2015-07-27Make it compatible for Android.Tim JIANG
* Fixed an unused_import error in `termios.rs` for Android. * Fixed undefined references to `preadv` and `pwritev` for Android - At least they don't exist from API level 3 to 21. * Fixed the uid > 0 and gid > 0 checks in `stat`'s tests - Running the tests by root is possible, especially when running on a rooted Android device. Those changes made rust-nix buildable (again) on Android. All the tests passed as well.
2015-07-13Add status to WaitStatusJoseph Kain
* Extend the enums in WaitStatus to include all process states (signaled, stopped, exited, continued). * Decode status from waitpid * Return appropate WaitStatus * Update tests to use the new WaitStatus * Add new tests for specific status values
2015-07-13Add support for preadv and pwritev to sys/uio on Linux.Trip Volpe
2015-07-04Fix off-by-one error calling Rng::gen_rangeJoseph Kain
Fix the boundary condition so that we never call Rng::gen_range(64, 64). Helps #144
2015-06-05Add pwrite and preadFlorian Hartwig
2015-05-21Test sockopt const valuesCarl Lerche
2015-05-12ioctl: implement generic support for the ioctl syscall and supporting functionsPaul Osborne
This commit provides a new implementation for ioctl that is much more generic, allowing for clients to use send any manner of ioctl requests at special files. The implementation provides two main features that help to raise the level of abstraction over that provided by libc. 1. The module now provides functions that provide the same functionality as the linux kernel _IO* macros. These are used frequently in the linux kernel for building ops for ioctls. The use of these helper functions are not required. 2. Functions are provided for the 3 main types of ioctl usage patterns (read, write, and execute). For many subystems, the read() call which returns a Result<T> and the write calls taking a &T provide a nice interface. All of the methods wrapping ioctl are unsafe and will probably need to remain that way unless knowledge of the semantics of every possible ioctl call are added to the nix library. The best that exists for ioctls are some conventions around the op, but even these conventions are really only used for newer devices added to the kernel. This change resolves #108
2015-05-05feat: add execvpeQingping Hou
2015-04-11Add socketpairFlorian Hartwig
2015-04-01Remove usage of std::num::IntCarl Lerche
2015-03-28Track Rust nightlyCarl Lerche
2015-03-25Tweak conversion in testCarl Lerche