|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
use std::{
|
|
|
|
|
borrow::Cow,
|
|
|
|
|
cmp::{self, min},
|
|
|
|
|
ffi::{CStr, CString},
|
|
|
|
|
io,
|
|
|
|
@ -993,13 +992,10 @@ pub(crate) fn bpf_prog_get_next_id(id: u32) -> Result<Option<u32>, (c_long, io::
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) fn retry_with_verifier_logs<F>(
|
|
|
|
|
pub(crate) fn retry_with_verifier_logs(
|
|
|
|
|
max_retries: usize,
|
|
|
|
|
f: F,
|
|
|
|
|
) -> (SysResult, Cow<'static, str>)
|
|
|
|
|
where
|
|
|
|
|
F: Fn(&mut [u8]) -> SysResult,
|
|
|
|
|
{
|
|
|
|
|
f: impl Fn(&mut [u8]) -> SysResult,
|
|
|
|
|
) -> (SysResult, String) {
|
|
|
|
|
const MIN_LOG_BUF_SIZE: usize = 1024 * 10;
|
|
|
|
|
const MAX_LOG_BUF_SIZE: usize = (std::u32::MAX >> 8) as usize;
|
|
|
|
|
|
|
|
|
@ -1023,11 +1019,7 @@ where
|
|
|
|
|
if let Some(pos) = log_buf.iter().position(|b| *b == 0) {
|
|
|
|
|
log_buf.truncate(pos);
|
|
|
|
|
}
|
|
|
|
|
let log_buf = if log_buf.is_empty() {
|
|
|
|
|
"none".into()
|
|
|
|
|
} else {
|
|
|
|
|
String::from_utf8(log_buf).unwrap().into()
|
|
|
|
|
};
|
|
|
|
|
let log_buf = String::from_utf8(log_buf).unwrap();
|
|
|
|
|
|
|
|
|
|
break (ret, log_buf);
|
|
|
|
|
}
|
|
|
|
|