---
name: "SYSCALL_INIT_HELPER"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/SYSCALL_INIT_HELPER"
---

# SYSCALL\_INIT\_HELPER(9)

kernel syscall registration routines

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

The **syscall\_helper\_register**() registers a system call. This function takes the structure *struct* *syscall\_helper\_data* *sd*, which specifies the parameters for syscall registration:

```
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.

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

[SYSCALL\_MODULE(9)](/SYSCALL_MODULE/9.md)
