<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 9, 2020 at 5:52 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> +#define _GNU_SOURCE<br>
>  #include <unistd.h><br>
> +#include <sys/syscall.h><br>
<br>
Defining _GNU_SOURCE anywhere but at the top of the test source is<br>
meaningless. It has to be defined before we include any libc headers<br>
otherwise it's ignored.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I got the point. And yes, that means the definition should be removed from the tst_device.h header file.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>  /*<br>
> diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise01.c b/testcases/kernel/syscalls/fadvise/posix_fadvise01.c<br>
> index 2af040840..f5d7ca8ac 100644<br>
> --- a/testcases/kernel/syscalls/fadvise/posix_fadvise01.c<br>
> +++ b/testcases/kernel/syscalls/fadvise/posix_fadvise01.c<br>
> @@ -20,6 +20,7 @@<br>
>   *   None<br>
>   */<br>
>  <br>
> +#define _GNU_SOURCE<br>
>  #define _XOPEN_SOURCE 600<br>
>  #include <fcntl.h><br>
<br>
Why do we need the _GNU_SOURCE here? We switched to a syscall() in the<br>
header, hence we do not need the syncfs() prototype anymore.<br><br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">But shouldn't we define the _GNU_SOURCE for syscall()?  Otherwise, the _XOPEN_SOURCE 600 definitions will take effect and makes the compiler print new errors[1].</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Here I fee a little confused, or do we need to delete the _XOPEN_SOURCE definition directly for the test posix_fadvise01.c?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">[1]:</div><div class="gmail_default" style="font-size:small">gcc -Werror=implicit-function-declaration -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition  -I/root/ltp2/testcases/kernel/syscalls/fadvise -I/root/ltp2/testcases/kernel/syscalls/fadvise/../utils -I../../../../include -I../../../../include -I../../../../include/old/   -L../../../../lib  posix_fadvise01.c   -lltp -o posix_fadvise01<br>In file included from ../../../../include/tst_test.h:22,<br>                 from posix_fadvise01.c:31:<br>../../../../include/tst_device.h: In function ‘tst_dev_sync’:<br>../../../../include/tst_device.h:82:9: error: implicit declaration of function ‘syscall’; did you mean ‘strcoll’? [-Werror=implicit-function-declaration]<br>  return syscall(__NR_syncfs, fd);<br>         ^~~~~~~<br>         strcoll</div></div><div class="gmail_default" style="font-size:small"></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>