ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / kernel / tt / unmap.c
1 /* 
2  * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include <stdio.h>
7 #include <errno.h>
8 #include <sys/mman.h>
9 #include "user.h"
10
11 int switcheroo(int fd, int prot, void *from, void *to, int size)
12 {
13         if(munmap(to, size) < 0){
14                 return(-1);
15         }
16         if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) != to){
17                 return(-1);
18         }
19         if(munmap(from, size) < 0){
20                 return(-1);
21         }
22         return(0);
23 }
24
25 /*
26  * Overrides for Emacs so that we follow Linus's tabbing style.
27  * Emacs will notice this stuff at the end of the file and automatically
28  * adjust the settings for this buffer only.  This must remain at the end
29  * of the file.
30  * ---------------------------------------------------------------------------
31  * Local variables:
32  * c-file-style: "linux"
33  * End:
34  */