I am reading the source code to understand sysctl in FreeBSD.It looks like the most important functionint __sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, const void *newp, size_t newlen);is not defined in lib/libc/gen/sysctl.c.I tried to grep over FreeBSD's source code but I failed to find the defintion of __sysctl.Where is it defined?
Where is the __sysctl function defined in FreeBSD?
freebsd;sysctl;source code
Here's what I've learnt:__syscall is not defined in any C source file; According to Mark Plotnick:libc's __sysctl is a system call wrapper written in a few lines of assembly language, generated during the compilation of libc [1].The system calls' entry point is here in kern_sysctl.c [2]. The system calls are called sys_foo() in the kernel.LinksConfiguration file for generating syscalls.The kern_sysctl.c source.Thanks to edje, Ed Schouten (@EdSchouten), @FreeBSDHelp and Mark Plotnick.