[LTP] [PATCH 04/31] test.h: Remove MAP_PRIVATE_EXCEPT_UCLINUX

Petr Vorel
2024-04-11T14:31:41Z

Replace it with MAP_PRIVATE.
It was defined only to support UCLINUX.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/old/test.h | 5 -----
testcases/kernel/syscalls/munmap/munmap03.c | 3 +--
testcases/kernel/syscalls/writev/writev02.c | 3 +--
testcases/kernel/syscalls/writev/writev05.c | 3 +--
testcases/kernel/syscalls/writev/writev06.c | 8 ++++----
5 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/include/old/test.h b/include/old/test.h
index b17fbf856..8ccd5f5e8 100644
--- a/include/old/test.h
+++ b/include/old/test.h
@@ -68,18 +68,13 @@
/*
* fork() can't be used on uClinux systems, so use FORK_OR_VFORK instead,
* which will run vfork() on uClinux.
- * mmap() doesn't support MAP_PRIVATE on uClinux systems, so use
- * MAP_PRIVATE_EXCEPT_UCLINUX instead, which will skip the option on uClinux.
- * If MAP_PRIVATE really is required, the test can not be run on uClinux.
*/
#ifdef UCLINUX
# define FORK_OR_VFORK tst_vfork
-# define MAP_PRIVATE_EXCEPT_UCLINUX 0
/* tst_old_flush() + vfork() */
pid_t tst_vfork(void);
#else
# define FORK_OR_VFORK tst_fork
-# define MAP_PRIVATE_EXCEPT_UCLINUX MAP_PRIVATE
#endif

/*
diff --git a/testcases/kernel/syscalls/munmap/munmap03.c b/testcases/kernel/syscalls/munmap/munmap03.c
index 23875e7b3..60bcb93b0 100644
--- a/testcases/kernel/syscalls/munmap/munmap03.c
+++ b/testcases/kernel/syscalls/munmap/munmap03.c
@@ -87,8 +87,7 @@ static void setup(void)

global_maplen = page_sz * 2;
global_addr = SAFE_MMAP(cleanup, NULL, global_maplen, PROT_READ |
- PROT_WRITE, MAP_PRIVATE_EXCEPT_UCLINUX |
- MAP_ANONYMOUS, -1, 0);
+ PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}

static void check_and_print(int expected_errno)
diff --git a/testcases/kernel/syscalls/writev/writev02.c b/testcases/kernel/syscalls/writev/writev02.c
index 005f37a14..a7d11de30 100644
--- a/testcases/kernel/syscalls/writev/writev02.c
+++ b/testcases/kernel/syscalls/writev/writev02.c
@@ -179,8 +179,7 @@ void setup(void)
strcpy(name, DATA_FILE);
sprintf(f_name, "%s.%d", name, getpid());

- bad_addr = mmap(0, 1, PROT_NONE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (bad_addr == MAP_FAILED)
tst_brkm(TBROK | TERRNO, cleanup, "mmap failed");
wr_iovec[0].iov_base = bad_addr;
diff --git a/testcases/kernel/syscalls/writev/writev05.c b/testcases/kernel/syscalls/writev/writev05.c
index c939e7de0..6add2bcd4 100644
--- a/testcases/kernel/syscalls/writev/writev05.c
+++ b/testcases/kernel/syscalls/writev/writev05.c
@@ -210,8 +210,7 @@ void setup(void)
strcpy(name, DATA_FILE);
sprintf(f_name, "%s.%d", name, getpid());

- bad_addr = mmap(0, 1, PROT_NONE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (bad_addr == MAP_FAILED) {
printf("mmap failed\n");
}
diff --git a/testcases/kernel/syscalls/writev/writev06.c b/testcases/kernel/syscalls/writev/writev06.c
index e97ae6f21..b60c727b6 100644
--- a/testcases/kernel/syscalls/writev/writev06.c
+++ b/testcases/kernel/syscalls/writev/writev06.c
@@ -162,22 +162,22 @@ void setup(void)
/* Crate two readable and writeble mappings with non reabable
* mapping around */
bad_addr[0] = mmap(NULL, page_size * 3, PROT_NONE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (bad_addr[0] == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed for bad_addr[0]");

good_addr[0] = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (good_addr[0] == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed for good_addr[0]");

bad_addr[1] = mmap(NULL, page_size * 3, PROT_NONE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (bad_addr[1] == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed for bad_addr[1]");

good_addr[1] = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (good_addr[1] == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed for good_addr[1]");