read_all: Define FNM_EXTMATCH if not already (like under musl).

Message ID 1529939900-28259-1-git-send-email-daniel.diaz@linaro.org
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series
  • read_all: Define FNM_EXTMATCH if not already (like under musl).
Related show

Commit Message

Daniel Díaz June 25, 2018, 3:18 p.m.
With musl, FNM_EXTMATCH is not defined:
| read_all.c: In function 'read_test':
| read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
|   if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
|                                          ^~~~~~~~~~~~
|                                          FNM_NOMATCH
| read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
| <builtin>: recipe for target 'read_all' failed
| make[4]: *** [read_all] Error 1

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
---
 testcases/kernel/fs/read_all/read_all.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Petr Vorel July 23, 2018, 1:01 p.m. | #1
Hi Daniel,

> With musl, FNM_EXTMATCH is not defined:
> | read_all.c: In function 'read_test':
> | read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
> |   if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
> |                                          ^~~~~~~~~~~~
> |                                          FNM_NOMATCH
> | read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
> | <builtin>: recipe for target 'read_all' failed
> | make[4]: *** [read_all] Error 1

> Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
> ---
>  testcases/kernel/fs/read_all/read_all.c | 4 ++++
>  1 file changed, 4 insertions(+)

> diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
> index 42babae..f68217b 100644
> --- a/testcases/kernel/fs/read_all/read_all.c
> +++ b/testcases/kernel/fs/read_all/read_all.c
> @@ -60,6 +60,10 @@
>  #define MAX_PATH 4096
>  #define MAX_DISPLAY 40

> +#if !defined(FNM_EXTMATCH)
Maybe just
#ifndef FNM_EXTMATCH

And maybe it'd be good to put this definition into include/lapi/fnmatch.h
(create it), so it can be reused.

FYI: LTP isn't musl ready atm.

> +#define FNM_EXTMATCH 0
> +#endif
> +
>  struct queue {
>  	sem_t sem;
>  	int front;


Kind regards,
Petr

Patch

diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 42babae..f68217b 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -60,6 +60,10 @@ 
 #define MAX_PATH 4096
 #define MAX_DISPLAY 40
 
+#if !defined(FNM_EXTMATCH)
+#define FNM_EXTMATCH 0
+#endif
+
 struct queue {
 	sem_t sem;
 	int front;