Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Sep 2023 07:49:43 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4d1723961743 - stable/14 - linux(4): Deduplicate mprotect, madvise
Message-ID:  <202309120749.38C7nhuG072240@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=4d17239617439b9a500f4c7a59f5f4d323d252b7

commit 4d17239617439b9a500f4c7a59f5f4d323d252b7
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-09-05 18:15:52 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-09-12 07:48:39 +0000

    linux(4): Deduplicate mprotect, madvise
    
    MFC after:              1 week
    
    (cherry picked from commit 553b1a4e4eb426d2c29a033b284c13bfbab30334)
---
 sys/amd64/linux/linux_machdep.c     | 14 --------------
 sys/amd64/linux32/linux32_machdep.c | 15 ---------------
 sys/arm64/linux/linux_machdep.c     | 15 ---------------
 sys/compat/linux/linux_misc.c       | 17 +++++++++++++++++
 sys/i386/linux/linux_machdep.c      | 14 --------------
 5 files changed, 17 insertions(+), 58 deletions(-)

diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index 2d2c5bb55ac8..7da1dccd6b45 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -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)
 {
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index f6b14d8e4653..fb088ae37b26 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -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)
 {
diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 9c9d56ca9949..b9548387315b 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -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)
 {
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 5e692fea1ea7..b9c67d513cd3 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -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)
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index 8dbcbcd2609e..7f1738cda845 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309120749.38C7nhuG072240>