SYSCALL_MODULE(9)

SYSCALL_MODULE9

Syscall kernel module declaration macro

Usage

#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);

Overview

The SYSCALL_MODULE() macro declares a new syscall. SYSCALL_MODULE() expands into a kernel module declaration with name ‘sys/name’.

The rest of the arguments expected by this macro are:

offset

A pointer to an int which saves the offset in struct sysent where the syscall is allocated. If the location pointed to by offset holds a non 0 number it will be used if possible. If it holds 0 then one will be assigned.

new_sysent

is 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 argument arg. Please refer to module(9) for more information.

arg

The argument passed to the callback functions of the evh event 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.

Examples

A minimal example for a syscall module can be found in /usr/share/examples/kld/syscall/module/syscall.c.

Releases

65 releases since FreeBSD 4.4-RELEASE; the text changed 40 times.

  1. 4.4
  2. 4.5–4.11
  3. 5.0–5.1
  4. 5.2–5.3
  5. 5.4
  6. 5.5
  7. 6.0
  8. 6.1
  9. 6.2–6.3
  10. 6.4
  11. 7.0
  12. 7.1
  13. 7.2
  14. 7.3
  15. 7.4
  16. 8.0
  17. 8.1
  18. 8.2
  19. 8.3
  20. 8.4
  21. 9.0
  22. 9.1
  23. 9.2
  24. 9.3
  25. 10.0
  26. 10.1
  27. 10.2
  28. 10.3
  29. 10.4
  30. 11.0
  31. 11.1
  32. 11.2
  33. 11.3
  34. 11.4
  35. 12.0
  36. 12.1
  37. 12.2
  38. 12.3
  39. 12.4
  40. 13.0–13.2
  41. 13.3–16.0

Authors

This manual page was written by Alexander Langer ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.