home *** CD-ROM | disk | FTP | other *** search
- #import <stdlib.h>
- #import <libc.h>
- #import <errno.h>
- #import <assert.h>
- #import <sys/types.h>
- #import <sys/stat.h>
- #import <mach/mach.h>
- #import <mach/mach_error.h>
- #import <objc/Object.h>
-
- //H+
- //
- // MappedFile - simple memory-mapped file object.
- //
- //H-
-
- /* $Id: MappedFile.h,v 1.2 94/02/10 22:19:52 ediger Exp Locker: ediger $ */
- /* $Log: MappedFile.h,v $
- * Revision 1.2 94/02/10 22:19:52 ediger
- * added - (char *)errorString method to assist in error handling
- *
- * Revision 1.1 94/02/07 21:35:26 ediger
- * Initial revision
- * */
-
- @interface MappedFile: Object
- {
- // info that has to be here to map the file.
- char *FileName;
-
- // info that has to be kept around to unmap the file.
- int fd;
- char *mappedAddress;
- struct stat statBuf;
-
- // auxilliary info to find out what the last error was.
- int lastErrno; // Unix syscall errno
- kern_return_t lastKernReturn; // Mach kernel call error
- }
-
- - init; // do a bit of initializing.
- - free; // clean up and ditch memory consumption.
- - filename:(char *)fileName; // set the name of the file to be mapped.
- - (BOOL)map; // map the file after it's name is set.
- - (BOOL)unmap; // unmap a mapped file.
- - (char *)address; // find out at what address file is mapped.
- - (char *)filename; // find out the name of the mapped file.
- - (int)size; // find out what size of file is mapped.
- - (int)lastUnixError; // find out what last UNIX syscall error was.
- - (kern_return_t)lastMachError; // find out what last Mach syscall error was.
- - (char *)errorString; // get error system error string related to
- // last Mach or Unix error.
-
- @end
-