Merge pull request #66 from ericho/master

agent: Remove `get_key_value` to enable building in stable rust.
This commit is contained in:
Yang Bo
2019-11-01 18:59:31 +08:00
committed by GitHub
3 changed files with 16 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ os:
language: rust language: rust
rust: rust:
- nightly - stable
env: env:
- target_branch=$TRAVIS_BRANCH RUST_AGENT=yes - target_branch=$TRAVIS_BRANCH RUST_AGENT=yes

View File

@@ -45,9 +45,7 @@ The `rust-agent` depends on [`grpc-rs`](https://github.com/pingcap/grpc-rs) by P
### Build from Source ### Build from Source
The rust-agent need to be built with rust nightly, and static linked with musl. The rust-agent need to be built with rust nightly, and static linked with musl.
```bash ```bash
rustup toolchain install nightly rustup target add x86_64-unknown-linux-musl
rustup default nightly
rustup target add x86_64-unknown-linux-musl --toolchain=nightly
git submodule update --init --recursive git submodule update --init --recursive
sudo ln -s /usr/bin/g++ /bin/musl-g++ sudo ln -s /usr/bin/g++ /bin/musl-g++
cargo build --target x86_64-unknown-linux-musl --release cargo build --target x86_64-unknown-linux-musl --release

View File

@@ -588,24 +588,22 @@ pub fn get_cgroup_mounts(logger: &Logger, cg_path: &str) -> Result<Vec<INIT_MOUN
} }
} }
match CGROUPS.get_key_value(fields[0]) { if fields[0] == "" {
Some((key, value)) => { continue;
if *key == "" { }
continue;
}
if *key == "devices" { if fields[0] == "devices" {
has_device_cgroup = true; has_device_cgroup = true;
} }
cg_mounts.push(INIT_MOUNT { if let Some(value) = CGROUPS.get(&fields[0]) {
fstype: "cgroup", let key = CGROUPS.keys().find(|&&f| f == fields[0]).unwrap();
src: "cgroup", cg_mounts.push(INIT_MOUNT {
dest: *value, fstype: "cgroup",
options: vec!["nosuid", "nodev", "noexec", "relatime", *key], src: "cgroup",
}); dest: *value,
} options: vec!["nosuid", "nodev", "noexec", "relatime", key]
None => continue, });
} }
} }