UML - Clean up after MADVISE_REMOVE
PATCH 4/6 UML - Clean up after MADVISE_REMOVE
The MADVISE_REMOVE-checking code didn't clean up after itself.
Signed-off-by Jeff Dike <[email protected]>
arch/um/os-Linux/process.c +12 -5
@@ -206,29 +206,36 @@ int os_drop_memory(void *addr, int lengtint can_drop_memory (void ) {void *addr; -int fd; +int fd, ok =0 ;printk ("Checking host MADV_REMOVE support..." ); fd =create_mem_file (UM_KERN_PAGE_SIZE );if (fd <0 ){printk ("Creating test memory file failed, err = %d\n" , -fd); -return 0 ; + goto out; } addr =mmap64 (NULL ,UM_KERN_PAGE_SIZE ,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );if (addr ==MAP_FAILED ){printk ("Mapping test memory file failed, err = %d\n" , -errno); -return 0 ; + goto out_close; }if (madvise (addr,UM_KERN_PAGE_SIZE ,MADV_REMOVE ) !=0 ){printk ("MADV_REMOVE failed, err = %d\n" , -errno); -return 0 ; + goto out_unmap; }printk ("OK\n" ); -return 1 ; + ok =1 ; + +out_unmap: +munmap (addr,UM_KERN_PAGE_SIZE ); +out_close: +close (fd); +out: +return ok; }void init_new_thread_stack (void *sig_stack,void (*usr1_handler)(int ))
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel