<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  </head>
  <body>
    <pre>
</pre>
    <div class="moz-cite-prefix">
      <pre>on 2019/11/12 18:10, Cyril Hrubis wrote:</pre>
    </div>
    <blockquote type="cite" cite="mid:20191112101054.GA9373@rei.lan">
      <pre class="moz-quote-pre" wrap="">Hi!
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">1) Add fallback definitions to lapi
2) Ensure these tests does not fail on older kernels

    We do expect EINVAL in these cases anyways, which is what we would
    get if the prctl() option is unknown to the kernel anyways, so here
    we can just get rid of these ifdefs and things should work fine.
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
For me, a fallback definitions into the lapi header is only for fixing undefined error on old kernel.

IMO, we only test options that kernel supports.
If we test an unsupported option, our case reports EINVAL that will give user a false impression(kernel
supports it, but argument or environment is bad). I think we should check they whether supported before run
(ifdef is a way).
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
However using ifdefs to assert kernel features never worked at all. The
kernel headers usally lag behind the installed kernel in distribution
and it's even more wrong when you are testing latest kernel on any given
distro.

If you want to check for kernel support the best thing is to use the
tst_kvercmp() that checks the kernel version and even that does not work
100% reliably.
</pre>
    </blockquote>
    <pre>Yes. most distros backport upstream kernel patch and tst_kvercmp maybe useless.</pre>
    <blockquote type="cite" cite="mid:20191112101054.GA9373@rei.lan">
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">ps: If we test EPERM error(cap is not in PI or PP) of PR_CAP_AMBIENT on old kernel,  they will report EINVAL.
So, I think ifdef is needed.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
No, ifdefs are never solution here. It will still fail if you compiled
the test on newer distro and booted it up with older kernel.</pre>
    </blockquote>
    <pre>Now, I agree with you. If new distro and booted it with older kernel, the ifdef is useless. I think we should use correct argument
as xiao said to check whether kernel supports these options.
</pre>
    <blockquote type="cite" cite="mid:20191112101054.GA9373@rei.lan">
      <pre class="moz-quote-pre" wrap="">

</pre>
    </blockquote>
  </body>
</html>