[LTP] [PATCH v2] Rewrite process_vm_readv02.c test with new LTP API

Jan Stancek jstancek@redhat.com
Wed Jan 26 09:50:41 CET 2022


On Tue, Jan 25, 2022 at 2:17 PM Andrea Cervesato
<andrea.cervesato@suse.de> wrote:
>
> Removed pipe and replaced with shared memory.
> Replaced TST_CHECKPOINT_INIT usage with .needs_checkpoints from the new
> LTP API.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de>

<snip>

> -static void child_invoke(void)
> +static void child_invoke(const char *data, int length, pid_t pid_alloc)
>  {
> -       char *lp, *rp;
> -       char buf[BUFSIZ];
> +       char *lp;
>         struct iovec local, remote;
>
> -       /* get addr from pipe */
> -       SAFE_CLOSE(tst_exit, pipe_fd[1]);
> -       SAFE_READ(tst_exit, 0, pipe_fd[0], buf, BUFSIZ);
> -       SAFE_CLOSE(tst_exit, pipe_fd[0]);
> -       if (sscanf(buf, "%p", &rp) != 1)
> -               tst_brkm(TBROK | TERRNO, tst_exit, "sscanf");
> -
> -       lp = SAFE_MALLOC(tst_exit, len + 1);
> +       lp = SAFE_MALLOC(length + 1);

Seems we don't need that "+ 1", since we copy and compare only 'length',
but that's just a nit.

Acked-by: Jan Stancek <jstancek@redhat.com>



More information about the ltp mailing list