From 6c2a934b79c22feb4f143e2ebab6772d399b10a1 Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Sat, 25 Mar 2017 15:47:29 +0000 Subject: [PATCH] Implement Linux mincore() system call. This is necessary for the upcoming drm-next. Suggested by: hselasky@ MFC after: 1 month --- sys/amd64/linux/linux_dummy.c | 1 - sys/amd64/linux32/linux32_dummy.c | 1 - sys/compat/linux/linux_misc.c | 14 ++++++++++++++ sys/i386/linux/linux_dummy.c | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/amd64/linux/linux_dummy.c b/sys/amd64/linux/linux_dummy.c index 0a34dc121f1d..96f055958627 100644 --- a/sys/amd64/linux/linux_dummy.c +++ b/sys/amd64/linux/linux_dummy.c @@ -59,7 +59,6 @@ UNIMPLEMENTED(tuxcall); UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); -DUMMY(mincore); DUMMY(sendfile); DUMMY(syslog); DUMMY(setfsuid); diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c index 2c8d6b579e41..d0f04b183adc 100644 --- a/sys/amd64/linux32/linux32_dummy.c +++ b/sys/amd64/linux32/linux32_dummy.c @@ -79,7 +79,6 @@ DUMMY(sendfile); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(pivot_root); -DUMMY(mincore); DUMMY(ptrace); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 2ce3be2b50e8..a660928795b4 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2534,3 +2534,17 @@ linux_getrandom(struct thread *td, struct linux_getrandom_args *args) return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); } + +int +linux_mincore(struct thread *td, struct linux_mincore_args *args) +{ + struct mincore_args bsd_args; + + /* Needs to be page-aligned */ + if (args->start & PAGE_MASK) + return (EINVAL); + bsd_args.addr = PTRIN(args->start); + bsd_args.len = args->len; + bsd_args.vec = args->vec; + return (sys_mincore(td, &bsd_args)); +} diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c index c025cecfc42f..1867cfebdd2c 100644 --- a/sys/i386/linux/linux_dummy.c +++ b/sys/i386/linux/linux_dummy.c @@ -82,7 +82,6 @@ DUMMY(sendfile); /* different semantics */ DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(pivot_root); -DUMMY(mincore); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); DUMMY(mbind);