Crates.io | freebsd-kmi-rs |
lib.rs | freebsd-kmi-rs |
version | 0.3.0 |
source | src |
created_at | 2023-11-25 21:36:23.494697 |
updated_at | 2024-02-08 16:43:44.040665 |
description | FreeBSD Kernel Module Programming Interface |
homepage | |
repository | https://repo.4neko.org/4NEKO/freebsd-kmi-rs |
max_upload_size | |
id | 1048591 |
size | 80,436 |
This repository contains everything which is needed to build a kernel module and safe realizations! A bindings to FreeBSD Kernel is provided by FreeBSD-KPI-RS crate.
!!! Only latest (major) versions of FreeBSD will be actively supported. As soon as new major version is released, the previous are automatically moved to legacy
.
For example: current 13.1. When 14.0 will be released, the current will become 14.0
At the moment it is not possible to have available an KPI
or KMI
for x.x-CURRENT or x.x-STABLE.
GLOBAL_ALLOC_DISABLED
- disables the build-in implementation of the kernel allocator.
Either:
GLOBAL_ALLOC_FLAG_WAITOK
- tells the malloc that your kernel module is ok to wait for heap space.
Or:
GLOBAL_ALLOC_FLAG_NOWAIT
- tells the malloc that your kernel module should not wait for heap space.
GLOBAL_ALLOC_FLAG_USERESERVE
- additional feature which alters the behaviour of NOWAIT.
One of the above should be declared.
GLOBAL_ALLOC_EXCLUDE_PANICHANDLER
- excludes the default \#\[panic_handler\]
GLOBAL_ALLOC_EXCLUDE_ALLOC_ERROR_HNDL
- excludes the \#\[alloc_error_handler\]
By default, this crate implements the common GlobalAllocator``. It is recomended not to use it and call a macro from
global_alloc.rsto implement your own. Also, this crate should be compiled setting feature
GLOBAL_ALLOC_DISABLED`.
Unfortunatelly, a GlobalAllocator is required by default.
A default panic_handler
and alloc_error_handler
are included as part of the GlobalAllocator. Bothe can be overrided by including features: GLOBAL_ALLOC_EXCLUDE_PANICHANDLER
GLOBAL_ALLOC_EXCLUDE_ALLOC_ERROR_HNDL
.
A custom instances of malloc
can be declared using macro in the heap_alloc/alloc.rs
.
todo