In solaris 11.0 kernel module driver, I need to get the parent process id and start time, and continue doing it - climb up the process tree this way.
in Linux kernel I have struct_task contains process id, start time.
What is equivelant to struct_task, and how I can get it within process context ?
Thanks
I saw something like it in userspace code. but "open" cannot be used in kernel space..
char psfile[64];
pid_t pid;
int fd;
psinfo_t psinfo;
pid = getpid();
sprintf(psfile, "/proc/%d/psinfo", pid);
if ((fd = open(psfile, O_RDONLY)) >= 0) {
if (read(fd, &psinfo, sizeof(psinfo_t)) != -1) {
printf("Pid: %ld\n", psinfo.pr_pid);
printf("Up Start: (%ld, %ld)\n", psinfo.pr_start.tv_sec,
psinfo.pr_start.tv_nsec);
printf("Command: %s\n", psinfo.pr_fname);
return 0;
}
} else {
perror("Open psfino");
}
the whole concept of /proc/procid/psinfo is to allow userspace processes to read kernel data. Why do i need to get the data from /proc/procid/psinfo if im on kernel space, this is disk IO...