home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / sgi / 13302 < prev    next >
Encoding:
Internet Message Format  |  1992-09-04  |  2.3 KB

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!uwm.edu!spool.mu.edu!olivea!sgigate!odin!twilight!zuni!anchor!olson
  2. From: olson@anchor.esd.sgi.com (Dave Olson)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: need /dev/kmem advice
  5. Message-ID: <pee0vpc@zuni.esd.sgi.com>
  6. Date: 4 Sep 92 18:23:59 GMT
  7. References: <Bu22JC.Hz5@mentor.cc.purdue.edu>
  8. Sender: news@zuni.esd.sgi.com (Net News)
  9. Organization: Silicon Graphics, Inc.  Mountain View, CA
  10. Lines: 41
  11.  
  12. In <Bu22JC.Hz5@mentor.cc.purdue.edu> abe@mace.cc.purdue.edu (Vic Abell) writes:
  13.  
  14. | I am trying to port an existing application to an SGI work station,
  15. | running IRIX 4.0.5.  The application uses nlist() to obtain kernel
  16. | addresses and reads kernel values via lseek() and read() calls on
  17. | a /dev/kmem descriptor.  It's an open-file lister, ala ofiles or
  18. | fstat, that I call lsof.
  19. | The nlist() works properly, but I have to strip the high order bit
  20. | (0x80000000) from the addresses it returns in order to avoid an EINVAL
  21. | from lseek().  If I do that, the values I get from read() seem correct.
  22. | I've even deduced (I think) how to read the user area structure from
  23. | some hints in <sys/proc.h> and <sys/immu.h>.  However, I can't find a
  24. | way to read the array of open file pointers, using the u_ofile pointer
  25. | in the user area.  If I strip its high order bit, I get an ENXIO error
  26. | from read().  The address appears to be in the kernel stack -- e.g.,
  27. | 0xffffc808.
  28.  
  29. The uarea, not the stack.  Most SVR3 kernels put the file table
  30. at the end of the defined part of the user struct, but still part
  31. of the uarea; that allows changing the max # of open files per
  32. user without changing offsets in the uarea (it may even go back
  33. further to SVR2, I just don't remember)
  34.  
  35. | So, two questions for the gurus of this news group.
  36. | 1. Is stripping the high order bit from kernel addresses the right way
  37. |    to use them via /dev/kmem?
  38.  
  39. For the most part, yes.
  40.  
  41. | 2. How does one read from addresses of form 0xffffc808?
  42.  
  43. You have to read the uarea for that process, and the best
  44. way to do that is with the syssgi system call  with SGI_RDUBLK.
  45. See 'man syssgi' for details.
  46. --
  47. Let no one tell me that silence gives consent,  |   Dave Olson
  48. because whoever is silent dissents.             |   Silicon Graphics, Inc.
  49.     Maria Isabel Barreno                        |   olson@sgi.com
  50.