So I'm trying to make a new system call in Red Hat 2.4.20 for a project that I've been working on. And for the I've created a C file to try the system call works or not and I've been getting the same error, Dereferencing pointer to imcomplete type, for days. My header file is here:
struct prcdata {long counter; /* process counter value */long nice; /* process nice value */long prio; /* calculated with 20- processes’ nice value */long weight; /* calculated with 20-nice+counter */pid_t pid; /* process id */long uid; /* user id of process owner */int nofprocess; /* number of process of owner of current process*/};
My C file for the system call is like this
#include <linux/mysyscall.h>asmlinkage int cprocinf(struct prcdata *data){ cli(); struct prcdata temp; copy_from_user(&temp,data,sizeof(struct prcdata)); temp.prio=20-current->nice; temp.weight=current->counter + temp.prio; temp.rank=2*current->nice; temp.pid=current->pid; temp.uid=current->uid; temp.processcount=current->user->proccesses.counter; copy_to_user(data,&temp,sizeof(struct prcdata)); return 0; sti();}
And the file to try this code is like this
#include <linux/mysyscall.h>#include <stdio.h>main(){int ret;struct prcdata *data; ret=mysyscall(data);printf("First values of process\n");printf("Nice Value. %d\nPriority: %d\n", -data->prio+20,data->prio);printf("Weight: %d\n", data->weight);printf("Rank: %d\nPid: %d\nPid: %d\nParent: %d\nProcess Count: %d\n",data->rank,data->pid,data->pidparent,data->processcount);}
What am I doing wrong