Disable bpf_exitstats for non fbcode_build
Summary:
We have open source customers that confused with the error message generate by bpf_exitstats. We didn't package the exitstat prog to opensource yet per
So disable this feature temporarily for opensource.
@@ -169,6 +169,9 @@ pub enum RedirectLogOnFail {
}
fn bump_memlock_rlimit() -> Result<()> {
+ // TODO(T78976996) remove the fbcode_gate once we can exit stats is
+ // enabled for opensource
+ if cfg!(fbcode_build) {
let rlimit = libc::rlimit {
rlim_cur: 128 << 20,
rlim_max: 128 << 20,
@@ -177,6 +180,7 @@ fn bump_memlock_rlimit() -> Result<()> {
if unsafe { libc::setrlimit(libc::RLIMIT_MEMLOCK, &rlimit) } != 0 {
bail!("Failed to increase rlimit");
}
+ }
Ok(())
}
@@ -225,6 +229,9 @@ fn start_exitstat(
logger: slog::Logger,
debug: bool,
) -> (Arc<Mutex<procfs::PidMap>>, Option<Receiver<Error>>) {
+ // TODO(T78976996) remove the fbcode_gate once we can exit stats is
+ // enabled for opensource
+ if cfg!(fbcode_build) {
let mut exit_driver = bpf::exitstat::ExitstatDriver::new(logger, debug);
let exit_buffer = exit_driver.get_buffer();
let (bpf_err_send, bpf_err_recv) = channel();
@@ -236,10 +243,17 @@ fn start_exitstat(
});
(exit_buffer, Some(bpf_err_recv))
+ } else {
+ (Arc::new(Mutex::new(procfs::PidMap::new())), None)
+ }
}
/// Returns true if other end disconnected, false otherwise
fn check_for_exitstat_errors(logger: &slog::Logger, receiver: &Receiver<Error>) -> bool {
+ // TODO(T78976996) remove the fbcode_gate once we can exit stats is
+ // enabled for opensource
+ // This code path will unlikely to execute for non fbcode_build
+ if cfg!(fbcode_build) {
// Print an error but don't exit on bpf issues. Do this b/c we can't always
// be sure what kind of kernel we're running on and if it's new enough.
match receiver.try_recv() {
@@ -250,6 +264,7 @@ fn check_for_exitstat_errors(logger: &slog::Logger, receiver: &Receiver<Error>)
return true;
}
};
+ }
false
}
