Linux内核编程:函数'vmalloc'的隐式声明

QSh*_*yao 1 c linux kernel

我正在向Linux内核6.22添加系统调用.

#include <stddef.h>
#incldue <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/lists.h>
#include <asm-i386/uaccess.h>

asmlinkage long sys_mypstree(char* buffer2copy){
     char* buffer = (char*)vmalloc(sizeof(buffer2copy));
     ...
}
Run Code Online (Sandbox Code Playgroud)

然后,当我创建内核时.它显示警告:隐式声明函数'vmalloc'.所以,我现在要做什么?

Ido*_*dos 5

你应该肯定:
#include <linux/vmalloc.h>因为它会修复你的警告.