pthonda@bgsuvax.UUCP (Killer B) (04/07/91)
Hi, I am trying to read the status of all the processes information in the system. I came to know that the file 'vmunix' contains a pointer to a location in file 'kmem'.This location has another pointer to the starting of process structures in kmem, which would give me process information. Can anybody tell me how to get the pointer in the file 'vmunix' . Should I use nlist, if so , in what way. Thanx in advance . Pratap
longshot@en.ecn.purdue.edu (Longshot (tm)) (04/08/91)
In article <7275@bgsuvax.UUCP> pthonda@bgsuvax.UUCP (Killer B) writes: >Hi, I am trying to read the status of all the processes information >in the system. I came to know that the file 'vmunix' contains a pointer >to a location in file 'kmem'.This location has another pointer to the >starting of process structures in kmem, which would give me process >information. Can anybody tell me how to get the pointer in the file >'vmunix' . Should I use nlist, if so , in what way. I have done a little playing with this and had a few questions myself... (1) Is there a good reference to help in programming with references to special files like kmem? (2) How would one find the list of all processes for a user by tty? --longshot -- longshot@ecn.purdue.edu (Rich Long) To be "remembered with an affection and veneration that shall surge high above the waters of oblivion and glisten through the rust of time."
mike@bria.UUCP (Michael Stefanik) (04/10/91)
In an article, en.ecn.purdue.edu!longshot (Longshot (tm)) writes: >I have done a little playing with this and had a few questions >myself... (1) Is there a good reference to help in programming with >references to special files like kmem? (2) How would one find the >list of all processes for a user by tty? The manual pages are woefully uninformative in respect to sloshing through /dev/kmem (and probably with good reason :-) Finding all of the processes for a user by tty would acutally not be that difficult; you would simply use nlist() to find the _proc symbol in the kernel, seek to the ``address'' given in /dev/kmem, and start reading, looking for the correct line. -- Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic Title of the week: Systems Engineer | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- If MS-DOS didn't exist, who would UNIX programmers have to make fun of?
meissner@osf.org (Michael Meissner) (04/11/91)
In article <176@bria.UUCP> mike@bria.UUCP (Michael Stefanik) writes: | In an article, en.ecn.purdue.edu!longshot (Longshot (tm)) writes: | >I have done a little playing with this and had a few questions | >myself... (1) Is there a good reference to help in programming with | >references to special files like kmem? (2) How would one find the | >list of all processes for a user by tty? | | The manual pages are woefully uninformative in respect to sloshing through | /dev/kmem (and probably with good reason :-) Yeah, stuff in there changes from OS revision to OS revision. | Finding all of the processes for a user by tty would acutally not be that | difficult; you would simply use nlist() to find the _proc symbol in the | kernel, seek to the ``address'' given in /dev/kmem, and start reading, looking | for the correct line. Some systems have a system call to do this for you. For example, OSF/1 supports table which gives you the proc table for the next n processes. On System V.4, you should be able to just opendir /proc, and zip through the processes that way. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?