b73781c866
MADV_REMOVE fixes - change the test mapping to be MAP_SHARED instead of MAP_PRIVATE, as MADV_REMOVE on MAP_PRIVATE maps won't work. Also, use the kernel's definition of MADV_REMOVE instead of hardcoding it if there isn't a libc definition. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Hugh Dickins <hugh@veritas.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
26 lines
650 B
C
26 lines
650 B
C
#include <linux/stddef.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/elf.h>
|
|
#include <asm/mman.h>
|
|
|
|
#define DEFINE(sym, val) \
|
|
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
|
|
|
|
#define STR(x) #x
|
|
#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
|
|
|
|
#define BLANK() asm volatile("\n->" : : )
|
|
|
|
#define OFFSET(sym, str, mem) \
|
|
DEFINE(sym, offsetof(struct str, mem));
|
|
|
|
void foo(void)
|
|
{
|
|
OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs);
|
|
DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
|
|
#ifdef CONFIG_MODE_TT
|
|
OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
|
|
#endif
|
|
#include <common-offsets.h>
|
|
}
|