I am working on a project that modifies part of the Android OS, and when I tried to implement a new system call to return the status of all the processes, I encountered the following error:
kernel/sys.c: error: array tpye has incomplete element type.
What I did in sys.c is the following:
/***previous code in sys.c***/
SYSCALL_DEFINE2(new_syscall, struct info __user*, buf, int __user*, nr){
if(!buf || !nr) return -EINVAL;
int nr_copy;
int success;
success = copy_from_user(&nr_copy, nr, sizeof(int));
if(success == 0) return -EINVAL;
if(nr_copy < 1) return -EINVAL;
struct info buf_copy[nr_copy]; /*************
return 0;
}
Complier complained about the line marked with stars.
My info.h file looks like this:
#ifndef __LINUX_INFO_H
#define __LINUX_INFO_H
struct info {
long state;
pid_t pid;
pid_t parent_pid;
};
#endif
I tried including the info.h in sys.c, but it didn't help at all. Can anyone provide me some directions on what I should look into?
Thanks