summary refs log tree commit diff
path: root/sys_util/src/handle_eintr.rs
Commit message (Collapse)AuthorAge
* crosvm: collapse simple boolean matchesAlyssa Ross2020-04-11
| | | | | Rust 1.42 introduces matches!(), which can be used to collapse simple match statements like these.
* edition: Eliminate blocks superseded by NLLDavid Tolnay2019-04-17
| | | | | | | | | | | | | | | | | | | | Before the new borrow checker in the 2018 edition, we sometimes used to have to manually insert curly braced blocks to limit the scope of borrows. These are no longer needed. Details in: https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html TEST=cargo check --all-features TEST=local kokoro Change-Id: I59f9f98dcc03c8790c53e080a527ad9b68c8d6f3 Reviewed-on: https://chromium-review.googlesource.com/1568075 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* sys_util: Enable macros imported individuallyDavid Tolnay2019-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The syslog and ioctl macros in sys_util were originally written to be imported through `#[macro_use] extern crate sys_util` which is essentially a glob import of all macros from the crate. In 2018 edition, extern crate is deprecated and macros are imported the same as any other item. As these sys_util macros are currently written, importing an individual macro requires the caller to also import any other sys_util macros that the invocation internally expands to. Example: use sys_util::{error, log}; fn main() { error!("..."); } This CL adjusts all sys_util macros to invoke helper macros through a `$crate::` prefix so that the caller is not required to have the helper macros in scope themselves. use sys_util::error; fn main() { error!("..."); } TEST=kokoro Change-Id: I2d9f16dca8e7a4a4c0e63d9f10ead9f7413d9c3c Reviewed-on: https://chromium-review.googlesource.com/1565544 Commit-Ready: David Tolnay <dtolnay@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* edition: Update absolute paths to 2018 styleDavid Tolnay2019-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | This is an easy step toward adopting 2018 edition eventually, and will make any future CL that sets `edition = "2018"` this much smaller. The module system changes in Rust 2018 are described here: https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html Generated by running: cargo fix --edition --all in each workspace, followed by bin/fmt. TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: I000ab5e69d69aa222c272fae899464bbaf65f6d8 Reviewed-on: https://chromium-review.googlesource.com/1513054 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* lint: Resolve the easier clippy lintsDavid Tolnay2018-12-03
| | | | | | | | | | | | | | | | | | | | Hopefully the changes are self-explanatory and uncontroversial. This eliminates much of the noise from `cargo clippy` and, for my purposes, gives me a reasonable way to use it as a tool when writing and reviewing code. Here is the Clippy invocation I was using: cargo +nightly clippy -- -W clippy::correctness -A renamed_and_removed_lints -Aclippy::{blacklisted_name,borrowed_box,cast_lossless,cast_ptr_alignment,enum_variant_names,identity_op,if_same_then_else,mut_from_ref,needless_pass_by_value,new_without_default,new_without_default_derive,or_fun_call,ptr_arg,should_implement_trait,single_match,too_many_arguments,trivially_copy_pass_by_ref,unreadable_literal,unsafe_vector_initialization,useless_transmute} TEST=cargo check --features wl-dmabuf,gpu,usb-emulation TEST=boot linux Change-Id: I55eb1b4a72beb2f762480e3333a921909314a0a2 Reviewed-on: https://chromium-review.googlesource.com/1356911 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* cargo fmt all source codeZach Reizner2018-10-09
| | | | | | | | | | | | | | Now that cargo fmt has landed, run it over everything at once to bring rust source to the standard formatting. TEST=cargo test BUG=None Change-Id: Ic95a48725e5a40dcbd33ba6d5aef2bd01e91865b Reviewed-on: https://chromium-review.googlesource.com/1259287 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* sys_util: fix handling EINTR of C system functionsDmitry Torokhov2018-03-01
| | | | | | | | | | | | | | | | | | System functions have 2 ways of signalling errors, either via returning -1 as result, and setting errno, or directly returning error code, and we can not distinguish automatically between the 2 options when using InterruptibleResult trait for i32 values. Let's remove this trait for i32 and create 2 explicit macros: handle_eintr_rc and handle_eintr_errno. TEST=cargo test --features plugin; cargo test -p sys_util BUG=None Change-Id: I1dc8e3c023e7bf7875ac3536703eb71fa3206b7b Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/940612 Reviewed-by: Zach Reizner <zachr@chromium.org>
* sys_util: do not treat EINTR as negative in handle_eintrDmitry Torokhov2018-03-01
| | | | | | | | | | | | | System error codes are positive, we should not try to use the negative (kernel) form when working with it. TEST=cargo test --features plugin; cargo test -p sys_util BUG=None Change-Id: I8dea773e6148d1814ca0ea5019d5fb7824dc80ac Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/940611 Reviewed-by: Zach Reizner <zachr@chromium.org>
* sys_util: move handle_eintr!() to sys_util so it can be reusedZach Reizner2017-06-30
This CL takes the handle_intr!() macro, changes its name to handle_eintr!(), and overloads it so it can handle EINTR embedded in other kinds of Result types. BUG=None TEST=cargo test Change-Id: I920ea7d9f156137f42e9e8ea44a3e6946d06b746 Reviewed-on: https://chromium-review.googlesource.com/556348 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>