Skip to content
Permalink
Browse files

Merge pull request #1557 from input-output-hk/android-disable-rlimits

disable diagnostic on Android
  • Loading branch information
vincenthz committed Jan 14, 2020
2 parents 01d4f24 + 1b1d16f commit c142c3ae7f014cba5bfb3556db8a1658f7b616b9
Showing with 5 additions and 4 deletions.
  1. +1 −0 .travis.yml
  2. +4 −4 jormungandr/src/diagnostic.rs
@@ -25,6 +25,7 @@ matrix:
#- env: TARGET=powerpc64-unknown-linux-gnu DISABLE_TESTS=1
- env: TARGET=powerpc64le-unknown-linux-gnu DISABLE_TESTS=1
- env: TARGET=x86_64-unknown-linux-musl
- env: TARGET=aarch64-linux-android

# *BSD
# - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
@@ -3,7 +3,7 @@ use thiserror::Error;

#[derive(Debug, Error)]
pub enum DiagnosticError {
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "android")))]
#[error("while performing a UNIX syscall {0}")]
UnixError(#[source] nix::Error),
#[error("unknown diagnostic error")]
@@ -18,14 +18,14 @@ pub struct Diagnostic {

impl Diagnostic {
pub fn new() -> Result<Self, DiagnosticError> {
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "android")))]
{
Ok(Self {
open_files_limit: Some(getrlimit(RlimitResource::NoFile)?),
cpu_usage_limit: Some(getrlimit(RlimitResource::CPU)?),
})
}
#[cfg(not(unix))]
#[cfg(any(not(unix), target_os = "android"))]
{
Ok(Self {
open_files_limit: None,
@@ -60,7 +60,7 @@ enum RlimitResource {
CPU,
}

#[cfg(unix)]
#[cfg(all(unix, not(target_os = "android")))]
fn getrlimit(resource: RlimitResource) -> Result<u64, DiagnosticError> {
use libc::rlimit;
use std::convert::TryInto;

0 comments on commit c142c3a

Please sign in to comment.
You can’t perform that action at this time.