diff options
author | Steven Moreland <smoreland@google.com> | 2020-01-10 15:35:52 -0800 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2020-01-10 15:37:53 -0800 |
commit | 4891e61341488050507f9a3e5c0915ff906a9c13 (patch) | |
tree | 28aa2ef6e7fe72f6a307a4b62c0e318432d8b42b /libbpf_android/Loader.cpp | |
parent | be15fa1edd87bd7ef13cb774ba2cedbf1a6af98f (diff) | |
download | bpf-4891e61341488050507f9a3e5c0915ff906a9c13.tar.gz |
libbpf_android: waitForProgsLoaded
Creating a function for this rather than having people copy/paste a loop
there.
It's very intentional that there is no timeout here. If bpfloader is
down, there is a serious problem, and we shouldn't let code move forward
in a state where it may not have been tested.
Bug: 140330870
Test: boot & use bpf/netd
Change-Id: I358d1fcf77ad5406e294dd57307bc411e2c8ad6a
Diffstat (limited to 'libbpf_android/Loader.cpp')
-rw-r--r-- | libbpf_android/Loader.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index fb4e36c..021e79f 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -36,6 +36,7 @@ #include <string> #include <vector> +#include <android-base/properties.h> #include <android-base/strings.h> #include <android-base/unique_fd.h> @@ -589,5 +590,11 @@ int loadProg(const char* elfPath) { return ret; } +void waitForProgsLoaded() { + while (!android::base::WaitForProperty("bpf.progs_loaded", "1", std::chrono::seconds(5))) { + ALOGW("Waited 5s for bpf.progs_loaded, still waiting..."); + } +} + } // namespace bpf } // namespace android |