[1/1] preadv, pwritev: Fix preadv and pwritev link errors on android
diff mbox series

Message ID 20190423221244.27287-1-pvorel@suse.cz
State Accepted
Delegated to: Petr Vorel
Headers show
Series
  • [1/1] preadv, pwritev: Fix preadv and pwritev link errors on android
Related show

Commit Message

Petr Vorel April 23, 2019, 10:12 p.m. UTC
From: Petr Vorel <petr.vorel@gmail.com>

pwritev() declaration on in bionic C library is guarded with __USE_GNU,
therefore define _GNU_SOURCE.

This fixes link errors implicit declaration errors.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
Hi,

this is IMHO better than adding -D_GNU_SOURCE into CFLAGS.

Kind regards,
Petr
---
 testcases/kernel/syscalls/preadv/preadv01.c   | 2 ++
 testcases/kernel/syscalls/preadv/preadv02.c   | 2 ++
 testcases/kernel/syscalls/pwritev/pwritev02.c | 2 ++
 3 files changed, 6 insertions(+)

Comments

Steve Muckle April 24, 2019, 12:01 a.m. UTC | #1
Reviewed-by: Steve Muckle <smuckle@google.com>

On 4/23/19 3:12 PM, Petr Vorel wrote:
> From: Petr Vorel <petr.vorel@gmail.com>
> 
> pwritev() declaration on in bionic C library is guarded with __USE_GNU,
> therefore define _GNU_SOURCE.
> 
> This fixes link errors implicit declaration errors.
> 
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> Hi,
> 
> this is IMHO better than adding -D_GNU_SOURCE into CFLAGS.
> 
> Kind regards,
> Petr
> ---
>   testcases/kernel/syscalls/preadv/preadv01.c   | 2 ++
>   testcases/kernel/syscalls/preadv/preadv02.c   | 2 ++
>   testcases/kernel/syscalls/pwritev/pwritev02.c | 2 ++
>   3 files changed, 6 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c
> index 0565a086b..2b4ad5e20 100644
> --- a/testcases/kernel/syscalls/preadv/preadv01.c
> +++ b/testcases/kernel/syscalls/preadv/preadv01.c
> @@ -23,6 +23,8 @@
>   * and after reading the file, the file offset is not changed.
>   */
>   
> +#define _GNU_SOURCE
> +
>   #include <string.h>
>   #include <sys/uio.h>
>   
> diff --git a/testcases/kernel/syscalls/preadv/preadv02.c b/testcases/kernel/syscalls/preadv/preadv02.c
> index af1c3b0c4..9935e3835 100644
> --- a/testcases/kernel/syscalls/preadv/preadv02.c
> +++ b/testcases/kernel/syscalls/preadv/preadv02.c
> @@ -38,6 +38,8 @@
>   * 8) preadv(2) should return -1 and set errno to ESPIPE.
>   */
>   
> +#define _GNU_SOURCE
> +
>   #include <sys/uio.h>
>   #include <unistd.h>
>   #include "tst_test.h"
> diff --git a/testcases/kernel/syscalls/pwritev/pwritev02.c b/testcases/kernel/syscalls/pwritev/pwritev02.c
> index 2e6dbab57..9d8ff8725 100644
> --- a/testcases/kernel/syscalls/pwritev/pwritev02.c
> +++ b/testcases/kernel/syscalls/pwritev/pwritev02.c
> @@ -36,6 +36,8 @@
>   * 7) pwritev(2) should return -1 and set errno to ESPIPE.
>   */
>   
> +#define _GNU_SOURCE
> +
>   #include <sys/uio.h>
>   #include <unistd.h>
>   #include "tst_test.h"
>
Xiao Yang April 24, 2019, 8:17 a.m. UTC | #2
Hi Petr,

LGTM.
Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Best Regards,
Xiao Yang
On 2019/04/24 6:12, Petr Vorel wrote:
> From: Petr Vorel<petr.vorel@gmail.com>
>
> pwritev() declaration on in bionic C library is guarded with __USE_GNU,
> therefore define _GNU_SOURCE.
>
> This fixes link errors implicit declaration errors.
>
> Signed-off-by: Petr Vorel<petr.vorel@gmail.com>
> ---
> Hi,
>
> this is IMHO better than adding -D_GNU_SOURCE into CFLAGS.
>
> Kind regards,
> Petr
> ---
>   testcases/kernel/syscalls/preadv/preadv01.c   | 2 ++
>   testcases/kernel/syscalls/preadv/preadv02.c   | 2 ++
>   testcases/kernel/syscalls/pwritev/pwritev02.c | 2 ++
>   3 files changed, 6 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c
> index 0565a086b..2b4ad5e20 100644
> --- a/testcases/kernel/syscalls/preadv/preadv01.c
> +++ b/testcases/kernel/syscalls/preadv/preadv01.c
> @@ -23,6 +23,8 @@
>   * and after reading the file, the file offset is not changed.
>   */
>
> +#define _GNU_SOURCE
> +
>   #include<string.h>
>   #include<sys/uio.h>
>
> diff --git a/testcases/kernel/syscalls/preadv/preadv02.c b/testcases/kernel/syscalls/preadv/preadv02.c
> index af1c3b0c4..9935e3835 100644
> --- a/testcases/kernel/syscalls/preadv/preadv02.c
> +++ b/testcases/kernel/syscalls/preadv/preadv02.c
> @@ -38,6 +38,8 @@
>   * 8) preadv(2) should return -1 and set errno to ESPIPE.
>   */
>
> +#define _GNU_SOURCE
> +
>   #include<sys/uio.h>
>   #include<unistd.h>
>   #include "tst_test.h"
> diff --git a/testcases/kernel/syscalls/pwritev/pwritev02.c b/testcases/kernel/syscalls/pwritev/pwritev02.c
> index 2e6dbab57..9d8ff8725 100644
> --- a/testcases/kernel/syscalls/pwritev/pwritev02.c
> +++ b/testcases/kernel/syscalls/pwritev/pwritev02.c
> @@ -36,6 +36,8 @@
>   * 7) pwritev(2) should return -1 and set errno to ESPIPE.
>   */
>
> +#define _GNU_SOURCE
> +
>   #include<sys/uio.h>
>   #include<unistd.h>
>   #include "tst_test.h"
Petr Vorel April 24, 2019, 8:23 a.m. UTC | #3
Hi Steve, Xiao,

> Hi Petr,

> LGTM.
> Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks for your review, pushed.

Kind regards,
Petr
阮正旺 April 24, 2019, 8:28 a.m. UTC | #4
Hi Petr,


-------- Original Message --------
From: Petr Vorel
Sent: Wed, 24 Apr 2019 10:23:36 +0200
To: Xiao Yang
Cc: Ltp
Subject: Re: [LTP] [PATCH 1/1] preadv, pwritev: Fix preadv and pwritev 
link errors on android
> Hi Steve, Xiao,
>
>> Hi Petr,
>> LGTM.
>> Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> Thanks for your review, pushed.

This is cool! I also suffered from this issue. :-)

Regards,
Zhengwang

> Kind regards,
> Petr
>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body smarttemplateinserted="true">
    <div id="smartTemplate4-template">
      <p>Hi Petr, <br>
      </p>
    </div>
    <br>
    <div id="smartTemplate4-quoteHeader">-------- Original Message --------<br>
      From: Petr Vorel<br>
      Sent: Wed, 24 Apr 2019 10:23:36 +0200<br>
      To: Xiao Yang<br>
      Cc: Ltp<br>
      Subject: Re: [LTP] [PATCH 1/1] preadv, pwritev: Fix preadv and
      pwritev link errors on android<br>
    </div>
    <blockquote type="cite" cite="mid:20190424082336.GA17477@dell5510">
      <pre class="moz-quote-pre" wrap="">Hi Steve, Xiao,

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Hi Petr,
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">LGTM.
Acked-by: Xiao Yang <a class="moz-txt-link-rfc2396E" href="mailto:yangx.jy@cn.fujitsu.com">&lt;yangx.jy@cn.fujitsu.com&gt;</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Thanks for your review, pushed.
</pre>
    </blockquote>
    <p>This is cool! I also suffered from this issue. :-)</p>
    <p>Regards,<br>
      Zhengwang<br>
    </p>
    <blockquote type="cite" cite="mid:20190424082336.GA17477@dell5510">
      <pre class="moz-quote-pre" wrap="">
Kind regards,
Petr

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

Patch
diff mbox series

diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c
index 0565a086b..2b4ad5e20 100644
--- a/testcases/kernel/syscalls/preadv/preadv01.c
+++ b/testcases/kernel/syscalls/preadv/preadv01.c
@@ -23,6 +23,8 @@ 
 * and after reading the file, the file offset is not changed.
 */
 
+#define _GNU_SOURCE
+
 #include <string.h>
 #include <sys/uio.h>
 
diff --git a/testcases/kernel/syscalls/preadv/preadv02.c b/testcases/kernel/syscalls/preadv/preadv02.c
index af1c3b0c4..9935e3835 100644
--- a/testcases/kernel/syscalls/preadv/preadv02.c
+++ b/testcases/kernel/syscalls/preadv/preadv02.c
@@ -38,6 +38,8 @@ 
 * 8) preadv(2) should return -1 and set errno to ESPIPE.
 */
 
+#define _GNU_SOURCE
+
 #include <sys/uio.h>
 #include <unistd.h>
 #include "tst_test.h"
diff --git a/testcases/kernel/syscalls/pwritev/pwritev02.c b/testcases/kernel/syscalls/pwritev/pwritev02.c
index 2e6dbab57..9d8ff8725 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev02.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev02.c
@@ -36,6 +36,8 @@ 
 * 7) pwritev(2) should return -1 and set errno to ESPIPE.
 */
 
+#define _GNU_SOURCE
+
 #include <sys/uio.h>
 #include <unistd.h>
 #include "tst_test.h"