1typedef struct memblk { 2 char*p; /* where it starts */ 3 long len; /* currently allocated size */ 4#ifdef USE_MMAP 5 off_t filelen; /* how long is the file */ 6 int fd; /* file which is mmap()ed */ 7#endif 8} memblk; 9 10typedef char*(read_func_type) P((char*,long,void*)); 11typedef int(cleanup_func_type) P((memblk*,long*,long,void*)); 12 13void 14 makeblock P((memblk*const,const long)), /* create block of the given length */ 15 freeblock P((memblk*const)), /* deallocate it */ 16 lockblock P((memblk*const)); /* protect this block from future changes */ 17int /* by this process */ 18 resizeblock P((memblk*const,const long,const int)); /* change the size */ 19char /* dynamically grow a block to fit data as it comes in */ 20 *read2blk P((memblk*const,long*const,read_func_type*,cleanup_func_type*,void*)); 21 22#ifdef USE_MMAP 23extern int ISprivate; /* is themail a private copy or shared? */ 24#define isprivate (themail.fd<0||ISprivate) 25#define private(x) (ISprivate=(x)) 26#else 27#define isprivate 1 28#define private(x) 1 29#endif 30 31extern memblk themail; 32