What will be the nuclear macro equivalent for memset?

I am writing a driver that requires me to clear all memory allocated by zero. memsetis a user space function, but I would like to know if the kernel supports a macro that helps me do this.

+5
source share
3 answers

In accordance with this thread and the people commenting here who used it memsetare available in the kernel code. Maybe you just forgot

#include <string.h>
+5
source

Truth memset()in

include <string.h >

. , , , memset() . memset()

#include<linux/string.h>

:

#ifndef __KERNEL__
#include <string.h>
#else
/* We don't want strings.h stuff being used by user stuff by accident */

, "memset()" 100% :)

+15

Linux, ( , , ), :

#include <asm/io.h>
void *memset(void *s, int c, size_t n);

n s c. , I/O, , memset_io().

s.


Doing some more research ... If you look at the sources <asm/io.h>, you can find:

#include <linux/string.h> /* for memset() and memcpy() */

... but also a function definition memset_io(), so I guess that should be right #include.

+1
source

All Articles