FreeBSD/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
/*
 * In order to mmap a section from the ELF file, we must round down sh_offset
 * to the previous page boundary, and mmap the surrounding page.  We store
 * the pointer to the start of the actual section data back into sp->cts_data.
 */
In order to mmap a section from the ELF file, we must round down sh_offset
to the previous page boundary, and mmap the surrounding page.  We store
the pointer to the start of the actual section data back into sp->cts_data.
In order to mmap a section from the ELF file we must round down sh_offset to the previous page boundary and mmap the surrounding page . We store the pointer to the start of the actual section data back into sp - > cts_data .
const void *
ctf_sect_mmap(ctf_sect_t *sp, int fd)
{
	size_t pageoff = sp->cts_offset & ~_PAGEMASK;
	caddr_t base = mmap64(NULL, sp->cts_size + pageoff, PROT_READ,
	    MAP_PRIVATE, fd, sp->cts_offset & _PAGEMASK);
	if (base != MAP_FAILED)
		sp->cts_data = base + pageoff;
	return (base);
}
const void * ctf_sect_mmap ( ctf_sect_t * sp , int fd ) { size_t pageoff = sp -> cts_offset & ~ _PAGEMASK ; caddr_t base = mmap64 ( NULL , sp -> cts_size + pageoff , PROT_READ , MAP_PRIVATE , fd , sp -> cts_offset & _PAGEMASK ) ; if ( base != MAP_FAILED ) sp -> cts_data = base + pageoff ; return ( base ) ; }
In order to mmap a section from the ELF file, we must round down sh_offset
 to the previous page boundary, and mmap the surrounding page.
In order to mmap a section from the ELF file we must round down sh_offset to the previous page boundary and mmap the surrounding page .