[PATCH v10 4/5] Implement testing framework for pidns
Ákos Uzonyi
uzonyi.akos at gmail.com
Thu Aug 20 18:07:53 UTC 2020
On Thu, 20 Aug 2020 at 19:51, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Wed, Aug 19, 2020 at 08:16:36PM +0200, Ákos Uzonyi wrote:
> [...]
> > +void
> > +pidns_test_init(void)
> > +{
> > + pidns_translation = true;
> > +
> > + check_ns_ioctl();
> > +
> > + if (!pidns_fork(-1, false))
> > + return;
> > +
> > + /* Unshare user namespace too, so we do not need to be root */
> > + if (unshare(CLONE_NEWUSER | CLONE_NEWPID) < 0) {
> > + if (errno == EPERM)
> > + perror_msg_and_skip("unshare");
> > +
> > + perror_msg_and_fail("unshare");
> > + }
>
> This code fails to compile on the following system:
> https://build.opensuse.org/package/live_build_log/home:ldv_alt/strace/RedHat_RHEL-5/x86_64
>
> pidns.c: In function 'pidns_test_init':
> pidns.c:204: error: 'CLONE_NEWUSER' undeclared (first use in this function)
> pidns.c:204: error: (Each undeclared identifier is reported only once
> pidns.c:204: error: for each function it appears in.)
> pidns.c:204: error: 'CLONE_NEWPID' undeclared (first use in this function)
>
> A similar compilation issue exists in fork--pidns-translation.c, too.
I think "#define _GNU_SOURCE" should be added to the beginning of the
file. I'll add it, hopefully it solves the problem.
More information about the Strace-devel
mailing list