You cannot use mkdir
in a kernel module.
The mkdir
function is part of the standard C library (libc
) which can only be used in user-space programs, not in kernel or module code!
So the definition of mkdir
in sys/stat.h
is in an #ifndef _KERNEL/#endif
block and won't be "seen" if you are compiling a kernel module.
In 2011, all system calls were all given a sys_
prefix. (See also the answer to this question) So you should use sys_mkdir
instead.