summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-05-31libc::uint8_t deprecated in favor of rust u8Johannes Schilling
2019-05-25Merge #1066bors[bot]
1066: Allow import of Linux macros in Rust2018 r=asomers a=Susurrus Finish off the work started in 8c9ac5a70 allowing the use of macros without needing to import local inner macros for Linux targets. Co-authored-by: Bryant Mairs <bryant@mai.rs>
2019-05-24Allow import of Linux macros in Rust2018Bryant Mairs
Finish off the work started in 8c9ac5a70 allowing the use of macros without needing to import local inner macros.
2019-05-23Merge #1065bors[bot]
1065: Update fcntl.rs r=asomers a=kubkon Just a minor typo in the docs of `O_RDWR`. It read: ``` /// Allow both reading and writing. /// /// This should not be combined with `O_WRONLY` or `O_RDWR`. O_RDWR; ``` but I believe it should read ``` /// Allow both reading and writing. /// /// This should not be combined with `O_WRONLY` or `O_RDONLY`. O_RDWR; ``` instead :-) Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2019-05-23Update fcntl.rsJakub Konka
Just a minor typo in the docs of `O_RDWR`. It read: ``` /// Allow both reading and writing. /// /// This should not be combined with `O_WRONLY` or `O_RDWR`. O_RDWR; ``` but I believe it should read ``` /// Allow both reading and writing. /// /// This should not be combined with `O_WRONLY` or `O_RDONLY`. O_RDWR; ``` instead :-)
2019-05-22Merge #1061bors[bot]
1061: Release v0.14.0 r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2019-05-21Release v0.14.0Alan Somers
2019-05-18Merge #1050bors[bot]
1050: Implement `sched_yield`. r=asomers a=sunfishcode This adds the `sched_yield` function, which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html and widely implemented on Unix-family platforms. Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2019-05-17[skip ci] add missing CHANGELOG entry for PR #1055Alan Somers
2019-05-18Merge #1054bors[bot]
1054: Remove a redundant "use libc" r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2019-05-17Implement `sched_yield`.Dan Gohman
This adds the `sched_yield` function, which is part of POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html and widely implemented on Unix-family platforms.
2019-05-17Remove a redundant "use libc"Alan Somers
2019-05-17Merge #1055bors[bot]
1055: Fix build on arm and s390x after recent libc changes r=asomers a=asomers libc just removed some symbols on linux/arm32 and linux/s390x that never should've been defined in the first place. https://github.com/rust-lang/libc/commit/24f8972b8d2d915b1687fc8197e1ed95e349a82e https://github.com/rust-lang/libc/commit/d2695436ba5072078796c76f727a296e0f43caa6 Co-authored-by: Alan Somers <asomers@gmail.com>
2019-05-17Fix build on arm and s390x after recent libc changesAlan Somers
libc just removed some symbols on linux/arm32 and linux/s390x that never should've been defined in the first place. https://github.com/rust-lang/libc/commit/24f8972b8d2d915b1687fc8197e1ed95e349a82e https://github.com/rust-lang/libc/commit/d2695436ba5072078796c76f727a296e0f43caa6
2019-05-05Merge #1048bors[bot]
1048: Restored the bytes field on RecvMsg r=asomers a=vdagonneau This pull request restores the `bytes` field on the `RecvMsg` structure in order to be able to know the amount of bytes read during a call to `recvmsg`. Co-authored-by: Vincent Dagonneau <vincentdagonneau@gmail.com>
2019-04-29Restored the bytes field on RecvMsg in order to know the amount of bytes ↵Vincent Dagonneau
received using recvmsg.
2019-04-23Merge #1042bors[bot]
1042: pty: Add forkpty r=asomers a=keur Co-authored-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-04-23pty: Add forkptyKevin Kuehler
2019-04-22Merge #1046bors[bot]
1046: Remove duplicate use statements on macOS. r=asomers a=pusateri nix current compiles on 1.34.0 stable but not on 1.36.0 nightly because of duplicate use statements. This trivial change removes the duplicates so it compiles and the tests run successfully on 1.36.0 nightly (33fe1131c 2019-04-20) Co-authored-by: Tom Pusateri <pusateri@bangj.com>
2019-04-21Remove duplicate use statements on macOS.Tom Pusateri
2019-04-20Merge #1045bors[bot]
1045: Add a access(2) wrapper r=asomers a=snsmac Co-authored-by: jr <semi1@posteo.de>
2019-04-20Add a access(2) wrapperjr
2019-04-14Merge #1044bors[bot]
1044: Add unistd::{seteuid,setegid} r=asomers a=jmmv This is for the benefit of those platforms that do not provide setresuid nor setresgid, like macOS. Co-authored-by: Julio Merino <julio@meroh.net>
2019-04-12Merge #1041bors[bot]
1041: allow importing macros without helpers in the 2018 edition r=asomers a=euclio ~This PR adds the `$crate::` prefix to all uses of helper macros, which will allow users of the 2018 edition to import the macros without needing to also import their helpers.~ See https://doc.rust-lang.org/edition-guide/rust-2018/macros/macro-changes.html#macros-with-crate-prefix for more info. ~While this is a cleaner solution than using `#[macro_export(local_inner_macros)]`, it also requires bumping the minimum supported compiler version to 1.30. If this is acceptable, I'll add a commit to update the Travis configuration and docs.~ This PR now uses `local_inner_macros` to preserve compatibility with the current minimum Rust version. Co-authored-by: Andy Russell <arussell123@gmail.com>
2019-04-11Add unistd::{seteuid,setegid}Julio Merino
This is for the benefit of those platforms that do not provide setresuid nor setresgid, like macOS.
2019-04-11Merge #1043bors[bot]
1043: Uncomment to_std and from_std methods for IpAddr r=asomers a=rabbott99 These were commented out in 2b60633c8bdd5359c317bb74e698777106befb85, apparently because `std::net::IpAddr` had been removed from the standard library. However, `IpAddr` has since been re-added to the standard library (https://github.com/rust-lang/rust/pull/23711) and stabilized (https://github.com/rust-lang/rust/pull/31438), so it seems there is no reason to keep them commented out. Co-authored-by: rabbott99 <rabbott4927@gmail.com>
2019-04-09Uncomment to_std and from_std methods for IpAddrrabbott99
2019-04-04export helper macros via `local_inner_macros`Andy Russell
This will allow users of the 2018 edition to import the macros without needing to also import their helpers.
2019-03-29Merge #1036bors[bot]
1036: Add several errno values for OpenBSD r=asomers a=sourgrasses It looks like OpenBSD added several new errno values in 6.2, and they've already been added to `libc`, so this should allow any crates using those to build on OpenBSD. Co-authored-by: Jenn Wheeler <jwheeler@antiochcollege.edu>
2019-03-29add errno constants for OpenBSD 6.2 and format long linesJenn Wheeler
2019-03-29Merge #969bors[bot]
969: Add ENOTSUP to Linux and Android r=asomers a=jmmv While ENOTSUP is defined as equal to EOPNOTSUPP on these platforms, exposing the ENOTSUP symbol (as libc does) allows for writing portable code that may want to reference this error code. Co-authored-by: Julio Merino <jmmv@google.com>
2019-03-28Add ENOTSUP to Linux and AndroidJulio Merino
While ENOTSUP is defined as equal to EOPNOTSUPP on these platforms, exposing the ENOTSUP symbol (as libc does) allows for writing portable code that may want to reference this error code.
2019-03-16Merge #1034bors[bot]
1034: Add killpg r=asomers a=DanSnow It's seem that #644 is inactively about 1 year. But I really want this API that can land in nix. Actually I not really understand how to check the availability of an API for other platform except Linux. But I saw that this API in `libc` is wrapping inside a `#[cfg(unix)]`. So I don't need to add any `#[cfg]` on this API, am I right? Resolved #644 Co-authored-by: DanSnow <dododavid006@gmail.com>
2019-03-16feat: Add killpgDanSnow
2019-03-16Merge #1031bors[bot]
1031: Add AF_ALG socket types and related control mesages and sockopts on Linux and Andorid r=asomers a=glebpom Co-authored-by: Gleb Pomykalov <gleb@lancastr.com>
2019-03-12Support AF_ALGGleb Pomykalov
2019-03-06Merge #1016bors[bot]
1016: Added inotify bindings. r=asomers a=vdagonneau Hi ! I needed inotify bindings and noticed that nix did not have any so here is a PR to add it. There was another PR from 2015 to add support for inotify that was never merged. I took some of the feedback and applied it here. Co-authored-by: Vincent Dagonneau <vincentdagonneau@gmail.com>
2019-03-04Merge #1033bors[bot]
1033: Fix the tests with libc 0.2.49 and Rust 1.33.0 r=asomers a=asomers Several symbols are now marked as deprecated on OSX. Co-authored-by: Alan Somers <asomers@gmail.com>
2019-03-03Reenable test_sigwait on OSXAlan Somers
It was disabled long ago and nobody remembered to reenable it. I'm guessing it's fixed by now.
2019-03-03Delete a useless unit test that never did anything.Alan Somers
2019-03-03Fix test_thread_signal* test failures with Cargo 1.33.0Alan Somers
Previous versions of Cargo would create and destroy a new thread for each test. Cargo 1.33.0 instead creates a thread pool and reuses the same thread for multiple tests. Some Nix tests that changed the per-thread sigmask began to fail as a result, because they didn't do any cleanup. The easiest solution is to spawn a new thread for each of those tests.
2019-03-03Fix the build on OSX with libc 0.2.49Alan Somers
Several symbols are now marked as deprecated on OSX. Fix the build by marking these symbols' Nix wrappers as deprecated, too.
2019-02-21Added inotify bindings for Linux and Android.Vincent Dagonneau
2019-02-14Merge #1020bors[bot]
1020: Major cmsg cleanup r=asomers a=asomers This PR fixes multiple bugs in the cmsg code. Fixes #994 Fixes #999 Fixes #1013 Co-authored-by: Alan Somers <asomers@gmail.com>
2019-02-14Enable IPv4PacketInfo and Ipv6PacketInfo on more OSes.Alan Somers
This was an oversight from PR #1002
2019-02-14Add CHANGELOG entry.Alan Somers
2019-02-14Fix misaligned references when using recvmsg with control messagesAlan Somers
On some platforms the alignment of cmsg_data could be less than the alignment of the messages that it contains. That led to unaligned reads on those platforms. This change fixes the issue by always copying the message contents into aligned objects. The change is not 100% backwards compatible when using recvmsg. Users may have to replace code like this: ```rust if let ControlMessage::ScmRights(&fds) = cmsg { ``` with this: ```rust if let ControlMessageOwned::ScmRights(fds) = cmsg { ``` Fixes #999
2019-02-14Replace CmsgSpace with a macroAlan Somers
CmsgSpace had three problems: 1) It would oversize buffers that expect multiple control messages 2) It didn't use the libc CMSG_SPACE(3) macro, so it might actually undersize a buffer for a single control message. 3) It could do bad things on drop, if you instantiate it with a type that implements Drop (which none of the currently supported ControlMessage types do). Fixes #994
2019-02-14Fix error handling of RecvMsgAlan Somers
There were two problems: 1) It would always return Ok, even on error 2) It could panic if there was an error, because sockaddr_storage_to_addr would be called on uninitialized memory.
2019-02-14Replace hand-rolled cmsg logic with libc's cmsg(3) functions.Alan Somers
Our hand-rolled logic had subtle alignment bugs that caused test_scm_rights to fail on OpenBSD (and probably could cause problems on other platforms too). Using cmsg(3) is much cleaner, shorter, and more portable. No user-visible changes.