2021-08-17 12:03:53

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH] perf, android: fixup get_current_dir_name() compilation

strdup() prototype doesn't live in stdlib.h .

Add limits.h for PATH_MAX definition as well.

Signed-off-by: Alexey Dobriyan (SK hynix) <[email protected]>
---

tools/perf/util/get_current_dir_name.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/perf/util/get_current_dir_name.c
+++ b/tools/perf/util/get_current_dir_name.c
@@ -3,8 +3,9 @@
//
#ifndef HAVE_GET_CURRENT_DIR_NAME
#include "get_current_dir_name.h"
+#include <limits.h>
+#include <string.h>
#include <unistd.h>
-#include <stdlib.h>

/* Android's 'bionic' library, for one, doesn't have this */


2021-08-19 16:30:48

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH] perf, android: fixup get_current_dir_name() compilation

Hello,

On Tue, Aug 17, 2021 at 4:59 AM Alexey Dobriyan <[email protected]> wrote:
>
> strdup() prototype doesn't live in stdlib.h .
>
> Add limits.h for PATH_MAX definition as well.
>
> Signed-off-by: Alexey Dobriyan (SK hynix) <[email protected]>

Acked-by: Namhyung Kim <[email protected]>

Thanks,
Namhyung


> ---
>
> tools/perf/util/get_current_dir_name.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/tools/perf/util/get_current_dir_name.c
> +++ b/tools/perf/util/get_current_dir_name.c
> @@ -3,8 +3,9 @@
> //
> #ifndef HAVE_GET_CURRENT_DIR_NAME
> #include "get_current_dir_name.h"
> +#include <limits.h>
> +#include <string.h>
> #include <unistd.h>
> -#include <stdlib.h>
>
> /* Android's 'bionic' library, for one, doesn't have this */
>

2021-08-19 18:43:41

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf, android: fixup get_current_dir_name() compilation

Em Thu, Aug 19, 2021 at 09:28:13AM -0700, Namhyung Kim escreveu:
> Hello,
>
> On Tue, Aug 17, 2021 at 4:59 AM Alexey Dobriyan <[email protected]> wrote:
> >
> > strdup() prototype doesn't live in stdlib.h .
> >
> > Add limits.h for PATH_MAX definition as well.
> >
> > Signed-off-by: Alexey Dobriyan (SK hynix) <[email protected]>
>
> Acked-by: Namhyung Kim <[email protected]>

Thanks, applied.

- Arnaldo