[BACK]Return to unmap.c CVS log [TXT][DIR] Up to [Development] / linux-2.6-xfs / arch / um / sys-i386

File: [Development] / linux-2.6-xfs / arch / um / sys-i386 / Attic / unmap.c (download)

Revision 1.2, Tue Oct 31 15:49:12 2006 UTC (10 years, 11 months ago) by tes.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.1: +4 -7 lines

Merge up to 2.6.19-rc3
Merge of 2.6.x-xfs-melb:linux:27325b by kenmcd.

/*
 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
 * Licensed under the GPL
 */

#include <linux/mman.h>
#include <asm/unistd.h>
#include <sys/syscall.h>

int switcheroo(int fd, int prot, void *from, void *to, int size)
{
	if (syscall(__NR_munmap, to, size) < 0){
		return(-1);
	}
	if (syscall(__NR_mmap2, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
		return(-1);
	}
	if (syscall(__NR_munmap, from, size) < 0){
		return(-1);
	}
	return(0);
}