linux(4): Deduplicate mprotect, madvise

MFC after:		1 week
This commit is contained in:
Dmitry Chagin 2023-09-05 21:15:52 +03:00
parent 9636299233
commit 553b1a4e4e
5 changed files with 17 additions and 58 deletions

View file

@ -97,20 +97,6 @@ linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
args->flags, args->fd, args->pgoff));
}
int
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
{
return (linux_mprotect_common(td, uap->addr, uap->len, uap->prot));
}
int
linux_madvise(struct thread *td, struct linux_madvise_args *uap)
{
return (linux_madvise_common(td, uap->addr, uap->len, uap->behav));
}
int
linux_iopl(struct thread *td, struct linux_iopl_args *args)
{

View file

@ -62,7 +62,6 @@
#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_fork.h>
#include <compat/linux/linux_ipc.h>
#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_mmap.h>
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_util.h>
@ -345,20 +344,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args *args)
(uint32_t)linux_args.pgoff));
}
int
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
{
return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot));
}
int
linux_madvise(struct thread *td, struct linux_madvise_args *uap)
{
return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav));
}
int
linux_iopl(struct thread *td, struct linux_iopl_args *args)
{

View file

@ -77,21 +77,6 @@ linux_mmap2(struct thread *td, struct linux_mmap2_args *uap)
uap->flags, uap->fd, uap->pgoff));
}
int
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
{
return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len,
uap->prot));
}
int
linux_madvise(struct thread *td, struct linux_madvise_args *uap)
{
return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav));
}
int
linux_set_cloned_tls(struct thread *td, void *desc)
{

View file

@ -75,6 +75,7 @@
#include <compat/linux/linux_dtrace.h>
#include <compat/linux/linux_file.h>
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_mmap.h>
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_time.h>
#include <compat/linux/linux_util.h>
@ -348,6 +349,22 @@ linux_msync(struct thread *td, struct linux_msync_args *args)
args->fl & ~LINUX_MS_SYNC));
}
int
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
{
return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len,
uap->prot));
}
int
linux_madvise(struct thread *td, struct linux_madvise_args *uap)
{
return (linux_madvise_common(td, PTROUT(uap->addr), uap->len,
uap->behav));
}
#ifdef LINUX_LEGACY_SYSCALLS
int
linux_time(struct thread *td, struct linux_time_args *args)

View file

@ -332,20 +332,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args *args)
(uint32_t)linux_args.pgoff));
}
int
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
{
return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot));
}
int
linux_madvise(struct thread *td, struct linux_madvise_args *uap)
{
return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav));
}
int
linux_ioperm(struct thread *td, struct linux_ioperm_args *args)
{