Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26399
b: refs/heads/master
c: e3104f5
h: refs/heads/master
i:
  26397: 84769c5
  26395: c932945
  26391: 99f519f
  26383: 9decdb5
  26367: a2574cb
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed May 2, 2006
1 parent a65e7f8 commit 5105c1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 191ef966ac164a1ce3e06290ca52296744a4aee2
refs/heads/master: e3104f50d89b1fffe1fd973e32248a5c7f1bb41e
17 changes: 12 additions & 5 deletions trunk/arch/um/os-Linux/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5105c1f

Please sign in to comment.