Re: Error while building a kernel module with mkdir(2)

From: Dmitry Chagin <dchagin_at_freebsd.org>
Date: Tue, 19 Sep 2023 09:53:45 UTC
On Mon, Sep 18, 2023 at 11:12:57PM +0200, Rocky Hotas wrote:
> Hello!
> I hope this is the right ML to discuss about this issue. I am trying to
> build the example kernel module presented in paragraph 2.1 of
> 
> Designing BSD Rootkits: An Introduction to Kernel Hacking
> by Joseph Kong
> 
> However, I get this error:
> 
> mkdir_hook.c:42:9: error: implicit declaration of function 'mkdir' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>         return(mkdir(td, syscall_args));
>                ^
> mkdir_hook.c:57:45: error: use of undeclared identifier 'mkdir'
>                         sysent[SYS_mkdir].sy_call = (sy_call_t *)mkdir;
> 
> mkdir(2) requires `#include <sys/stat.h>' and I added it (while it was
> not in the code from the book), but nothing changes.
> 
> What's still wrong?
> 

No more mkdir, look for kern_mkdirat at syscallsubr.h