Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!mcnc!thorin!root From: root@thorin.cs.unc.edu (Superuser) Newsgroups: comp.unix.questions Subject: Reading /dev/kmem Message-ID: <6803@thorin.cs.unc.edu> Date: 17 Feb 89 14:30:55 GMT Organization: CS Dept., U. of N. Carolina, Chapel Hill Lines: 56 NEED HELP READING /dev/kmem: This semester I am taking a software development class, Comp145. My project requires that I read from /dev/kmem (i.e. kernel memory). My problem is that I can't figure out what string variable I should assign to nl[0].n_name, or if that is the source of my problem. Here is a segment of my source: ***************************************************************************** long pos,offset; int desc; off_t off__set; int x; struct proc process; struct nlist nl[2]; /** Structure w/ n_name and n_value **/ nl[0].n_name = "_qs"; /** String to search for and get offset**/ /** Not sure what value this should be **/ /** Pulled qs out of proc.h where it is **/ /** commented as being an array of struct- **/ /** ures containg bi-directional pointers **/ /** to type proc (i.e. process structure) **/ nl[1].n_name = ""; nlist("/vmunix",nl); /** Call nlist function to obtain offset **/ /** in nl[0].n_value **/ if(desc = open("/dev/kmem",O_RDONLY) == -1 ) { perror(" Error opening kmem ... "); } off__set = nl[0].n_value; for(x=0;x<10;++x) /** ??? not sure where to get value of x **/ { lseek(desc, (long) off__set,L_SET); /** move to offset for read **/ read(desc, &process, sizeof(process)); ******************************************************************************* Any answers, suggestions, advice and/or references to sources would be greatly appreciated. Thanks, Johnny D. Hamilton