summaryrefslogtreecommitdiff
path: root/src/sys
AgeCommit message (Collapse)Author
2018-01-26Merge #843bors[bot]
843: Support arbitrary baud rates on BSDs r=asomers a=Susurrus Closes #842
2018-01-25Consistently use `Termios` in commentsBryant Mairs
2018-01-25Don't use map(drop) as it's hard to understandBryant Mairs
.map(drop) makes it seem like there is a need to drop the type at that point when really all you're doing is trying to erase the type information and return an empty tuple. So do that explicitly instead of throwing drop in there.
2018-01-25Support arbitrary baud rates on BSDsBryant Mairs
2018-01-26Merge #835bors[bot]
835: Add socket options for IP_TRANSPARENT / BIND_ANY r=asomers a=justinlatimer Add socket options for implementing a transparent proxy. Sources: [Linux](https://www.kernel.org/doc/Documentation/networking/tproxy.txt) [OpenBSD](https://man.openbsd.org/setsockopt.2#SO_BINDANY) [FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=ip&manpath=FreeBSD+11.1-RELEASE) Thanks!
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: more documentationAlan Somers
2018-01-15aio: Clippy cleanupAlan Somers
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-15Add AioCb::from_ptr and AioCb::from_mut_ptrAlan Somers
2018-01-11Add socket options for IP_TRANSPARENT / BIND_ANYJustin Latimer
2018-01-08Impl LinkAddr(MAC Addr)luozijun
2018-01-08impl `Debug` for all sockaddr typesluozijun
2018-01-06Add sigprocmaskThomas de Zeeuw
2017-12-20Replace boolean match with if/elseBryant Mairs
2017-12-20Don't clone Copy typesBryant Mairs
2017-12-20Remove redundant closureBryant Mairs
2017-12-20Replace '0 as *_' with ptr::null*()Bryant Mairs
2017-12-20Use backticks around types/functions in docsBryant Mairs
2017-12-20Use implicit returnsBryant Mairs
2017-12-20Remove unnecessary '@ _'Bryant Mairs
2017-12-20Use |= where appropriateBryant Mairs
2017-12-20Remove unnecessary impl ClonesBryant Mairs
2017-12-20Remove unnecessary lifetime annotationsBryant Mairs
2017-12-20Dereference in match head insteadBryant Mairs
2017-12-20Use unwrap_or_else instead of unwrap_or without a closureBryant Mairs
2017-12-20Remove unnecessary parenthesisBryant Mairs
2017-12-20Make numeric literals easier to readBryant Mairs
2017-12-20Merge redundant match armsBryant Mairs
2017-12-20Remove unnecessary referencesBryant Mairs
2017-12-20Make numeric literals easier to readBryant Mairs
2017-12-20Migrate sys/socket to libc FFI types and fix `msghdr` definition mismatch.Matthew Gregan
2017-12-19Merge #799bors[bot]
799: Fix nix on Dragonfly r=Susurrus a=mneumann This commit replaces pull request https://github.com/nix-rust/nix/pull/684. It fixes building `nix` on DragonFly. All tests pass. This requires most recent libc to build: https://github.com/rust-lang/libc/pull/851.
2017-12-19Fix support for DragonFlyMichael Neumann
* DragonFly does not have a O_DSYNC flag * Fix type_of_cmsg_data on DragonFly * No fexecve() on DragonFly * Do not run aio test cases on DragonFly * Keep target lists in alphabetical order * Unscrable #[cfg] directives and use cfg_if! macro instead * Fix errno on DragonFly Below follows an explanation why we have to use a C extension to get errno working on DragonFly: DragonFly uses a thread-local errno variable, but #[thread_local] is feature-gated and not available in stable Rust as of this writing (Rust 1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access it. Tracking issue for `thread_local` stabilization: https://github.com/rust-lang/rust/issues/29594 Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c, remove the build-dependency from Cargo.toml, and use: extern { #[thread_local] static errno: c_int; } Now all targets will use the build.rs script, but only on DragonFly this will do something. Also, there are no additional dependencies for targets other than DragonFly (no gcc dep).
2017-12-10Replace ip(v6)_mreq structs with libc equivalentBryant Mairs
2017-12-10Replace custom ucred struct with newtype wrapper around libc::ucredBryant Mairs
2017-12-10Use libc::lingerBryant Mairs
2017-12-10Migrate more bitflags to use libc_bitflags!Bryant Mairs
2017-12-10Add more derives for SignalFd and various enumsBryant Mairs
2017-12-11Merge #806bors[bot]
806: Cleanup all doc warnings r=asomers a=Susurrus With the impending switch to Pulldown as the default doc generator, warnings have been enabled for incompatible syntax. This fixes all of said warnings.
2017-12-10Cleanup doc warningsBryant Mairs
With the impending switch to Pulldown as the default doc generator, warnings have been enabled for incompatible syntax. This fixes all of said warnings.
2017-12-09Merge #741bors[bot]
741: Expose `decode` on `WaitStatus` and make it return a `Result` r=Susurrus a=rocallahan Closes #740.
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-05Expose `from_raw` on `WaitStatus` and make it return a `Result`Robert O'Callahan
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-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-12-01Fix UB in epoll_ctlBryant Mairs
When passing None as an argument to `epoll_ctl`, UB is elicited within the `Into<&EpollEvent>` impl because it passes a null pointer as a `&mut EpollEvent`. Instead we remove that implementation completely and handle this case directly within the `epoll_ctl` function. Thanks to Arnavion for helping to debug this.
2017-11-19sys/socket: add UnixAddr abstract name getterLuca Bruno
This introduces an `as_abstract()` getter to `UnixAddr` in order to retrieve the name of an abstract unix socket. This also adds tests around abstract addresses and clarify docs, adding explicit semantics.