SYSCALL_HELPER_UNREGISTER(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– SYSCALL_HELPER_REGISTER(9) πŸ’–

okay bestie, this is the Kernel Developer's Manual page for the syscall helper registration glow-up: syscall_helper_register, syscall_helper_unregister, and the SYSCALL_INIT_HELPER* macro squad πŸ’…. no cap, every flag and error is staying right here.

✨ NAME ✨

syscall_helper_register, syscall_helper_unregister β€” kernel syscall registration routines 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sys/sysent.h>

int
syscall_helper_register(struct syscall_helper_data *sd, int flags);

int
syscall_helper_unregister(struct syscall_helper_data *sd);

πŸŽ€ INITIALIZER MACROS πŸŽ€

struct syscall_helper_data
SYSCALL_INIT_HELPER(syscallname);

struct syscall_helper_data
SYSCALL_INIT_HELPER_F(syscallname, int flags);

🌸 COMPATIBILITY INITIALIZER MACROS 🌸

struct syscall_helper_data
SYSCALL_INIT_HELPER_COMPAT(syscallname);

struct syscall_helper_data
SYSCALL_INIT_HELPER_COMPAT_F(syscallname, int flags);

πŸ‘‘ DESCRIPTION πŸ‘‘

syscall_helper_register() registers a system call. it takes the structure struct syscall_helper_data sd, which specifies the parameters for syscall registration β€” and here's the struct in all its main-character glory:

struct syscall_helper_data {
        struct sysent   new_sysent;
        struct sysent   old_sysent;
        int             syscall_no;
        int             registered;
};
the only valid flag for the flags argument to syscall_helper_register() is SY_THR_STATIC. this flag prevents the syscall from being unregistered. periodt.

before use, the structure must be initialized with one of the SYSCALL_INIT_HELPER*() macros. in new code, syscall implementation functions shall be named sys_syscallname() and the regular macros shall be used ✨.

for legacy syscall functions named without "sys_" prefixes, the "COMPAT" versions of the macros may be used.

the only valid flag for the flags argument to the "F" variants of the initializer macros is SYF_CAPENABLED. this flag indicates that the syscall is allowed in capability mode πŸ¦‹.

the syscall_helper_unregister() unregisters a system call. this function takes the same structure struct syscall_helper_data sd that was previously initialized in the manner described above and used in a successful invocation of syscall_helper_register() πŸ’….

🌈 RETURN VALUES 🌈

if successful, syscall_helper_register() and syscall_helper_unregister() will return 0. otherwise, they will return an error 😭.

πŸ”₯ ERRORS πŸ”₯

the syscall_helper_register() call will fail and the syscall will not be registered if:

  • [EINVAL] β€” the flags argument contained a value other than SY_THR_STATIC.
  • [EINVAL] β€” the specified syscall number, sd.syscall_no (SYS_syscallname), was outside of the valid range of system call numbers (zero through SYS_MAXSYSCALL).
  • [ENFILE] β€” the system call table does not have any available slots.
  • [EEXIST] β€” the specified syscall number, sd.syscall_no (SYS_syscallname), was already in use.

🫢 SEE ALSO 🫢


okay that's the whole vibe check πŸ’– this page is from Debian, dated February 10, 2018 β€” byeee bestie, go register those syscalls responsibly πŸŽ€πŸ’‹

πŸ“¦ where this page comes from