diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-04-15 08:36:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-15 08:36:18 +0000 |
commit | 5cc23de3aee72dccc44dec602e743f7a80a06fd7 (patch) | |
tree | 812faf27d48d6e88205d0e2af12f2898d79a191b | |
parent | eca1bb4b4d6df75891db3b7e0922f0f9fa0cc87b (diff) | |
parent | d523956768e44e935b7a8047213707b59feb84bc (diff) | |
download | crosvm-5cc23de3aee72dccc44dec602e743f7a80a06fd7.tar.gz |
Merge "Add dependency to libprocessgroup" am: 837350ea0f am: dbb9c64421 am: d523956768
Original change: https://android-review.googlesource.com/c/platform/external/crosvm/+/2059508
Change-Id: Ie1ce75291d2ce191ce606d6982b75032d9271c20
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | Android.bp | 16 | ||||
-rw-r--r-- | cargo2android_module.bp | 8 | ||||
-rw-r--r-- | src/linux/android.rs | 28 |
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()) { |