diff options
author | Paul Mackerras <paulus@samba.org> | 2006-05-05 15:45:48 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-05 15:45:48 +1000 |
commit | f18fc729cd2d67b76e24206ee3567c1f6983c358 (patch) | |
tree | 9dbf177222d94213d9dd82d67de6d905e1a2b278 /arch/um/os-Linux/process.c | |
parent | 5a43ee65620d628ba04deecf241b63b2410b97f2 (diff) | |
parent | d98550e334715b2d9e45f8f0f4e1608720108640 (diff) | |
download | blackbird-op-linux-f18fc729cd2d67b76e24206ee3567c1f6983c358.tar.gz blackbird-op-linux-f18fc729cd2d67b76e24206ee3567c1f6983c358.zip |
Merge ../linux-2.6
Diffstat (limited to 'arch/um/os-Linux/process.c')
-rw-r--r-- | arch/um/os-Linux/process.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 3505f44f8a25..233be2f4f8cb 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -206,29 +206,36 @@ int os_drop_memory(void *addr, int length) int 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)) |