1 --- mmc.c.orig Tue Oct 22 09:42:01 2002
2 +++ mmc.c Fri Nov 14 12:26:39 2003
14 /* Yep. Just return the existing map */
28 size_t size_size = (size_t) m->size; /* loses on files >2GB */
32 +#elif defined(HAVE_MMAP)
33 /* Map the file into memory. */
34 m->addr = mmap( 0, size_size, PROT_READ, MAP_PRIVATE, fd, 0 );
35 if ( m->addr == (void*) -1 && errno == ENOMEM )
38 #endif /* HAVE_MMAP */
43 +#endif /* !USE_SENDFILE */
44 /* Put the Map into the hash table. */
45 if ( add_hash( m ) < 0 )
48 /* Update the total byte count. */
49 mapped_bytes += m->size;
54 /* And return the address. */
61 if ( sbP != (struct stat*) 0 )
63 m = find_hash( sbP->st_ino, sbP->st_dev, sbP->st_size, sbP->st_ctime );
65 if ( m != (Map*) 0 && m->addr != addr )
70 /* If that didn't work, try a full search. */
72 for ( m = maps; m != (Map*) 0; m = m->next )
73 if ( m->addr == addr )
77 syslog( LOG_ERR, "mmc_unmap failed to find entry!" );
78 else if ( m->refcount <= 0 )
86 +#elif defined(HAVE_MMAP)
87 if ( munmap( m->addr, m->size ) < 0 )
88 syslog( LOG_ERR, "munmap - %m" );