I am implementing a fork system call in os161 kernel. I am trying to create a new process and for its thread creation I used thread_fork
. I am using the function md_forkentry
to allocate heap and stack to the trapframe of the new thread and switch to user mode; but I get this warning after compiling the code:
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);
Your prototype for md_forkentry()
does not match the type of the 4th parameter of thread_fork()
.
md_forkentry()
must be prototyped as:
void md_forkentry(void *, unsigned long);
(or vice-versa, i.e. fix the parameter type given in the prototype for thread_fork()
if necessary)