FreeBSD Kernel Question

Polytropon freebsd at
Sun Oct 29 13:50:34 UTC 2017

On Sun, 29 Oct 2017 17:03:34 +0800, 颜基屹 wrote:
>  Hello! I would like to know how to provide an API in the kernel space to
> user space.Such As 'printf'.

To be precise, printf() isn't a kernel interface, it's a library
function (of the system's C library). The kernel equivalent would
probably be the system call write().

See "man 2 write" and "man 3 printf" for details.

If you want to add a mechanism that deals with kernel structures
and functions from user space, I'd suggest having a look at the
source code of the system C library. You can implement you own
API in a similar way. But you can also add a new system call;
extend the system call table and add your own code to the kernel.
The kernel source is a good place to learn how to do this.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list