home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Apps / DevTools / MachOViewer / Source / MappedFile.h < prev    next >
Encoding:
Text File  |  1994-02-10  |  1.8 KB  |  55 lines

  1. #import <stdlib.h>
  2. #import <libc.h>
  3. #import <errno.h>
  4. #import <assert.h>
  5. #import <sys/types.h>
  6. #import <sys/stat.h>
  7. #import <mach/mach.h>
  8. #import <mach/mach_error.h>
  9. #import <objc/Object.h>
  10.  
  11. //H+
  12. //
  13. //    MappedFile - simple memory-mapped file object.
  14. //
  15. //H-
  16.  
  17. /* $Id: MappedFile.h,v 1.2 94/02/10 22:19:52 ediger Exp Locker: ediger $ */
  18. /* $Log:    MappedFile.h,v $
  19.  * Revision 1.2  94/02/10  22:19:52  ediger
  20.  * added - (char *)errorString method to assist in error handling
  21.  * 
  22.  * Revision 1.1  94/02/07  21:35:26  ediger
  23.  * Initial revision
  24.  *  */
  25.  
  26. @interface MappedFile: Object
  27. {
  28.     // info that has to be here to map the file.
  29.     char       *FileName;
  30.  
  31.     // info that has to be kept around to unmap the file.
  32.     int         fd;
  33.     char       *mappedAddress;
  34.     struct stat statBuf;
  35.  
  36.     // auxilliary info to find out what the last error was.
  37.     int         lastErrno;          // Unix syscall errno
  38.     kern_return_t lastKernReturn;   // Mach kernel call error
  39. }
  40.  
  41. - init;                          // do a bit of initializing.
  42. - free;                          // clean up and ditch memory consumption.
  43. - filename:(char *)fileName;     // set the name of the file to be mapped.
  44. - (BOOL)map;                     // map the file after it's name is set.
  45. - (BOOL)unmap;                   // unmap a mapped file.
  46. - (char *)address;               // find out at what address file is mapped.
  47. - (char *)filename;              // find out the name of the mapped file.
  48. - (int)size;                     // find out what size of file is mapped.
  49. - (int)lastUnixError;            // find out what last UNIX syscall error was.
  50. - (kern_return_t)lastMachError;  // find out what last Mach syscall error was.
  51. - (char *)errorString;           // get error system error string related to
  52.                                  // last Mach or Unix error.
  53.  
  54. @end
  55.