内核中的malloc [英] malloc in kernel
本文介绍了内核中的malloc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试在内核模块中使用malloc
时,我从编译器收到一条错误消息.我的代码:
When I try to use malloc
in a kernel module I get an error message from the compiler. My code:
res=(ListNode*)malloc(sizeof(ListNode));
编译器错误消息是:
/root/ex3/ex3mod.c:491: error: implicit declaration of function ‘malloc’
我该怎么办?
推荐答案
使用
use kmalloc
or vmalloc
instead (see also this)
这篇关于内核中的malloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文