SYSCALL_MODULE(9)
π SYSCALL_MODULE(9) π
okay bestie, welcome to the SYSCALL_MODULE(9) page from the Kernel Developer's Manual β yes, section 9, kernel-dev territory, main character energy only π. This is the whole syscall kernel module declaration macro situation, and weβre gonna get through every single detail together, fr fr π.
π NAME π
SYSCALL_MODULE β syscall kernel module declaration macro. periodt.
πΈ SYNOPSIS πΈ
copy this exactly, bestie, no vibes-based edits π :
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/module.h>
#include <sys/sysent.h>
SYSCALL_MODULE(name, int *offset, struct sysent *new_sysent,
modeventhand_t evh, void *arg);
thatβs the signature, and yes itβs giving very βkernel module declaration macroβ β¨.
β¨ DESCRIPTION β¨
SYSCALL_MODULE() declares a new syscall. It expands into a kernel module declaration with name sys/name β thatβs the literal name pattern, iykyk π¦.
The rest of the arguments expected by this macro are:
offsetβ a pointer to anintwhich saves the offset instruct sysentwhere the syscall is allocated. If the location pointed to byoffsetholds a non 0 number it will be used if possible. If it holds 0 then one will be assigned. πnew_sysentβ a pointer to a structure that specifies the function implementing the syscall and the number of arguments this function needs (see<sys/sysent.h>). π«Άevhβ a pointer to the kernel module event handler function with the argumentarg. Please refer tomodule(9)for more information. πargβ the argument passed to the callback functions of theevhevent handler when it is called. π
The syscall number assigned to the module can be retrieved using the modstat(2) and modfind(2) system calls. The MACRO SYSCALL_MODULE_HELPER() includes SYSCALL_MODULE() and much of its boilerplate code. no cap, that helper is eating ππ₯.
π EXAMPLES π
A minimal example for a syscall module can be found in /usr/share/examples/kld/syscall/module/syscall.c. literally the blueprint, bestie π§.
π¦ SEE ALSO π¦
module(9)/usr/share/examples/kld/syscall/module/syscall.c
π AUTHORS π
This manual page was written by Alexander Langer <alex@FreeBSD.org>. king behavior, honestly π.
π sign-off: source/version is Debian, dated June 15, 2023. mwah π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2001 Alexander Langer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms