summaryrefslogtreecommitdiffhomepage
path: root/src/platform/linux/libc_s.rs
Commit message (Collapse)AuthorAgeFilesLines
* linux: implement socket and mmap wrapper for rxringdilluti0n2026-07-071-5/+23
| | | | | | | Here mmap/munmap wrapper remain unsafe since mmap returns a pointer causes a memory leak when munmap is not called while dropping, and munmap has strict rule (PAGE_SIZE aligned) for addr defined on munmap(2).
* linux: libc_s: add syscall! macro to reduce redundant error handlingdilluti0n2026-07-061-29/+15
|
* linux: add PACKET_RX_RING to libc_s::setsockopt apstractiondilluti0n2026-07-061-9/+21
| | | | | | | | | The existing implementation was unsafe because UB could occur if a user-space pointer referenced by the struct sock_fprog was incorrectly passed. Rust safe model allows pointer creation and makes dereferencing unsafe. In this case, dereferencing happenes in kernel-space, Rust cannot guarantee this. So it must be handled separately.
* linux: add safe abstraction for setsockopt(SO_ATTACH_FILTER)dilluti0n2026-07-061-1/+29
| | | | | | Treating optval as just a &[u8] in setsockopt() is not appropriate for usage patterns where a struct is put into optval. Rust treats casting a struct to &[u8] as unsafe.
* linux: move poll_s() to mod libc_sdilluti0n2026-07-061-0/+9
|
* linux: drop nix, add wrapper libc_s insteaddilluti0n2026-07-061-0/+42
When I updated nix to 0.31, `nix::fcntl::flock` became deprecated and unusable. At first I try to refactor `lock_pid_file()` to use the `lock` method of the `nix::fcntl::Flock` struct, but a situation arose where `set_len(0)` could not be called due to ownership issues. Linux system calls are fundamentally simple, stable, and backward compatible. Therefore, a compat layer is not necessary. Anticipating that this might happen again, this commit introduce the `libc_s`, which handles simple error processing for unsafe ffis in libc syscall bindings.