From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] syscall: Add userfaultfd testcase
Date: Fri, 15 Mar 2019 09:25:28 +0100 [thread overview]
Message-ID: <20190315082528.GA25064@dell5510> (raw)
In-Reply-To: <824216999.8470703.1552563760595.JavaMail.zimbra@redhat.com>
Hi Christian,
some explanation below.
> Hi,
> my main concern is that direct include of linux header.
> Other than that it looks ok, but you could use more SAFE_ macros
> which do the common checks and print error messages for you.
> <snip>
> > +#include "tst_test.h"
> > +#include "lapi/syscalls.h"
> > +#include <linux/userfaultfd.h>
> This doesn't look like it will compile on older kernels.
Please add linux/userfaultfd.h to AC_CHECK_HEADERS in configure.ac
and use #ifdef HAVE_LINUX_USERFAULTFD_H guard and TST_TEST_TCONF with error
message.
...
> > +static void set_pages(void)
> > +{
> > + page_size = sysconf(_SC_PAGE_SIZE);
> > + page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
> > + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> > + copy_page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
> > + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> Please use SAFE_MMAP
There are many of SAFE_*() macro helpers, which are supposed to be used
(see include/tst_safe_*.h and doc [1])
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#22-writing-a-test-in-c
next prev parent reply other threads:[~2019-03-15 8:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 8:57 [LTP] [PATCH v2] syscall: Add userfaultfd testcase Christian Amann
2019-03-14 11:42 ` Jan Stancek
2019-03-15 8:25 ` Petr Vorel [this message]
2019-03-15 8:31 ` Petr Vorel
2019-03-15 8:38 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190315082528.GA25064@dell5510 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox