我正在os161内核中实现一个fork系统调用。我正在尝试创建一个新进程,对于它的线程创建,我使用了thread_fork。我使用函数md_forkentry将堆和堆栈分配给新线程的陷阱帧并切换到用户模式;但是在编译代码:passing arg 4 of 'thread_fork' from incompatible pointer type之后,我得到了这个警告。
//Function Prototypes
int thread_fork(const char* name,void* data1,unsgined long data2,void (*func) (void*,unsigned long),struct thread **ret)
void md_forkentry(struct trapframe* tf,unsigned long n);
//the code
struct trapframe* tf;
struct thread* child_thread;
//line I get the error from
int result=thread_fork("Child Process",(void*) tf,0,&md_forkentry,&child_thread);发布于 2020-03-13 23:31:12
您的md_forkentry()原型与thread_fork()的第四个参数的类型不匹配。
md_forkentry()必须原型如下:
void md_forkentry(void *, unsigned long);(反之亦然,即在必要时修复thread_fork()原型中给出的参数类型)
https://stackoverflow.com/questions/60678360
复制相似问题