add memlock remove.

pull/94/head
pdliyan 1 year ago
parent d0e4a02fe2
commit f8639db35a

@ -18,6 +18,7 @@ libc = "0.2"
{%- endif %} {%- endif %}
log = "0.4" log = "0.4"
tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] } tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] }
rlimit = "0.9.1"
[[bin]] [[bin]]
name = "{{project-name}}" name = "{{project-name}}"

@ -46,6 +46,7 @@ use aya_log::BpfLogger;
use clap::Parser; use clap::Parser;
{% endif -%} {% endif -%}
use log::{info, warn}; use log::{info, warn};
use rlimit::Resource;
use tokio::signal; use tokio::signal;
{% if program_types_with_opts contains program_type -%} {% if program_types_with_opts contains program_type -%}
@ -71,6 +72,14 @@ async fn main() -> Result<(), anyhow::Error> {
{% endif %} {% endif %}
env_logger::init(); env_logger::init();
if !Resource::MEMLOCK
.set(rlimit::INFINITY, rlimit::INFINITY)
.is_ok()
{
warn!("cannot remove mem lock");
}
// 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

Loading…
Cancel
Save