FreeBSD Kernel Question

Matthew Seaman matthew at FreeBSD.org
Sun Oct 29 10:11:53 UTC 2017


On 29/10/2017 09:03, 颜基屹 wrote:
>  Hello! I would like to know how to provide an API in the kernel space to
> user space.Such As 'printf'.

How to do this depends very much on the specifics of what you want to do.

If what you want is to expose some kernel memory structure or data so
that it can be queried from userland, then a common mechanism is
sysctl(3). There are also mechanisms commonly used for debugging and
performance monitoring, such as dtrace(1) and pmcstat(8).  You can also
log events via syslog or by writing to the kernel message buffer -- see
dmesg(8).

Otherwise, look at devd(8) and devctl(4) for a mechanism to trigger
actions in userland when certain kernel events happen, such as plugging
in a new device.

The best place to get answers for these sort of questions about kernel
development is the freebsd-hackers at freebsd.org mailing list, as that
will come to the attention of many of the kernel developers.

	Cheers,

	Matthew





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20171029/5f9bb964/attachment.sig>


More information about the freebsd-questions mailing list