[LTP] [PATCH v2 4/8] Cleanup mmap17 test
Cyril Hrubis
chrubis@suse.cz
Tue Feb 25 16:02:56 CET 2025
Hi!
> -/*
> - * Test mmap with MAP_FIXED_NOREPLACE flag
> +/*\
> + * [Description]
This shouldn't be there I now.
> - * We are testing the MAP_FIXED_NOREPLACE flag of mmap() syscall. To check
> + * Verify MAP_FIXED_NOREPLACE flag for the mmap() syscall and check
> * if an attempt to mmap at an exisiting mapping fails with EEXIST.
This should be really just:
Verify that MAP_FIXED_NOREPLACE does not replace existing mapping and
fails with EEXIST.
> + * [Algorithm]
> + *
> * The code allocates a free address by passing NULL to first mmap call
> - * Then tries to mmap with the same address using MAP_FIXED_NOREPLACE flag
> + * then tries to mmap with the same address using MAP_FIXED_NOREPLACE flag
> * and the mapping fails as expected.
Do we really need that part? I think that the test itself is so simple
that the single sentence above describes it completely.
> */
>
> -#include <stdio.h>
> -#include <fcntl.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <unistd.h>
> -#include <errno.h>
> -#include <string.h>
> -#include <stdlib.h>
> -#include "lapi/mmap.h"
> #include "tst_test.h"
>
> static int fd_file1;
And since you are touching the test we do not free the mapped address in
the case of -i parameter. So need to move the SAFE_MUNMAP() to the test
setup().
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list