home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / manage / snmp / mit / bsd / kmem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-17  |  734 b   |  46 lines

  1.  
  2. /*
  3.  *    $Header: kmem.c,v 3.0 91/05/17 16:14:21 jrd Rel $
  4.  *    Author: J. Davin
  5.  *    Copyright 1988, 1989, Massachusetts Institute of Technology
  6.  *    See permission and disclaimer notice in file "notice.h"
  7.  */
  8.  
  9. #include    <notice.h>
  10.  
  11.  
  12. #include    <ctypes.h>
  13. #include    <debug.h>
  14.  
  15. #include    <stdio.h>
  16. #include    <sys/types.h>
  17. #include    <sys/file.h>
  18.  
  19. static        int        kmemFd;
  20.  
  21. CVoidType        kmemInit ()
  22.  
  23. {
  24.     if ((kmemFd = open ("/dev/kmem", O_RDONLY, 0)) == -1) {
  25.         perror ("kmemInit");
  26.     }
  27. }
  28.  
  29. CIntfType        kmemRead (bp, n, addr)
  30.  
  31. CBytePtrType        bp;
  32. CIntfType        n;
  33. CUnslType        addr;
  34.  
  35. {
  36.     off_t            lseek ();
  37.  
  38.     if (lseek (kmemFd, (off_t) addr, L_SET) == (off_t) -1) {
  39.         return ((CIntfType) -1);
  40.     }
  41.     else {
  42.         return ((CIntfType) read (kmemFd, (char *) bp, (int) n));
  43.     }
  44. }
  45.  
  46.