use libc instead of rlimit.

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

@ -13,12 +13,9 @@ clap = { version = "4.1", features = ["derive"] }
{{project-name}}-common = { path = "../{{project-name}}-common", features = ["user"] }
anyhow = "1"
env_logger = "0.10"
{%- if program_type == "uprobe" %}
libc = "0.2"
{%- endif %}
log = "0.4"
tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] }
rlimit = "0.9.1"
libc = "0.2"
[[bin]]
name = "{{project-name}}"

@ -72,14 +72,17 @@ async fn main() -> Result<(), anyhow::Error> {
{% endif %}
env_logger::init();
if !Resource::MEMLOCK
.set(rlimit::INFINITY, rlimit::INFINITY)
.is_ok()
{
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{
warn!("cannot remove mem lock");
}
// 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
// like to specify the eBPF program at runtime rather than at compile-time, you can

Loading…
Cancel
Save