I'm writing a driver that requires me to clear all the memory allocated to zero. memset
is a userspace function, but I would like to know if the kernel provides a macro that helps me do this.
It's true memset()
in
include <string.h >
not supposed to appear in kernel code.And the fact is it may cost you a lot to trace down where memset()
is included during driver development. Actually memset()
is defined in
#include<linux/string.h>
it says:
#ifndef __KERNEL__
#include <string.h>
#else
/* We don't want strings.h stuff being used by user stuff by accident */
Hope this help you type down 'memset()' with 100% sure :)