aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-04-15 07:07:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-04-15 07:07:36 +0000
commit837350ea0f80a432bca080fb7af06d038704b549 (patch)
tree812faf27d48d6e88205d0e2af12f2898d79a191b
parent769e04f878c479d424b155b8dd32e12e735242be (diff)
parent156725cc065012e58ee63a454f78941a287b5ad1 (diff)
downloadcrosvm-837350ea0f80a432bca080fb7af06d038704b549.tar.gz
Merge "Add dependency to libprocessgroup"
-rw-r--r--Android.bp16
-rw-r--r--cargo2android_module.bp8
-rw-r--r--src/linux/android.rs28
3 files changed, 32 insertions, 20 deletions
diff --git a/Android.bp b/Android.bp
index 6e0097f56..49251d69e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -97,6 +97,11 @@ rust_binary {
"gpu",
],
},
+ android: {
+ shared_libs: [
+ "libprocessgroup",
+ ],
+ },
darwin: {
enabled: false,
},
@@ -110,6 +115,9 @@ rust_binary {
"libgdbstub_arch",
"libthiserror",
],
+ shared_libs: [
+ "libprocessgroup",
+ ],
},
linux_bionic_arm64: {
relative_install_path: "aarch64-linux-bionic",
@@ -368,6 +376,11 @@ rust_library {
"gpu",
],
},
+ android: {
+ shared_libs: [
+ "libprocessgroup",
+ ],
+ },
host_linux: {
features: [
"gdb",
@@ -378,6 +391,9 @@ rust_library {
"libgdbstub_arch",
"libthiserror",
],
+ shared_libs: [
+ "libprocessgroup",
+ ],
},
},
ld_flags: [
diff --git a/cargo2android_module.bp b/cargo2android_module.bp
index 124cb9f7d..b48986b04 100644
--- a/cargo2android_module.bp
+++ b/cargo2android_module.bp
@@ -13,6 +13,11 @@ target: {
"gpu",
],
},
+ android: {
+ shared_libs: [
+ "libprocessgroup",
+ ],
+ },
host_linux: {
features: [
"gdb",
@@ -23,6 +28,9 @@ target: {
"libgdbstub_arch",
"libthiserror",
],
+ shared_libs: [
+ "libprocessgroup",
+ ],
},
},
ld_flags: [
diff --git a/src/linux/android.rs b/src/linux/android.rs
index dd61c757d..c18e760b4 100644
--- a/src/linux/android.rs
+++ b/src/linux/android.rs
@@ -8,28 +8,16 @@ use anyhow::{anyhow, Result};
use libc;
use std::ffi::{CStr, CString};
-// #[link(name = "processgroup")]
-// extern "C" {
-// fn android_set_process_profiles(
-// uid: libc::uid_t,
-// pid: libc::pid_t,
-// num_profiles: libc::size_t,
-// profiles: *const *const libc::c_char,
-// ) -> bool;
-// }
-
-// ANDROID PATCH: The real android_set_process_profiles implementation isn't available to link
-// against yet, so it is replaced with a stub.
-unsafe fn android_set_process_profiles(
- uid: libc::uid_t,
- pid: libc::pid_t,
- num_profiles: libc::size_t,
- profiles: *const *const libc::c_char,
-) -> bool {
- return true;
+#[link(name = "processgroup")]
+extern "C" {
+ fn android_set_process_profiles(
+ uid: libc::uid_t,
+ pid: libc::pid_t,
+ num_profiles: libc::size_t,
+ profiles: *const *const libc::c_char,
+ ) -> bool;
}
-
// Apply the listed task profiles to all tasks (current and future) in this process.
pub fn set_process_profiles(profiles: &Vec<String>) -> Result<()> {
if (profiles.is_empty()) {