|
|
@ -45,7 +45,7 @@ use aya_log::BpfLogger;
|
|
|
|
{% if program_types_with_opts contains program_type -%}
|
|
|
|
{% if program_types_with_opts contains program_type -%}
|
|
|
|
use clap::Parser;
|
|
|
|
use clap::Parser;
|
|
|
|
{% endif -%}
|
|
|
|
{% endif -%}
|
|
|
|
use log::{info, warn};
|
|
|
|
use log::{info, warn, debug};
|
|
|
|
use tokio::signal;
|
|
|
|
use tokio::signal;
|
|
|
|
|
|
|
|
|
|
|
|
{% if program_types_with_opts contains program_type -%}
|
|
|
|
{% if program_types_with_opts contains program_type -%}
|
|
|
@ -71,6 +71,17 @@ async fn main() -> Result<(), anyhow::Error> {
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
env_logger::init();
|
|
|
|
env_logger::init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Bump the memlock rlimit. This is needed for older kernels that don't use the
|
|
|
|
|
|
|
|
// new memcg based accounting, see https://lwn.net/Articles/837122/
|
|
|
|
|
|
|
|
let rlim = libc::rlimit {
|
|
|
|
|
|
|
|
rlim_cur: libc::RLIM_INFINITY,
|
|
|
|
|
|
|
|
rlim_max: libc::RLIM_INFINITY,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
let ret = unsafe { libc::setrlimit(libc::RLIMIT_MEMLOCK, &rlim) };
|
|
|
|
|
|
|
|
if ret != 0 {
|
|
|
|
|
|
|
|
debug!("remove limit on locked memory failed, ret is: {}", ret);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This will include your eBPF object file as raw bytes at compile-time and load it at
|
|
|
|
// This will include your eBPF object file as raw bytes at compile-time and load it at
|
|
|
|
// runtime. This approach is recommended for most real-world use cases. If you would
|
|
|
|
// runtime. This approach is recommended for most real-world use cases. If you would
|
|
|
|
// like to specify the eBPF program at runtime rather than at compile-time, you can
|
|
|
|
// like to specify the eBPF program at runtime rather than at compile-time, you can
|
|
|
|