I am trying to implement a system call for the Linux kernel as a way to learn kernel programming and I have this C file :
Code:
#include "myprocess.h"
SYSCALL_DEFINE2(get_info, struct pid_info *, info, int, pid)
{
char *path;
int err;
...
...
//after finding the pid root path i am trying to copy it to user space
err = copy_to_user(info->root_path, path, strlen(path));
if (err)
return -EFAULT;
return 1;
}
Contents of myprocess header file :
Code:
...
struct pid_info {
int pid;
int state;
char root[4096];
};
When trying to access the path from user program it has nothing inside. I know am doing something wrong or missing something and I just can't figure it out. Any help will be appreciated.