rbpf icon indicating copy to clipboard operation
rbpf copied to clipboard

Reduce usage of libc

Open notgull opened this issue 1 year ago • 0 comments

I am attempting to reduce the dependence on libc in my indirect dependencies. While looking at this crate I noticed some low-hanging fruit that can be very easily replaced with libc.

  • The rand() function can be re-implemented as a simple Wyrand seeded by the thread ID and the current time.
  • libc::memcpy is used at a point where it can be replaced with ptr::copy_nonoverlapping.
  • libc is used for memory allocation at a point where std::alloc can be used instead. So I use this.

I'm not too familiar with this codebase, so if any of these replacements are incorrect, please let me know.

The only leftover libc call is mprotect().

notgull avatar Sep 27 '24 22:09 notgull